This commit is contained in:
@@ -188,7 +188,7 @@ namespace AyaNova.PlugIn.V8
|
||||
{
|
||||
if (!Map.ContainsKey(id))
|
||||
{
|
||||
throw new Exception("Error: GetMap (source id: "+ id.ToString() +") [" + details + "] - v7 Id not previously exported, missing or corrupted source data, export can not complete until fixed");
|
||||
throw new Exception("Error: GetMap (source id: " + id.ToString() + ") [" + details + "] - v7 Id not previously exported, missing or corrupted source data, export can not complete until fixed");
|
||||
}
|
||||
return Map[id];
|
||||
}
|
||||
@@ -303,7 +303,7 @@ namespace AyaNova.PlugIn.V8
|
||||
progress.Op("Exporting Business objects");
|
||||
//BIZ objects
|
||||
await ExportLocales(progress);
|
||||
await ExportStaffUsers(progress);
|
||||
await ExportStaffUsers(progress);
|
||||
await ExportContracts(progress);
|
||||
await ExportHeadOffices(progress);
|
||||
await ExportClients(progress);
|
||||
@@ -318,7 +318,7 @@ namespace AyaNova.PlugIn.V8
|
||||
await ExportVendors(progress);
|
||||
await ExportExternalUsers(progress);//needs vendors, clients and headoffices already exported so needs to be here late
|
||||
await ExportMemos(progress);
|
||||
|
||||
|
||||
await ExportServiceWorkorders(progress);
|
||||
//todo: these are now invalid and awaiting RAVEN end implementation
|
||||
//after which can copy mostly from service workorder block
|
||||
@@ -852,8 +852,8 @@ namespace AyaNova.PlugIn.V8
|
||||
d.webAddress = c.WebAddress;
|
||||
d.popUpNotes = c.PopUpNotes;
|
||||
d.billHeadOffice = c.BillHeadOffice;
|
||||
|
||||
|
||||
|
||||
|
||||
if (c.HeadOfficeID != Guid.Empty)
|
||||
{
|
||||
d.headOfficeId = GetMap(c.HeadOfficeID, "HeadOffice for Client " + d.name);
|
||||
@@ -861,7 +861,7 @@ namespace AyaNova.PlugIn.V8
|
||||
d.techNotes = c.TechNotes;
|
||||
d.accountNumber = c.AccountNumber;
|
||||
d.usesBanking = c.UsesBanking;
|
||||
|
||||
|
||||
if (c.ContractID != Guid.Empty)
|
||||
{
|
||||
d.contractId = GetMap(c.ContractID, "Contract for Client " + d.name);
|
||||
@@ -1065,7 +1065,7 @@ namespace AyaNova.PlugIn.V8
|
||||
{
|
||||
d.contractId = GetMap(c.ContractID, "Contract for Head Office " + d.name);
|
||||
}
|
||||
|
||||
|
||||
d.contractExpires = c.ContractExpires;//?? dates
|
||||
d.phone1 = c.Phone1;
|
||||
d.phone2 = c.Phone2;
|
||||
@@ -1755,19 +1755,19 @@ namespace AyaNova.PlugIn.V8
|
||||
tags.Add(ImportTag);
|
||||
|
||||
Vendor c = Vendor.GetItem(i.ID);
|
||||
var ObjectTID = new TypeAndID(RootObjectTypes.Vendor, c.ID);
|
||||
var ObjectTID = new TypeAndID(RootObjectTypes.Vendor, c.ID);
|
||||
|
||||
dynamic d = new JObject();
|
||||
d.name = GetUniqueName(c.Name);
|
||||
if (IsDuplicateMapItem(c.ID, c.Name, progress)) continue;
|
||||
progress.Op(ObjectTypeName + " " + d.name);
|
||||
d.active = c.Active;
|
||||
|
||||
|
||||
|
||||
|
||||
d.notes = c.Notes;
|
||||
d.contact = c.Contact;
|
||||
d.contactNotes = c.ContactNotes;
|
||||
d.contactNotes = c.ContactNotes;
|
||||
d.webAddress = c.WebAddress;
|
||||
d.accountNumber = c.AccountNumber;
|
||||
d.phone1 = c.Phone1;
|
||||
@@ -1859,47 +1859,53 @@ namespace AyaNova.PlugIn.V8
|
||||
progress.Op("Start Memos export");
|
||||
progress.SubOp("");
|
||||
var ObjectTypeName = "Memo";
|
||||
|
||||
//Step 2: export the objects
|
||||
MemoList pl = MemoList.GetListForSingleItem(PluginID);
|
||||
|
||||
progress.Append("Exporting " + pl.Count.ToString() + " " + ObjectTypeName + "s");
|
||||
List<string> tags = new List<string>();
|
||||
tags.Add(ImportTag);
|
||||
|
||||
foreach (MemoList.MemoListInfo i in pl)
|
||||
//Get all user id's then get all memo id's for each user id then fetch each memo and finally export
|
||||
UserPickList upl = UserPickList.GetList(false);
|
||||
foreach (UserPickList.UserPickListInfo upli in upl)
|
||||
{
|
||||
if (!progress.KeepGoing) return;
|
||||
List<string> tags = new List<string>();
|
||||
tags.Add(ImportTag);
|
||||
UserMemoIdList umidl = UserMemoIdList.GetList(upli.ID);
|
||||
foreach (UserMemoIdList.UserMemoIdListInfo mid in umidl)
|
||||
{
|
||||
if (!progress.KeepGoing) return;
|
||||
Memo mem = Memo.GetItem(mid.mID, PluginID);
|
||||
dynamic d = new JObject();
|
||||
dynamic dmemo = new JObject();
|
||||
dynamic duserid = new JArray();
|
||||
dmemo.name = mem.Subject;
|
||||
dmemo.notes = mem.Message;
|
||||
dmemo.viewed = mem.Viewed;
|
||||
dmemo.replied = mem.Replied;
|
||||
var RavenFromId=SafeGetUserMap(mem.FromID);
|
||||
dmemo.fromId = RavenFromId;
|
||||
dmemo.sent = mem.Created;
|
||||
|
||||
|
||||
duserid.Add(SafeGetUserMap(mem.ToID));
|
||||
d.users = duserid;
|
||||
d.memo = dmemo;
|
||||
SetTags(d, tags);
|
||||
progress.Op(ObjectTypeName + " " + mem.ID.ToString());
|
||||
|
||||
dynamic d = new JObject();
|
||||
d.name = i.LT_Memo_Label_Subject.Display;
|
||||
d.notes = i.LT_Memo_Label_Message;
|
||||
//d.customFields = "{}";
|
||||
//d.tags = "[]";
|
||||
d.viewed = i.LT_Memo_Label_Viewed;
|
||||
d.replied = i.LT_Memo_Label_Replied;
|
||||
d.fromId = SafeGetUserMap(i.LT_Memo_Label_FromID.Value);
|
||||
d.sent = i.LT_Memo_Label_Sent;
|
||||
|
||||
progress.Op(ObjectTypeName + " " + i.ID.ToString());
|
||||
|
||||
|
||||
var rMainObject = await util.PostAsync("memo", d.ToString());
|
||||
long RavenId = util.IdFromResponse(rMainObject);
|
||||
|
||||
var rMainObject = await util.PostAsync("memo", d.ToString());
|
||||
long RavenId = util.IdFromResponse(rMainObject);
|
||||
|
||||
//-----
|
||||
|
||||
d = rMainObject.ObjectResponse["data"];
|
||||
|
||||
//-----
|
||||
d = rMainObject.ObjectResponse["data"];
|
||||
|
||||
//Event log fixup
|
||||
await util.EventLog(util.AyaType.Project, RavenId, SafeGetUserMap(i.LT_Memo_Label_FromID.Value), SafeGetUserMap(i.LT_Memo_Label_FromID.Value), i.LT_Memo_Label_Sent.ToString(), i.LT_Memo_Label_Sent.ToString());
|
||||
//-----
|
||||
|
||||
//Event log fixup
|
||||
await util.EventLog(util.AyaType.Project, RavenId, RavenFromId, RavenFromId, mem.Created, mem.Modified);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//------
|
||||
|
||||
|
||||
}
|
||||
#endregion Memos
|
||||
|
||||
@@ -2851,9 +2857,9 @@ namespace AyaNova.PlugIn.V8
|
||||
else
|
||||
RavenTypeAsString = ((int)util.RootObjectToAyaType(tid.RootObjectType)).ToString();
|
||||
formDataContent.Add(new StringContent(RavenTypeAsString), name: "AttachToObjectType");
|
||||
|
||||
|
||||
//formDataContent.Add(new StringContent(Map[tid.ID].ToString()), name: "AttachToObjectId");
|
||||
formDataContent.Add(new StringContent(GetMap(tid.ID, "Object ID for attachment export (tid:"+tid.ToString()+") ").ToString()), name: "AttachToObjectId");
|
||||
formDataContent.Add(new StringContent(GetMap(tid.ID, "Object ID for attachment export (tid:" + tid.ToString() + ") ").ToString()), name: "AttachToObjectId");
|
||||
formDataContent.Add(new StringContent(ImportTag), name: "Notes");
|
||||
formDataContent.Add(new StringContent(dFileData.ToString()), name: "FileData");
|
||||
|
||||
@@ -2949,10 +2955,10 @@ namespace AyaNova.PlugIn.V8
|
||||
else
|
||||
RavenTypeAsString = ((int)util.RootObjectToAyaType(tid.RootObjectType)).ToString();
|
||||
formDataContent.Add(new StringContent(RavenTypeAsString), name: "AttachToObjectType");
|
||||
// formDataContent.Add(new StringContent(Map[tid.ID].ToString()), name: "AttachToObjectId");
|
||||
// formDataContent.Add(new StringContent(Map[tid.ID].ToString()), name: "AttachToObjectId");
|
||||
formDataContent.Add(new StringContent(GetMap(tid.ID, "Object ID for attached docs export (tid:" + tid.ToString() + ") ").ToString()), name: "AttachToObjectId");
|
||||
|
||||
|
||||
|
||||
|
||||
formDataContent.Add(new StringContent(doc.Description + " (" + ImportTag + ")"), name: "Notes");
|
||||
formDataContent.Add(new StringContent(dFileData.ToString()), name: "FileData");
|
||||
@@ -2996,7 +3002,7 @@ namespace AyaNova.PlugIn.V8
|
||||
MatchCollection mc = AyaBizUtils.rxAyaImageTags.Matches(content);
|
||||
foreach (Match m in mc)
|
||||
{
|
||||
var RavenId = GetMap(new Guid(m.Groups["guid"].Value), "Object id for Wiki export (tid:" + tid.ToString()+")"); //Map[new Guid(m.Groups["guid"].Value)];
|
||||
var RavenId = GetMap(new Guid(m.Groups["guid"].Value), "Object id for Wiki export (tid:" + tid.ToString() + ")"); //Map[new Guid(m.Groups["guid"].Value)];
|
||||
content = content.Replace(m.Value, "<img src=\"" + "[ATTACH:" + RavenId.ToString() + "]" + "\">");
|
||||
}
|
||||
|
||||
|
||||
@@ -201,6 +201,9 @@
|
||||
<Compile Include="GZTW.AyaNova.BLL\ClientExistanceChecker.cs" />
|
||||
<Compile Include="GZTW.AyaNova.BLL\ClientNoteEr.cs" />
|
||||
<Compile Include="GZTW.AyaNova.BLL\ClientNoteList.cs" />
|
||||
<Compile Include="GZTW.AyaNova.BLL\ClientNotificationList.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="GZTW.AyaNova.BLL\ClientPopUpNotesFetcher.cs" />
|
||||
<Compile Include="GZTW.AyaNova.BLL\ClientServiceRequestListRI.cs" />
|
||||
<Compile Include="GZTW.AyaNova.BLL\ClientServiceRequestNameFetcher.cs" />
|
||||
@@ -269,7 +272,6 @@
|
||||
<Compile Include="GZTW.AyaNova.BLL\ClientWorkorderList.cs" />
|
||||
<Compile Include="GZTW.AyaNova.BLL\AyaFile.cs" />
|
||||
<Compile Include="GZTW.AyaNova.BLL\ClientNotifyEvent.cs" />
|
||||
<Compile Include="GZTW.AyaNova.BLL\ClientNotificationList.cs" />
|
||||
<Compile Include="GZTW.AyaNova.BLL\AddressFieldPickList.cs" />
|
||||
<Compile Include="GZTW.AyaNova.BLL\ClientWorkorderListEx.cs" />
|
||||
<Compile Include="GZTW.AyaNova.BLL\ClientNotesReportList.cs" />
|
||||
@@ -318,6 +320,7 @@
|
||||
<Compile Include="GZTW.AyaNova.BLL\UnitMeterReadingListRI.cs" />
|
||||
<Compile Include="GZTW.AyaNova.BLL\UnitOfMeasurePickList.cs" />
|
||||
<Compile Include="GZTW.AyaNova.BLL\UnitServiceTypePickList.cs" />
|
||||
<Compile Include="GZTW.AyaNova.BLL\UserMemoIdList.cs" />
|
||||
<Compile Include="GZTW.AyaNova.BLL\UserTypeFetcher.cs" />
|
||||
<Compile Include="GZTW.AyaNova.BLL\UserTimeZoneOffsetFetcher.cs" />
|
||||
<Compile Include="GZTW.AyaNova.BLL\WikiPageExistanceChecker.cs" />
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -20,78 +20,78 @@ namespace GZTW.AyaNova.BLL
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
/// <summary>
|
||||
/// Lightweight read only list of <see cref="MemoList.MemoListInfo"/> objects representing <see cref="Memo"/> object
|
||||
///
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class MemoList : ReadOnlyCollectionBase
|
||||
{
|
||||
/// Lightweight read only list of <see cref="MemoList.MemoListInfo"/> objects representing <see cref="Memo"/> object
|
||||
///
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class MemoList : ReadOnlyCollectionBase
|
||||
{
|
||||
|
||||
|
||||
#region Data structure
|
||||
/// <summary>
|
||||
/// Properties
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public struct MemoListInfo
|
||||
{
|
||||
internal Guid mID;
|
||||
internal SmartDate mCreated;
|
||||
internal GridRelativeTimeCellItem mCreatedRelative;
|
||||
|
||||
#region Data structure
|
||||
/// <summary>
|
||||
/// Properties
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public struct MemoListInfo
|
||||
{
|
||||
internal Guid mID;
|
||||
internal SmartDate mCreated;
|
||||
internal GridRelativeTimeCellItem mCreatedRelative;
|
||||
internal GridNameValueCellItem mSubject;
|
||||
internal string mMessage;
|
||||
internal GridNameValueCellItem mFrom;
|
||||
//internal Guid mFrom;
|
||||
internal bool mViewed;
|
||||
internal bool mReplied;
|
||||
internal string mMessage;
|
||||
internal GridNameValueCellItem mFrom;
|
||||
//internal Guid mFrom;
|
||||
internal bool mViewed;
|
||||
internal bool mReplied;
|
||||
|
||||
//ID Not localized as it's an invisible field
|
||||
//ID Not localized as it's an invisible field
|
||||
[Display(DisplayType.Hidden)]
|
||||
public Guid ID
|
||||
{
|
||||
get
|
||||
{
|
||||
return mID;
|
||||
}
|
||||
}
|
||||
public Guid ID
|
||||
{
|
||||
get
|
||||
{
|
||||
return mID;
|
||||
}
|
||||
}
|
||||
|
||||
[SqlColumnNameAttribute("aMemo.aCreated"), Display(DisplayType.DateTime)]
|
||||
public object LT_Memo_Label_Sent
|
||||
{
|
||||
get
|
||||
{
|
||||
return mCreated.DBValue;
|
||||
}
|
||||
}
|
||||
[SqlColumnNameAttribute("aMemo.aCreated"),Display(DisplayType.DateTime)]
|
||||
public object LT_Memo_Label_Sent
|
||||
{
|
||||
get
|
||||
{
|
||||
return mCreated.DBValue;
|
||||
}
|
||||
}
|
||||
|
||||
[SqlColumnNameAttribute("grid"), Display(DisplayType.Text)]
|
||||
public GridRelativeTimeCellItem LT_Memo_Label_Sent_Relative
|
||||
{
|
||||
get
|
||||
{
|
||||
return mCreatedRelative;
|
||||
}
|
||||
}
|
||||
public GridRelativeTimeCellItem LT_Memo_Label_Sent_Relative
|
||||
{
|
||||
get
|
||||
{
|
||||
return mCreatedRelative;
|
||||
}
|
||||
}
|
||||
|
||||
[SqlColumnNameAttribute("aUser.aLastName",
|
||||
"aMemo.aFromID"),
|
||||
Display(DisplayType.Button, RootObjectType = RootObjectTypes.Client)]
|
||||
public GridNameValueCellItem LT_Memo_Label_FromID
|
||||
{
|
||||
get
|
||||
{
|
||||
return mFrom;
|
||||
}
|
||||
}
|
||||
public GridNameValueCellItem LT_Memo_Label_FromID
|
||||
{
|
||||
get
|
||||
{
|
||||
return mFrom;
|
||||
}
|
||||
}
|
||||
|
||||
[SqlColumnNameAttribute("aMemo.aSubject", "aMemo.aID"), Display(DisplayType.Button, RootObjectType = RootObjectTypes.Memo)]
|
||||
public GridNameValueCellItem LT_Memo_Label_Subject
|
||||
{
|
||||
get
|
||||
{
|
||||
return mSubject;
|
||||
}
|
||||
}
|
||||
{
|
||||
get
|
||||
{
|
||||
return mSubject;
|
||||
}
|
||||
}
|
||||
|
||||
[Display(DisplayType.Hidden)]
|
||||
public string LT_Memo_Label_Message
|
||||
@@ -103,118 +103,118 @@ namespace GZTW.AyaNova.BLL
|
||||
}
|
||||
|
||||
[SqlColumnNameAttribute("aMemo.aViewed"), Display(DisplayType.Hidden)]//case 1805 added column name attribute so can set criteria for dashboard
|
||||
public bool LT_Memo_Label_Viewed
|
||||
{
|
||||
get
|
||||
{
|
||||
return mViewed;
|
||||
}
|
||||
}
|
||||
public bool LT_Memo_Label_Viewed
|
||||
{
|
||||
get
|
||||
{
|
||||
return mViewed;
|
||||
}
|
||||
}
|
||||
|
||||
//Special control, i.e. in this case image checkbox showing replied graphic or not replied graphic
|
||||
[Display(DisplayType.SpecialControl)]
|
||||
public bool LT_Memo_Label_Replied
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.mReplied;
|
||||
}
|
||||
}
|
||||
public bool LT_Memo_Label_Replied
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.mReplied;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="obj"></param>
|
||||
public bool Equals(MemoListInfo obj)
|
||||
{
|
||||
return this.ID.Equals(obj.ID);
|
||||
}
|
||||
|
||||
}//end MemoListInfo
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
private RelativeTimeFormatter rtfm=null;
|
||||
|
||||
protected MemoList()
|
||||
{
|
||||
|
||||
rtfm=RelativeTimeFormatter.GetItem(User.CurrentUserLanguage);
|
||||
// AllowSort=false;
|
||||
// AllowFind=true;
|
||||
// AllowEdit=false;
|
||||
// AllowNew=false;
|
||||
// AllowRemove=false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Business properties and methods
|
||||
|
||||
/// <summary>
|
||||
/// Get item by index
|
||||
/// </summary>
|
||||
/// <param name="Item"></param>
|
||||
public MemoListInfo this[int Item]
|
||||
{
|
||||
|
||||
get
|
||||
{
|
||||
return (MemoListInfo) List[Item];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns display text that matches passed in itemid value
|
||||
/// </summary>
|
||||
/// <param name="ItemID"></param>
|
||||
public string this[Guid ItemID]
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="obj"></param>
|
||||
public bool Equals(MemoListInfo obj)
|
||||
{
|
||||
return this.ID.Equals(obj.ID);
|
||||
}
|
||||
get
|
||||
{
|
||||
foreach (MemoListInfo child in List)
|
||||
{
|
||||
if(child.ID==ItemID) return child.ToString();
|
||||
}
|
||||
return "Missing: "+ItemID.ToString();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
}//end MemoListInfo
|
||||
#endregion
|
||||
#region contains
|
||||
/// <summary>
|
||||
/// Check if item in collection
|
||||
/// </summary>
|
||||
/// <param name="obj"></param>
|
||||
public bool Contains(MemoListInfo obj)
|
||||
{
|
||||
foreach (MemoListInfo child in List)
|
||||
{
|
||||
if(child.Equals(obj)) return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
#region Constructor
|
||||
private RelativeTimeFormatter rtfm = null;
|
||||
|
||||
protected MemoList()
|
||||
{
|
||||
|
||||
rtfm = RelativeTimeFormatter.GetItem(User.CurrentUserLanguage);
|
||||
// AllowSort=false;
|
||||
// AllowFind=true;
|
||||
// AllowEdit=false;
|
||||
// AllowNew=false;
|
||||
// AllowRemove=false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Business properties and methods
|
||||
|
||||
/// <summary>
|
||||
/// Get item by index
|
||||
/// </summary>
|
||||
/// <param name="Item"></param>
|
||||
public MemoListInfo this[int Item]
|
||||
{
|
||||
|
||||
get
|
||||
{
|
||||
return (MemoListInfo)List[Item];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns display text that matches passed in itemid value
|
||||
/// </summary>
|
||||
/// <param name="ItemID"></param>
|
||||
public string this[Guid ItemID]
|
||||
{
|
||||
|
||||
get
|
||||
{
|
||||
foreach (MemoListInfo child in List)
|
||||
{
|
||||
if (child.ID == ItemID) return child.ToString();
|
||||
}
|
||||
return "Missing: " + ItemID.ToString();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region contains
|
||||
/// <summary>
|
||||
/// Check if item in collection
|
||||
/// </summary>
|
||||
/// <param name="obj"></param>
|
||||
public bool Contains(MemoListInfo obj)
|
||||
{
|
||||
foreach (MemoListInfo child in List)
|
||||
{
|
||||
if (child.Equals(obj)) return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Reporting and shared UI editor helpers
|
||||
|
||||
/// <summary>
|
||||
/// Returns the report key which is a property of
|
||||
/// reports used to link all reports that can be used
|
||||
/// with a particular data source.
|
||||
/// </summary>
|
||||
public static string ReportKey
|
||||
{
|
||||
get
|
||||
{
|
||||
return "MemoList";
|
||||
}
|
||||
}
|
||||
/// Returns the report key which is a property of
|
||||
/// reports used to link all reports that can be used
|
||||
/// with a particular data source.
|
||||
/// </summary>
|
||||
public static string ReportKey
|
||||
{
|
||||
get
|
||||
{
|
||||
return "MemoList";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the Detailed report key
|
||||
@@ -298,9 +298,9 @@ namespace GZTW.AyaNova.BLL
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Static methods
|
||||
#region Static methods
|
||||
|
||||
/// <summary>
|
||||
/// Internal method used by list factory
|
||||
@@ -310,16 +310,16 @@ namespace GZTW.AyaNova.BLL
|
||||
return (MemoList)DataPortal.Fetch(new Criteria(Filter, IDList, MaxRecords));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get all Memo (filtered by crit)
|
||||
/// </summary>
|
||||
/// <param name="xmlCriteria">Use AyaNova UI to easily build xmlCriteria and Ctrl-Alt-g keyboard command to display it for use in your code</param>
|
||||
/// <summary>
|
||||
/// Get all Memo (filtered by crit)
|
||||
/// </summary>
|
||||
/// <param name="xmlCriteria">Use AyaNova UI to easily build xmlCriteria and Ctrl-Alt-g keyboard command to display it for use in your code</param>
|
||||
/// <returns>list of <see cref="MemoList.MemoListInfo"/> objects</returns>
|
||||
|
||||
public static MemoList GetList(string xmlCriteria)
|
||||
{
|
||||
|
||||
public static MemoList GetList(string xmlCriteria)
|
||||
{
|
||||
return (MemoList)DataPortal.Fetch(new Criteria(xmlCriteria, null, -1));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Takes a single ID and returns a "list" of one object
|
||||
@@ -349,75 +349,62 @@ namespace GZTW.AyaNova.BLL
|
||||
return (MemoList)DataPortal.Fetch(new Criteria("", IDList, -1));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return an empty list
|
||||
/// used for initializing grid
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static MemoList GetEmptyList()
|
||||
{
|
||||
return new MemoList();
|
||||
}
|
||||
/// <summary>
|
||||
/// Return an empty list
|
||||
/// used for initializing grid
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static MemoList GetEmptyList()
|
||||
{
|
||||
return new MemoList();
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region DAL DATA ACCESS
|
||||
///
|
||||
/// <param name="Criteria"></param>
|
||||
protected override void DataPortal_Fetch(object Criteria)
|
||||
{
|
||||
#region DAL DATA ACCESS
|
||||
///
|
||||
/// <param name="Criteria"></param>
|
||||
protected override void DataPortal_Fetch(object Criteria)
|
||||
{
|
||||
|
||||
Criteria crit = (Criteria)Criteria;
|
||||
|
||||
Criteria crit = (Criteria)Criteria;
|
||||
|
||||
SafeDataReader dr = null;
|
||||
SafeDataReader dr = null;
|
||||
DateTime dtNow = DBUtil.CurrentWorkingDateTime;
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
if (crit.IDList != null)
|
||||
{
|
||||
//v8 Migrate related change
|
||||
//this is a workaround to get all the memos even though the current user is not the recipient of all of them
|
||||
if (crit.IDList.Count == 1 && crit.IDList[0] == new Guid("{BD608E8A-820C-46D1-9D81-4CCB6E71B213}"))//v8 migrate plugin id
|
||||
//Case 556
|
||||
System.Text.StringBuilder sbIN = new System.Text.StringBuilder();
|
||||
sbIN.Append(" WHERE (aMemo.aID in (");
|
||||
foreach (Guid gItem in crit.IDList)
|
||||
{
|
||||
dr = DBUtil.GetReaderFromSQLString(
|
||||
"SELECT aMemo.aID, aMemo.aCreated, " +
|
||||
"aMemo.aViewed, aMemo.aReplied, aMemo.aSubject, aMemo.aMessage, " +
|
||||
"aMemo.aFromID, aMemo.aToId, " +
|
||||
"'first' as afirstname, 'last' as alastname, 'ii' as ainitials, 'en' as aemployeenumber, 'r' as aregionname " +
|
||||
"FROM aMemo order by amemo.acreated");
|
||||
sbIN.Append("'");
|
||||
sbIN.Append("{");
|
||||
sbIN.Append(gItem.ToString().ToUpperInvariant());
|
||||
sbIN.Append("}");
|
||||
sbIN.Append("',");
|
||||
}
|
||||
else
|
||||
{
|
||||
//Case 556
|
||||
System.Text.StringBuilder sbIN = new System.Text.StringBuilder();
|
||||
sbIN.Append(" WHERE (aMemo.aID in (");
|
||||
foreach (Guid gItem in crit.IDList)
|
||||
{
|
||||
sbIN.Append("'");
|
||||
sbIN.Append("{");
|
||||
sbIN.Append(gItem.ToString().ToUpperInvariant());
|
||||
sbIN.Append("}");
|
||||
sbIN.Append("',");
|
||||
}
|
||||
sbIN.Length = sbIN.Length - 1;
|
||||
sbIN.Append(")) ");
|
||||
|
||||
//************************************************************
|
||||
dr = DBUtil.GetReaderFromSQLString(
|
||||
"SELECT aMemo.aID, aMemo.aCreated, " +
|
||||
"aMemo.aViewed, aMemo.aReplied, aMemo.aSubject, aMemo.aMessage, " +
|
||||
"aMemo.aFromID, aUser.aFirstName, aUser.aLastName, aUser.aInitials, AREGION.ANAME AS AREGIONNAME, " +
|
||||
"aUser.aEmployeeNumber FROM aMemo " +
|
||||
|
||||
" LEFT OUTER JOIN aUser ON aMemo.aFromID = aUser.aID " +
|
||||
" LEFT OUTER JOIN AREGION ON (AUSER.AREGIONID=AREGION.AID) " +
|
||||
sbIN.ToString() + " " +
|
||||
AyaBizUtils.GetGridSortOrderColumns(crit.CriteriaXML));
|
||||
}
|
||||
|
||||
|
||||
sbIN.Length = sbIN.Length - 1;
|
||||
sbIN.Append(")) ");
|
||||
|
||||
//************************************************************
|
||||
dr = DBUtil.GetReaderFromSQLString(
|
||||
"SELECT aMemo.aID, aMemo.aCreated, " +
|
||||
"aMemo.aViewed, aMemo.aReplied, aMemo.aSubject, aMemo.aMessage, " +
|
||||
"aMemo.aFromID, aUser.aFirstName, aUser.aLastName, aUser.aInitials, AREGION.ANAME AS AREGIONNAME, " +
|
||||
"aUser.aEmployeeNumber FROM aMemo " +
|
||||
|
||||
" LEFT OUTER JOIN aUser ON aMemo.aFromID = aUser.aID " +
|
||||
" LEFT OUTER JOIN AREGION ON (AUSER.AREGIONID=AREGION.AID) " +
|
||||
sbIN.ToString() + " " +
|
||||
AyaBizUtils.GetGridSortOrderColumns(crit.CriteriaXML));
|
||||
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -426,7 +413,7 @@ namespace GZTW.AyaNova.BLL
|
||||
"aMemo.aViewed, aMemo.aReplied, aMemo.aSubject, aMemo.aMessage, " +
|
||||
"aMemo.aFromID, aUser.aFirstName, aUser.aLastName, aUser.aInitials, AREGION.ANAME AS AREGIONNAME, " +
|
||||
"aUser.aEmployeeNumber FROM aMemo " +
|
||||
|
||||
|
||||
" LEFT OUTER JOIN aUser ON aMemo.aFromID = aUser.aID " +
|
||||
" LEFT OUTER JOIN AREGION ON (AUSER.AREGIONID=AREGION.AID) " +
|
||||
"WHERE (aMemo.aToID = @ID) " +
|
||||
@@ -441,45 +428,45 @@ namespace GZTW.AyaNova.BLL
|
||||
|
||||
dr = DBUtil.GetReaderFromSQLString(q, CurrentUserID);
|
||||
}
|
||||
while (dr.Read())
|
||||
{
|
||||
//*******************************************
|
||||
MemoListInfo info = new MemoListInfo();
|
||||
while(dr.Read())
|
||||
{
|
||||
//*******************************************
|
||||
MemoListInfo info=new MemoListInfo();
|
||||
|
||||
info.mID = dr.GetGuid("aID");
|
||||
|
||||
info.mCreated = DBUtil.ToLocal(dr.GetSmartDate("aCreated"));
|
||||
info.mCreatedRelative = new GridRelativeTimeCellItem(rtfm.Format(dtNow, info.mCreated));
|
||||
info.mFrom = new GridNameValueCellItem(
|
||||
dr.GetGuid("aFromID"),
|
||||
User.NameFormatter(dr.GetString("aFirstName"), dr.GetString("aLastName"), dr.GetString("aInitials"),
|
||||
info.mID=dr.GetGuid("aID");
|
||||
|
||||
info.mCreated=DBUtil.ToLocal(dr.GetSmartDate("aCreated"));
|
||||
info.mCreatedRelative = new GridRelativeTimeCellItem(rtfm.Format(dtNow,info.mCreated));
|
||||
info.mFrom=new GridNameValueCellItem(
|
||||
dr.GetGuid("aFromID"),
|
||||
User.NameFormatter(dr.GetString("aFirstName"),dr.GetString("aLastName"),dr.GetString("aInitials"),
|
||||
dr.GetString("aEmployeeNumber"), dr.GetString("AREGIONNAME"), AyaBizUtils.GlobalSettings.DefaultScheduleableUserNameDisplayFormat)
|
||||
, RootObjectTypes.User);
|
||||
,RootObjectTypes.User);
|
||||
|
||||
info.mSubject = new GridNameValueCellItem(
|
||||
dr.GetGuid("aID"),
|
||||
dr.GetString("aSubject"),
|
||||
dr.GetString("aSubject"),
|
||||
RootObjectTypes.Memo);
|
||||
|
||||
|
||||
info.mViewed = dr.GetBoolean("aViewed");
|
||||
info.mReplied = dr.GetBoolean("aReplied");
|
||||
|
||||
info.mViewed=dr.GetBoolean("aViewed");
|
||||
info.mReplied=dr.GetBoolean("aReplied");
|
||||
info.mMessage = dr.GetString("aMessage");
|
||||
|
||||
InnerList.Add(info);
|
||||
//*******************************************
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if(dr!=null) dr.Close();
|
||||
}
|
||||
|
||||
InnerList.Add(info);
|
||||
//*******************************************
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (dr != null) dr.Close();
|
||||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region criteria
|
||||
#region criteria
|
||||
/// <summary>
|
||||
/// Criteria for identifying existing object
|
||||
/// </summary>
|
||||
@@ -496,8 +483,8 @@ namespace GZTW.AyaNova.BLL
|
||||
MaxRecords = _MaxRecords;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
}//end MemoList
|
||||
#endregion
|
||||
|
||||
}//end MemoList
|
||||
#pragma warning restore 1591
|
||||
}//end namespace GZTW.AyaNova.BLL
|
||||
188
source/bizobjects/AyaLib/GZTW.AyaNova.BLL/UserMemoIdList.cs
Normal file
188
source/bizobjects/AyaLib/GZTW.AyaNova.BLL/UserMemoIdList.cs
Normal file
@@ -0,0 +1,188 @@
|
||||
///////////////////////////////////////////////////////////
|
||||
// UserMemoIdList.cs
|
||||
// Implementation of Class UserMemoIdList
|
||||
// CSLA type: Read only collection
|
||||
// Created on: 11-Dec-2008
|
||||
// Object design: John
|
||||
// Coded: 11-Dec-2008
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
using System;
|
||||
using System.Data;
|
||||
using GZTW.Data;
|
||||
using CSLA.Data;
|
||||
using CSLA;
|
||||
|
||||
namespace GZTW.AyaNova.BLL
|
||||
{
|
||||
/// <summary>
|
||||
/// List of UserMemoIds for internal migration processing
|
||||
///
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class UserMemoIdList : ReadOnlyCollectionBase
|
||||
{
|
||||
#region Data structure
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public struct UserMemoIdListInfo
|
||||
{
|
||||
|
||||
public Guid mID;
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="obj"></param>
|
||||
public bool Equals(UserMemoIdListInfo obj)
|
||||
{
|
||||
return this.mID.Equals(obj.mID);
|
||||
}
|
||||
|
||||
}//end UserMemoIdListInfo
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
|
||||
protected UserMemoIdList()
|
||||
{
|
||||
// AllowSort=false;
|
||||
// AllowFind=true;
|
||||
// AllowEdit=false;
|
||||
// AllowNew=false;
|
||||
// AllowRemove=false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Business properties and methods
|
||||
|
||||
/// <summary>
|
||||
/// Get item by index
|
||||
/// </summary>
|
||||
/// <param name="Item"></param>
|
||||
public UserMemoIdListInfo this[int Item]
|
||||
{
|
||||
|
||||
get
|
||||
{
|
||||
return (UserMemoIdListInfo)List[Item];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns UserMemoIdListInfo item that matches passed in itemid value
|
||||
/// </summary>
|
||||
/// <param name="ItemID"></param>
|
||||
public UserMemoIdListInfo this[Guid ItemID]
|
||||
{
|
||||
|
||||
get
|
||||
{
|
||||
foreach (UserMemoIdListInfo child in List)
|
||||
{
|
||||
if (child.mID == ItemID) return child;
|
||||
}
|
||||
throw new ArgumentException("UserMemoIdList: ID not found:\r\n" + ItemID.ToString());
|
||||
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region contains
|
||||
/// <summary>
|
||||
/// Check if item in collection
|
||||
/// </summary>
|
||||
/// <param name="obj"></param>
|
||||
public bool Contains(UserMemoIdListInfo obj)
|
||||
{
|
||||
foreach (UserMemoIdListInfo child in List)
|
||||
{
|
||||
if (child.Equals(obj)) return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Static methods
|
||||
/// <summary>
|
||||
/// Get all for user
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
|
||||
public static UserMemoIdList GetList(Guid UserId)
|
||||
{
|
||||
return (UserMemoIdList)DataPortal.Fetch(new Criteria(UserId));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region DAL DATA ACCESS
|
||||
///
|
||||
/// <param name="Criteria"></param>
|
||||
protected override void DataPortal_Fetch(object Criteria)
|
||||
{
|
||||
Criteria crit = (Criteria)Criteria;
|
||||
SafeDataReader dr = null;
|
||||
try
|
||||
{
|
||||
//case 1163
|
||||
//SmartDate rightnow=new SmartDate(DateTime.Now);
|
||||
DateTime dtNowUTC = DateTime.Now.ToUniversalTime();
|
||||
|
||||
dr = DBUtil.GetReaderFromSQLString(
|
||||
//************************************************************
|
||||
"SELECT AMEMO.AID FROM AMEMO WHERE ATOID=@ID",crit.ID
|
||||
//************************************************************
|
||||
)
|
||||
;
|
||||
|
||||
|
||||
while (dr.Read())
|
||||
{
|
||||
//*******************************************
|
||||
UserMemoIdListInfo info = new UserMemoIdListInfo();
|
||||
info.mID = dr.GetGuid("aID");
|
||||
|
||||
InnerList.Add(info);
|
||||
//*******************************************
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (dr != null) dr.Close();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region criteria
|
||||
/// <summary>
|
||||
/// Criteria for identifying existing object
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
private class Criteria
|
||||
{
|
||||
|
||||
|
||||
public Guid ID;
|
||||
public Criteria(Guid _ID)
|
||||
{
|
||||
ID = _ID;
|
||||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
}//end UserMemoIdList
|
||||
|
||||
}//end namespace GZTW.AyaNova.BLL
|
||||
Reference in New Issue
Block a user