This commit is contained in:
@@ -188,7 +188,7 @@ namespace AyaNova.PlugIn.V8
|
|||||||
{
|
{
|
||||||
if (!Map.ContainsKey(id))
|
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];
|
return Map[id];
|
||||||
}
|
}
|
||||||
@@ -303,7 +303,7 @@ namespace AyaNova.PlugIn.V8
|
|||||||
progress.Op("Exporting Business objects");
|
progress.Op("Exporting Business objects");
|
||||||
//BIZ objects
|
//BIZ objects
|
||||||
await ExportLocales(progress);
|
await ExportLocales(progress);
|
||||||
await ExportStaffUsers(progress);
|
await ExportStaffUsers(progress);
|
||||||
await ExportContracts(progress);
|
await ExportContracts(progress);
|
||||||
await ExportHeadOffices(progress);
|
await ExportHeadOffices(progress);
|
||||||
await ExportClients(progress);
|
await ExportClients(progress);
|
||||||
@@ -318,7 +318,7 @@ namespace AyaNova.PlugIn.V8
|
|||||||
await ExportVendors(progress);
|
await ExportVendors(progress);
|
||||||
await ExportExternalUsers(progress);//needs vendors, clients and headoffices already exported so needs to be here late
|
await ExportExternalUsers(progress);//needs vendors, clients and headoffices already exported so needs to be here late
|
||||||
await ExportMemos(progress);
|
await ExportMemos(progress);
|
||||||
|
|
||||||
await ExportServiceWorkorders(progress);
|
await ExportServiceWorkorders(progress);
|
||||||
//todo: these are now invalid and awaiting RAVEN end implementation
|
//todo: these are now invalid and awaiting RAVEN end implementation
|
||||||
//after which can copy mostly from service workorder block
|
//after which can copy mostly from service workorder block
|
||||||
@@ -852,8 +852,8 @@ namespace AyaNova.PlugIn.V8
|
|||||||
d.webAddress = c.WebAddress;
|
d.webAddress = c.WebAddress;
|
||||||
d.popUpNotes = c.PopUpNotes;
|
d.popUpNotes = c.PopUpNotes;
|
||||||
d.billHeadOffice = c.BillHeadOffice;
|
d.billHeadOffice = c.BillHeadOffice;
|
||||||
|
|
||||||
|
|
||||||
if (c.HeadOfficeID != Guid.Empty)
|
if (c.HeadOfficeID != Guid.Empty)
|
||||||
{
|
{
|
||||||
d.headOfficeId = GetMap(c.HeadOfficeID, "HeadOffice for Client " + d.name);
|
d.headOfficeId = GetMap(c.HeadOfficeID, "HeadOffice for Client " + d.name);
|
||||||
@@ -861,7 +861,7 @@ namespace AyaNova.PlugIn.V8
|
|||||||
d.techNotes = c.TechNotes;
|
d.techNotes = c.TechNotes;
|
||||||
d.accountNumber = c.AccountNumber;
|
d.accountNumber = c.AccountNumber;
|
||||||
d.usesBanking = c.UsesBanking;
|
d.usesBanking = c.UsesBanking;
|
||||||
|
|
||||||
if (c.ContractID != Guid.Empty)
|
if (c.ContractID != Guid.Empty)
|
||||||
{
|
{
|
||||||
d.contractId = GetMap(c.ContractID, "Contract for Client " + d.name);
|
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.contractId = GetMap(c.ContractID, "Contract for Head Office " + d.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
d.contractExpires = c.ContractExpires;//?? dates
|
d.contractExpires = c.ContractExpires;//?? dates
|
||||||
d.phone1 = c.Phone1;
|
d.phone1 = c.Phone1;
|
||||||
d.phone2 = c.Phone2;
|
d.phone2 = c.Phone2;
|
||||||
@@ -1755,19 +1755,19 @@ namespace AyaNova.PlugIn.V8
|
|||||||
tags.Add(ImportTag);
|
tags.Add(ImportTag);
|
||||||
|
|
||||||
Vendor c = Vendor.GetItem(i.ID);
|
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();
|
dynamic d = new JObject();
|
||||||
d.name = GetUniqueName(c.Name);
|
d.name = GetUniqueName(c.Name);
|
||||||
if (IsDuplicateMapItem(c.ID, c.Name, progress)) continue;
|
if (IsDuplicateMapItem(c.ID, c.Name, progress)) continue;
|
||||||
progress.Op(ObjectTypeName + " " + d.name);
|
progress.Op(ObjectTypeName + " " + d.name);
|
||||||
d.active = c.Active;
|
d.active = c.Active;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
d.notes = c.Notes;
|
d.notes = c.Notes;
|
||||||
d.contact = c.Contact;
|
d.contact = c.Contact;
|
||||||
d.contactNotes = c.ContactNotes;
|
d.contactNotes = c.ContactNotes;
|
||||||
d.webAddress = c.WebAddress;
|
d.webAddress = c.WebAddress;
|
||||||
d.accountNumber = c.AccountNumber;
|
d.accountNumber = c.AccountNumber;
|
||||||
d.phone1 = c.Phone1;
|
d.phone1 = c.Phone1;
|
||||||
@@ -1859,47 +1859,53 @@ namespace AyaNova.PlugIn.V8
|
|||||||
progress.Op("Start Memos export");
|
progress.Op("Start Memos export");
|
||||||
progress.SubOp("");
|
progress.SubOp("");
|
||||||
var ObjectTypeName = "Memo";
|
var ObjectTypeName = "Memo";
|
||||||
|
List<string> tags = new List<string>();
|
||||||
//Step 2: export the objects
|
tags.Add(ImportTag);
|
||||||
MemoList pl = MemoList.GetListForSingleItem(PluginID);
|
|
||||||
|
|
||||||
progress.Append("Exporting " + pl.Count.ToString() + " " + ObjectTypeName + "s");
|
|
||||||
|
|
||||||
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;
|
if (!progress.KeepGoing) return;
|
||||||
List<string> tags = new List<string>();
|
UserMemoIdList umidl = UserMemoIdList.GetList(upli.ID);
|
||||||
tags.Add(ImportTag);
|
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();
|
var rMainObject = await util.PostAsync("memo", d.ToString());
|
||||||
d.name = i.LT_Memo_Label_Subject.Display;
|
long RavenId = util.IdFromResponse(rMainObject);
|
||||||
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());
|
d = rMainObject.ObjectResponse["data"];
|
||||||
long RavenId = util.IdFromResponse(rMainObject);
|
|
||||||
|
|
||||||
//-----
|
|
||||||
|
|
||||||
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
|
#endregion Memos
|
||||||
|
|
||||||
@@ -2851,9 +2857,9 @@ namespace AyaNova.PlugIn.V8
|
|||||||
else
|
else
|
||||||
RavenTypeAsString = ((int)util.RootObjectToAyaType(tid.RootObjectType)).ToString();
|
RavenTypeAsString = ((int)util.RootObjectToAyaType(tid.RootObjectType)).ToString();
|
||||||
formDataContent.Add(new StringContent(RavenTypeAsString), name: "AttachToObjectType");
|
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 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(ImportTag), name: "Notes");
|
||||||
formDataContent.Add(new StringContent(dFileData.ToString()), name: "FileData");
|
formDataContent.Add(new StringContent(dFileData.ToString()), name: "FileData");
|
||||||
|
|
||||||
@@ -2949,10 +2955,10 @@ namespace AyaNova.PlugIn.V8
|
|||||||
else
|
else
|
||||||
RavenTypeAsString = ((int)util.RootObjectToAyaType(tid.RootObjectType)).ToString();
|
RavenTypeAsString = ((int)util.RootObjectToAyaType(tid.RootObjectType)).ToString();
|
||||||
formDataContent.Add(new StringContent(RavenTypeAsString), name: "AttachToObjectType");
|
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(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(doc.Description + " (" + ImportTag + ")"), name: "Notes");
|
||||||
formDataContent.Add(new StringContent(dFileData.ToString()), name: "FileData");
|
formDataContent.Add(new StringContent(dFileData.ToString()), name: "FileData");
|
||||||
@@ -2996,7 +3002,7 @@ namespace AyaNova.PlugIn.V8
|
|||||||
MatchCollection mc = AyaBizUtils.rxAyaImageTags.Matches(content);
|
MatchCollection mc = AyaBizUtils.rxAyaImageTags.Matches(content);
|
||||||
foreach (Match m in mc)
|
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() + "]" + "\">");
|
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\ClientExistanceChecker.cs" />
|
||||||
<Compile Include="GZTW.AyaNova.BLL\ClientNoteEr.cs" />
|
<Compile Include="GZTW.AyaNova.BLL\ClientNoteEr.cs" />
|
||||||
<Compile Include="GZTW.AyaNova.BLL\ClientNoteList.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\ClientPopUpNotesFetcher.cs" />
|
||||||
<Compile Include="GZTW.AyaNova.BLL\ClientServiceRequestListRI.cs" />
|
<Compile Include="GZTW.AyaNova.BLL\ClientServiceRequestListRI.cs" />
|
||||||
<Compile Include="GZTW.AyaNova.BLL\ClientServiceRequestNameFetcher.cs" />
|
<Compile Include="GZTW.AyaNova.BLL\ClientServiceRequestNameFetcher.cs" />
|
||||||
@@ -269,7 +272,6 @@
|
|||||||
<Compile Include="GZTW.AyaNova.BLL\ClientWorkorderList.cs" />
|
<Compile Include="GZTW.AyaNova.BLL\ClientWorkorderList.cs" />
|
||||||
<Compile Include="GZTW.AyaNova.BLL\AyaFile.cs" />
|
<Compile Include="GZTW.AyaNova.BLL\AyaFile.cs" />
|
||||||
<Compile Include="GZTW.AyaNova.BLL\ClientNotifyEvent.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\AddressFieldPickList.cs" />
|
||||||
<Compile Include="GZTW.AyaNova.BLL\ClientWorkorderListEx.cs" />
|
<Compile Include="GZTW.AyaNova.BLL\ClientWorkorderListEx.cs" />
|
||||||
<Compile Include="GZTW.AyaNova.BLL\ClientNotesReportList.cs" />
|
<Compile Include="GZTW.AyaNova.BLL\ClientNotesReportList.cs" />
|
||||||
@@ -318,6 +320,7 @@
|
|||||||
<Compile Include="GZTW.AyaNova.BLL\UnitMeterReadingListRI.cs" />
|
<Compile Include="GZTW.AyaNova.BLL\UnitMeterReadingListRI.cs" />
|
||||||
<Compile Include="GZTW.AyaNova.BLL\UnitOfMeasurePickList.cs" />
|
<Compile Include="GZTW.AyaNova.BLL\UnitOfMeasurePickList.cs" />
|
||||||
<Compile Include="GZTW.AyaNova.BLL\UnitServiceTypePickList.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\UserTypeFetcher.cs" />
|
||||||
<Compile Include="GZTW.AyaNova.BLL\UserTimeZoneOffsetFetcher.cs" />
|
<Compile Include="GZTW.AyaNova.BLL\UserTimeZoneOffsetFetcher.cs" />
|
||||||
<Compile Include="GZTW.AyaNova.BLL\WikiPageExistanceChecker.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
|
#pragma warning disable 1591
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Lightweight read only list of <see cref="MemoList.MemoListInfo"/> objects representing <see cref="Memo"/> object
|
/// Lightweight read only list of <see cref="MemoList.MemoListInfo"/> objects representing <see cref="Memo"/> object
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public class MemoList : ReadOnlyCollectionBase
|
public class MemoList : ReadOnlyCollectionBase
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
#region Data structure
|
#region Data structure
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Properties
|
/// Properties
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public struct MemoListInfo
|
public struct MemoListInfo
|
||||||
{
|
{
|
||||||
internal Guid mID;
|
internal Guid mID;
|
||||||
internal SmartDate mCreated;
|
internal SmartDate mCreated;
|
||||||
internal GridRelativeTimeCellItem mCreatedRelative;
|
internal GridRelativeTimeCellItem mCreatedRelative;
|
||||||
internal GridNameValueCellItem mSubject;
|
internal GridNameValueCellItem mSubject;
|
||||||
internal string mMessage;
|
internal string mMessage;
|
||||||
internal GridNameValueCellItem mFrom;
|
internal GridNameValueCellItem mFrom;
|
||||||
//internal Guid mFrom;
|
//internal Guid mFrom;
|
||||||
internal bool mViewed;
|
internal bool mViewed;
|
||||||
internal bool mReplied;
|
internal bool mReplied;
|
||||||
|
|
||||||
//ID Not localized as it's an invisible field
|
//ID Not localized as it's an invisible field
|
||||||
[Display(DisplayType.Hidden)]
|
[Display(DisplayType.Hidden)]
|
||||||
public Guid ID
|
public Guid ID
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return mID;
|
return mID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[SqlColumnNameAttribute("aMemo.aCreated"), Display(DisplayType.DateTime)]
|
[SqlColumnNameAttribute("aMemo.aCreated"),Display(DisplayType.DateTime)]
|
||||||
public object LT_Memo_Label_Sent
|
public object LT_Memo_Label_Sent
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return mCreated.DBValue;
|
return mCreated.DBValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[SqlColumnNameAttribute("grid"), Display(DisplayType.Text)]
|
[SqlColumnNameAttribute("grid"), Display(DisplayType.Text)]
|
||||||
public GridRelativeTimeCellItem LT_Memo_Label_Sent_Relative
|
public GridRelativeTimeCellItem LT_Memo_Label_Sent_Relative
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return mCreatedRelative;
|
return mCreatedRelative;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[SqlColumnNameAttribute("aUser.aLastName",
|
[SqlColumnNameAttribute("aUser.aLastName",
|
||||||
"aMemo.aFromID"),
|
"aMemo.aFromID"),
|
||||||
Display(DisplayType.Button, RootObjectType = RootObjectTypes.Client)]
|
Display(DisplayType.Button, RootObjectType = RootObjectTypes.Client)]
|
||||||
public GridNameValueCellItem LT_Memo_Label_FromID
|
public GridNameValueCellItem LT_Memo_Label_FromID
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return mFrom;
|
return mFrom;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[SqlColumnNameAttribute("aMemo.aSubject", "aMemo.aID"), Display(DisplayType.Button, RootObjectType = RootObjectTypes.Memo)]
|
[SqlColumnNameAttribute("aMemo.aSubject", "aMemo.aID"), Display(DisplayType.Button, RootObjectType = RootObjectTypes.Memo)]
|
||||||
public GridNameValueCellItem LT_Memo_Label_Subject
|
public GridNameValueCellItem LT_Memo_Label_Subject
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return mSubject;
|
return mSubject;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Display(DisplayType.Hidden)]
|
[Display(DisplayType.Hidden)]
|
||||||
public string LT_Memo_Label_Message
|
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
|
[SqlColumnNameAttribute("aMemo.aViewed"), Display(DisplayType.Hidden)]//case 1805 added column name attribute so can set criteria for dashboard
|
||||||
public bool LT_Memo_Label_Viewed
|
public bool LT_Memo_Label_Viewed
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return mViewed;
|
return mViewed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Special control, i.e. in this case image checkbox showing replied graphic or not replied graphic
|
//Special control, i.e. in this case image checkbox showing replied graphic or not replied graphic
|
||||||
[Display(DisplayType.SpecialControl)]
|
[Display(DisplayType.SpecialControl)]
|
||||||
public bool LT_Memo_Label_Replied
|
public bool LT_Memo_Label_Replied
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return this.mReplied;
|
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>
|
get
|
||||||
///
|
{
|
||||||
/// </summary>
|
foreach (MemoListInfo child in List)
|
||||||
/// <param name="obj"></param>
|
{
|
||||||
public bool Equals(MemoListInfo obj)
|
if(child.ID==ItemID) return child.ToString();
|
||||||
{
|
}
|
||||||
return this.ID.Equals(obj.ID);
|
return "Missing: "+ItemID.ToString();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
}//end MemoListInfo
|
#region contains
|
||||||
#endregion
|
/// <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;
|
#endregion
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
#region Reporting and shared UI editor helpers
|
#region Reporting and shared UI editor helpers
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the report key which is a property of
|
/// Returns the report key which is a property of
|
||||||
/// reports used to link all reports that can be used
|
/// reports used to link all reports that can be used
|
||||||
/// with a particular data source.
|
/// with a particular data source.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string ReportKey
|
public static string ReportKey
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return "MemoList";
|
return "MemoList";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the Detailed report key
|
/// Returns the Detailed report key
|
||||||
@@ -298,9 +298,9 @@ namespace GZTW.AyaNova.BLL
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Static methods
|
#region Static methods
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Internal method used by list factory
|
/// Internal method used by list factory
|
||||||
@@ -310,16 +310,16 @@ namespace GZTW.AyaNova.BLL
|
|||||||
return (MemoList)DataPortal.Fetch(new Criteria(Filter, IDList, MaxRecords));
|
return (MemoList)DataPortal.Fetch(new Criteria(Filter, IDList, MaxRecords));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get all Memo (filtered by crit)
|
/// Get all Memo (filtered by crit)
|
||||||
/// </summary>
|
/// </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>
|
/// <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>
|
/// <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));
|
return (MemoList)DataPortal.Fetch(new Criteria(xmlCriteria, null, -1));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Takes a single ID and returns a "list" of one object
|
/// 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));
|
return (MemoList)DataPortal.Fetch(new Criteria("", IDList, -1));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Return an empty list
|
/// Return an empty list
|
||||||
/// used for initializing grid
|
/// used for initializing grid
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static MemoList GetEmptyList()
|
public static MemoList GetEmptyList()
|
||||||
{
|
{
|
||||||
return new MemoList();
|
return new MemoList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region DAL DATA ACCESS
|
#region DAL DATA ACCESS
|
||||||
///
|
///
|
||||||
/// <param name="Criteria"></param>
|
/// <param name="Criteria"></param>
|
||||||
protected override void DataPortal_Fetch(object Criteria)
|
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;
|
DateTime dtNow = DBUtil.CurrentWorkingDateTime;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
if (crit.IDList != null)
|
if (crit.IDList != null)
|
||||||
{
|
{
|
||||||
//v8 Migrate related change
|
//Case 556
|
||||||
//this is a workaround to get all the memos even though the current user is not the recipient of all of them
|
System.Text.StringBuilder sbIN = new System.Text.StringBuilder();
|
||||||
if (crit.IDList.Count == 1 && crit.IDList[0] == new Guid("{BD608E8A-820C-46D1-9D81-4CCB6E71B213}"))//v8 migrate plugin id
|
sbIN.Append(" WHERE (aMemo.aID in (");
|
||||||
|
foreach (Guid gItem in crit.IDList)
|
||||||
{
|
{
|
||||||
dr = DBUtil.GetReaderFromSQLString(
|
sbIN.Append("'");
|
||||||
"SELECT aMemo.aID, aMemo.aCreated, " +
|
sbIN.Append("{");
|
||||||
"aMemo.aViewed, aMemo.aReplied, aMemo.aSubject, aMemo.aMessage, " +
|
sbIN.Append(gItem.ToString().ToUpperInvariant());
|
||||||
"aMemo.aFromID, aMemo.aToId, " +
|
sbIN.Append("}");
|
||||||
"'first' as afirstname, 'last' as alastname, 'ii' as ainitials, 'en' as aemployeenumber, 'r' as aregionname " +
|
sbIN.Append("',");
|
||||||
"FROM aMemo order by amemo.acreated");
|
|
||||||
}
|
}
|
||||||
else
|
sbIN.Length = sbIN.Length - 1;
|
||||||
{
|
sbIN.Append(")) ");
|
||||||
//Case 556
|
|
||||||
System.Text.StringBuilder sbIN = new System.Text.StringBuilder();
|
//************************************************************
|
||||||
sbIN.Append(" WHERE (aMemo.aID in (");
|
dr = DBUtil.GetReaderFromSQLString(
|
||||||
foreach (Guid gItem in crit.IDList)
|
"SELECT aMemo.aID, aMemo.aCreated, " +
|
||||||
{
|
"aMemo.aViewed, aMemo.aReplied, aMemo.aSubject, aMemo.aMessage, " +
|
||||||
sbIN.Append("'");
|
"aMemo.aFromID, aUser.aFirstName, aUser.aLastName, aUser.aInitials, AREGION.ANAME AS AREGIONNAME, " +
|
||||||
sbIN.Append("{");
|
"aUser.aEmployeeNumber FROM aMemo " +
|
||||||
sbIN.Append(gItem.ToString().ToUpperInvariant());
|
|
||||||
sbIN.Append("}");
|
" LEFT OUTER JOIN aUser ON aMemo.aFromID = aUser.aID " +
|
||||||
sbIN.Append("',");
|
" LEFT OUTER JOIN AREGION ON (AUSER.AREGIONID=AREGION.AID) " +
|
||||||
}
|
sbIN.ToString() + " " +
|
||||||
sbIN.Length = sbIN.Length - 1;
|
AyaBizUtils.GetGridSortOrderColumns(crit.CriteriaXML));
|
||||||
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
|
else
|
||||||
{
|
{
|
||||||
@@ -426,7 +413,7 @@ namespace GZTW.AyaNova.BLL
|
|||||||
"aMemo.aViewed, aMemo.aReplied, aMemo.aSubject, aMemo.aMessage, " +
|
"aMemo.aViewed, aMemo.aReplied, aMemo.aSubject, aMemo.aMessage, " +
|
||||||
"aMemo.aFromID, aUser.aFirstName, aUser.aLastName, aUser.aInitials, AREGION.ANAME AS AREGIONNAME, " +
|
"aMemo.aFromID, aUser.aFirstName, aUser.aLastName, aUser.aInitials, AREGION.ANAME AS AREGIONNAME, " +
|
||||||
"aUser.aEmployeeNumber FROM aMemo " +
|
"aUser.aEmployeeNumber FROM aMemo " +
|
||||||
|
|
||||||
" LEFT OUTER JOIN aUser ON aMemo.aFromID = aUser.aID " +
|
" LEFT OUTER JOIN aUser ON aMemo.aFromID = aUser.aID " +
|
||||||
" LEFT OUTER JOIN AREGION ON (AUSER.AREGIONID=AREGION.AID) " +
|
" LEFT OUTER JOIN AREGION ON (AUSER.AREGIONID=AREGION.AID) " +
|
||||||
"WHERE (aMemo.aToID = @ID) " +
|
"WHERE (aMemo.aToID = @ID) " +
|
||||||
@@ -441,45 +428,45 @@ namespace GZTW.AyaNova.BLL
|
|||||||
|
|
||||||
dr = DBUtil.GetReaderFromSQLString(q, CurrentUserID);
|
dr = DBUtil.GetReaderFromSQLString(q, CurrentUserID);
|
||||||
}
|
}
|
||||||
while (dr.Read())
|
while(dr.Read())
|
||||||
{
|
{
|
||||||
//*******************************************
|
//*******************************************
|
||||||
MemoListInfo info = new MemoListInfo();
|
MemoListInfo info=new MemoListInfo();
|
||||||
|
|
||||||
info.mID = dr.GetGuid("aID");
|
info.mID=dr.GetGuid("aID");
|
||||||
|
|
||||||
info.mCreated = DBUtil.ToLocal(dr.GetSmartDate("aCreated"));
|
info.mCreated=DBUtil.ToLocal(dr.GetSmartDate("aCreated"));
|
||||||
info.mCreatedRelative = new GridRelativeTimeCellItem(rtfm.Format(dtNow, info.mCreated));
|
info.mCreatedRelative = new GridRelativeTimeCellItem(rtfm.Format(dtNow,info.mCreated));
|
||||||
info.mFrom = new GridNameValueCellItem(
|
info.mFrom=new GridNameValueCellItem(
|
||||||
dr.GetGuid("aFromID"),
|
dr.GetGuid("aFromID"),
|
||||||
User.NameFormatter(dr.GetString("aFirstName"), dr.GetString("aLastName"), dr.GetString("aInitials"),
|
User.NameFormatter(dr.GetString("aFirstName"),dr.GetString("aLastName"),dr.GetString("aInitials"),
|
||||||
dr.GetString("aEmployeeNumber"), dr.GetString("AREGIONNAME"), AyaBizUtils.GlobalSettings.DefaultScheduleableUserNameDisplayFormat)
|
dr.GetString("aEmployeeNumber"), dr.GetString("AREGIONNAME"), AyaBizUtils.GlobalSettings.DefaultScheduleableUserNameDisplayFormat)
|
||||||
, RootObjectTypes.User);
|
,RootObjectTypes.User);
|
||||||
|
|
||||||
info.mSubject = new GridNameValueCellItem(
|
info.mSubject = new GridNameValueCellItem(
|
||||||
dr.GetGuid("aID"),
|
dr.GetGuid("aID"),
|
||||||
dr.GetString("aSubject"),
|
dr.GetString("aSubject"),
|
||||||
RootObjectTypes.Memo);
|
RootObjectTypes.Memo);
|
||||||
|
|
||||||
|
|
||||||
info.mViewed = dr.GetBoolean("aViewed");
|
info.mViewed=dr.GetBoolean("aViewed");
|
||||||
info.mReplied = dr.GetBoolean("aReplied");
|
info.mReplied=dr.GetBoolean("aReplied");
|
||||||
info.mMessage = dr.GetString("aMessage");
|
info.mMessage = dr.GetString("aMessage");
|
||||||
|
|
||||||
|
InnerList.Add(info);
|
||||||
|
//*******************************************
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if(dr!=null) dr.Close();
|
||||||
|
}
|
||||||
|
|
||||||
InnerList.Add(info);
|
|
||||||
//*******************************************
|
}
|
||||||
}
|
#endregion
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
if (dr != null) dr.Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
#region criteria
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region criteria
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Criteria for identifying existing object
|
/// Criteria for identifying existing object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -496,8 +483,8 @@ namespace GZTW.AyaNova.BLL
|
|||||||
MaxRecords = _MaxRecords;
|
MaxRecords = _MaxRecords;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
}//end MemoList
|
}//end MemoList
|
||||||
#pragma warning restore 1591
|
#pragma warning restore 1591
|
||||||
}//end namespace GZTW.AyaNova.BLL
|
}//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