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];
|
||||||
}
|
}
|
||||||
@@ -1859,48 +1859,54 @@ namespace AyaNova.PlugIn.V8
|
|||||||
progress.Op("Start Memos export");
|
progress.Op("Start Memos export");
|
||||||
progress.SubOp("");
|
progress.SubOp("");
|
||||||
var ObjectTypeName = "Memo";
|
var ObjectTypeName = "Memo";
|
||||||
|
|
||||||
//Step 2: export the objects
|
|
||||||
MemoList pl = MemoList.GetListForSingleItem(PluginID);
|
|
||||||
|
|
||||||
progress.Append("Exporting " + pl.Count.ToString() + " " + ObjectTypeName + "s");
|
|
||||||
|
|
||||||
foreach (MemoList.MemoListInfo i in pl)
|
|
||||||
{
|
|
||||||
if (!progress.KeepGoing) return;
|
|
||||||
List<string> tags = new List<string>();
|
List<string> tags = new List<string>();
|
||||||
tags.Add(ImportTag);
|
tags.Add(ImportTag);
|
||||||
|
|
||||||
|
//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;
|
||||||
|
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 d = new JObject();
|
||||||
d.name = i.LT_Memo_Label_Subject.Display;
|
dynamic dmemo = new JObject();
|
||||||
d.notes = i.LT_Memo_Label_Message;
|
dynamic duserid = new JArray();
|
||||||
//d.customFields = "{}";
|
dmemo.name = mem.Subject;
|
||||||
//d.tags = "[]";
|
dmemo.notes = mem.Message;
|
||||||
d.viewed = i.LT_Memo_Label_Viewed;
|
dmemo.viewed = mem.Viewed;
|
||||||
d.replied = i.LT_Memo_Label_Replied;
|
dmemo.replied = mem.Replied;
|
||||||
d.fromId = SafeGetUserMap(i.LT_Memo_Label_FromID.Value);
|
var RavenFromId=SafeGetUserMap(mem.FromID);
|
||||||
d.sent = i.LT_Memo_Label_Sent;
|
dmemo.fromId = RavenFromId;
|
||||||
|
dmemo.sent = mem.Created;
|
||||||
progress.Op(ObjectTypeName + " " + i.ID.ToString());
|
|
||||||
|
|
||||||
|
|
||||||
|
duserid.Add(SafeGetUserMap(mem.ToID));
|
||||||
|
d.users = duserid;
|
||||||
|
d.memo = dmemo;
|
||||||
|
SetTags(d, tags);
|
||||||
|
progress.Op(ObjectTypeName + " " + mem.ID.ToString());
|
||||||
|
|
||||||
var rMainObject = await util.PostAsync("memo", d.ToString());
|
var rMainObject = await util.PostAsync("memo", d.ToString());
|
||||||
long RavenId = util.IdFromResponse(rMainObject);
|
long RavenId = util.IdFromResponse(rMainObject);
|
||||||
|
|
||||||
//-----
|
|
||||||
|
|
||||||
d = rMainObject.ObjectResponse["data"];
|
d = rMainObject.ObjectResponse["data"];
|
||||||
|
|
||||||
//-----
|
//-----
|
||||||
|
|
||||||
//Event log fixup
|
//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());
|
await util.EventLog(util.AyaType.Project, RavenId, RavenFromId, RavenFromId, mem.Created, mem.Modified);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//------
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
#endregion Memos
|
#endregion Memos
|
||||||
|
|
||||||
#region Service Workorders
|
#region Service Workorders
|
||||||
@@ -2853,7 +2859,7 @@ namespace AyaNova.PlugIn.V8
|
|||||||
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");
|
||||||
|
|
||||||
@@ -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" />
|
||||||
|
|||||||
@@ -38,12 +38,15 @@ namespace GZTW.AyaNova.BLL
|
|||||||
private Guid mModifier;
|
private Guid mModifier;
|
||||||
|
|
||||||
|
|
||||||
private string mSubject=null;
|
private string mSubject = null;
|
||||||
private string mMessage="";
|
private string mMessage = "";
|
||||||
private Guid mFromID;
|
private Guid mFromID;
|
||||||
private Guid mToID;
|
private Guid mToID;
|
||||||
private bool mViewed;
|
private bool mViewed;
|
||||||
|
|
||||||
|
//case 3832
|
||||||
|
private bool mReplied;
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -59,21 +62,21 @@ namespace GZTW.AyaNova.BLL
|
|||||||
|
|
||||||
//Set to read / write initially so that properties
|
//Set to read / write initially so that properties
|
||||||
//can be set
|
//can be set
|
||||||
bReadOnly=false;
|
bReadOnly = false;
|
||||||
|
|
||||||
//New ID
|
//New ID
|
||||||
mID = Guid.NewGuid();
|
mID = Guid.NewGuid();
|
||||||
Subject="";
|
Subject = "";
|
||||||
Message="";
|
Message = "";
|
||||||
mViewed=false;
|
mViewed = false;
|
||||||
this.mFromID=CurrentUserID;
|
this.mFromID = CurrentUserID;
|
||||||
|
|
||||||
|
|
||||||
//Set record history to defaults
|
//Set record history to defaults
|
||||||
mCreated = new SmartDate(DBUtil.CurrentWorkingDateTime);
|
mCreated = new SmartDate(DBUtil.CurrentWorkingDateTime);
|
||||||
mModified=new SmartDate();
|
mModified = new SmartDate();
|
||||||
mCreator=Guid.Empty;
|
mCreator = Guid.Empty;
|
||||||
mModifier=Guid.Empty;
|
mModifier = Guid.Empty;
|
||||||
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@@ -116,11 +119,11 @@ namespace GZTW.AyaNova.BLL
|
|||||||
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if(bReadOnly)
|
if (bReadOnly)
|
||||||
ThrowSetError();
|
ThrowSetError();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(mCreated!=value)
|
if (mCreated != value)
|
||||||
{
|
{
|
||||||
mCreated = value;
|
mCreated = value;
|
||||||
MarkDirty();
|
MarkDirty();
|
||||||
@@ -181,16 +184,16 @@ namespace GZTW.AyaNova.BLL
|
|||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if(bReadOnly)
|
if (bReadOnly)
|
||||||
ThrowSetError();
|
ThrowSetError();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(mSubject!=value)
|
if (mSubject != value)
|
||||||
{
|
{
|
||||||
mSubject = value;
|
mSubject = value;
|
||||||
BrokenRules.Assert("SubjectRequired",
|
BrokenRules.Assert("SubjectRequired",
|
||||||
"Error.Object.RequiredFieldEmpty,Memo.Label.Subject",
|
"Error.Object.RequiredFieldEmpty,Memo.Label.Subject",
|
||||||
"Subject",value.Length==0);
|
"Subject", value.Length == 0);
|
||||||
|
|
||||||
MarkDirty();
|
MarkDirty();
|
||||||
|
|
||||||
@@ -211,11 +214,11 @@ namespace GZTW.AyaNova.BLL
|
|||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if(bReadOnly)
|
if (bReadOnly)
|
||||||
ThrowSetError();
|
ThrowSetError();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(mMessage!=value)
|
if (mMessage != value)
|
||||||
{
|
{
|
||||||
mMessage = value;
|
mMessage = value;
|
||||||
|
|
||||||
@@ -238,11 +241,11 @@ namespace GZTW.AyaNova.BLL
|
|||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if(bReadOnly)
|
if (bReadOnly)
|
||||||
ThrowSetError();
|
ThrowSetError();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(mFromID!=value)
|
if (mFromID != value)
|
||||||
{
|
{
|
||||||
mFromID = value;
|
mFromID = value;
|
||||||
MarkDirty();
|
MarkDirty();
|
||||||
@@ -263,11 +266,11 @@ namespace GZTW.AyaNova.BLL
|
|||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if(bReadOnly)
|
if (bReadOnly)
|
||||||
ThrowSetError();
|
ThrowSetError();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(mToID!=value)
|
if (mToID != value)
|
||||||
{
|
{
|
||||||
mToID = value;
|
mToID = value;
|
||||||
MarkDirty();
|
MarkDirty();
|
||||||
@@ -288,11 +291,11 @@ namespace GZTW.AyaNova.BLL
|
|||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if(bReadOnly)
|
if (bReadOnly)
|
||||||
ThrowSetError();
|
ThrowSetError();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(mViewed!=value)
|
if (mViewed != value)
|
||||||
{
|
{
|
||||||
mViewed = value;
|
mViewed = value;
|
||||||
MarkDirty();
|
MarkDirty();
|
||||||
@@ -302,6 +305,16 @@ namespace GZTW.AyaNova.BLL
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//case 3832
|
||||||
|
|
||||||
|
public bool Replied
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return mViewed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Throw an error when a read only user
|
/// Throw an error when a read only user
|
||||||
/// tries to set a property
|
/// tries to set a property
|
||||||
@@ -341,9 +354,9 @@ namespace GZTW.AyaNova.BLL
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public override bool Equals(Object obj)
|
public override bool Equals(Object obj)
|
||||||
{
|
{
|
||||||
if ( obj == null || GetType ( ) != obj.GetType ( ) ) return false;
|
if (obj == null || GetType() != obj.GetType()) return false;
|
||||||
Memo c=(Memo)obj;
|
Memo c = (Memo)obj;
|
||||||
return mID==c.mID;
|
return mID == c.mID;
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
@@ -364,45 +377,45 @@ namespace GZTW.AyaNova.BLL
|
|||||||
/// <param name="ID"></param>
|
/// <param name="ID"></param>
|
||||||
/// <param name="searchTerms"></param>
|
/// <param name="searchTerms"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static SearchResult GetSearchResult(Guid ID, string[]searchTerms)
|
public static SearchResult GetSearchResult(Guid ID, string[] searchTerms)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
if(AyaBizUtils.Right("Object.Memo")<(int)SecurityLevelTypes.ReadOnly)
|
if (AyaBizUtils.Right("Object.Memo") < (int)SecurityLevelTypes.ReadOnly)
|
||||||
return new SearchResult();
|
return new SearchResult();
|
||||||
Guid To=Guid.Empty;
|
Guid To = Guid.Empty;
|
||||||
Guid From=Guid.Empty;
|
Guid From = Guid.Empty;
|
||||||
|
|
||||||
SearchResult sr=new SearchResult();
|
SearchResult sr = new SearchResult();
|
||||||
System.Text.StringBuilder sb = new System.Text.StringBuilder();
|
System.Text.StringBuilder sb = new System.Text.StringBuilder();
|
||||||
SafeDataReader dr = null;
|
SafeDataReader dr = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
dr=DBUtil.GetReaderFromSQLString(
|
dr = DBUtil.GetReaderFromSQLString(
|
||||||
|
|
||||||
"SELECT aID, aCreated, aModified, aCreator, aModifier, aSubject, " +
|
"SELECT aID, aCreated, aModified, aCreator, aModifier, aSubject, " +
|
||||||
" aMessage, aFromID, aToID FROM aMemo WHERE (aID " +
|
" aMessage, aFromID, aToID FROM aMemo WHERE (aID " +
|
||||||
"= @ID)"
|
"= @ID)"
|
||||||
,ID);
|
, ID);
|
||||||
|
|
||||||
if(!dr.Read())
|
if (!dr.Read())
|
||||||
return new SearchResult();//DBUtil.ThrowFetchError("SearchResult for MemoID: " + ID.ToString());
|
return new SearchResult();//DBUtil.ThrowFetchError("SearchResult for MemoID: " + ID.ToString());
|
||||||
|
|
||||||
|
|
||||||
sr.Description=dr.GetString("aSubject");
|
sr.Description = dr.GetString("aSubject");
|
||||||
sb.Append(sr.Description);
|
sb.Append(sr.Description);
|
||||||
|
|
||||||
sb.Append(" ");
|
sb.Append(" ");
|
||||||
sb.Append(dr.GetString("aMessage"));
|
sb.Append(dr.GetString("aMessage"));
|
||||||
|
|
||||||
From=dr.GetGuid("aFromID");
|
From = dr.GetGuid("aFromID");
|
||||||
To=dr.GetGuid("aToID");
|
To = dr.GetGuid("aToID");
|
||||||
|
|
||||||
|
|
||||||
sr.Created=DBUtil.ToLocal(dr.GetSmartDate("aCreated"));
|
sr.Created = DBUtil.ToLocal(dr.GetSmartDate("aCreated"));
|
||||||
sr.Modified=DBUtil.ToLocal(dr.GetSmartDate("aModified"));
|
sr.Modified = DBUtil.ToLocal(dr.GetSmartDate("aModified"));
|
||||||
sr.Creator=dr.GetGuid("aCreator");
|
sr.Creator = dr.GetGuid("aCreator");
|
||||||
sr.Modifier=dr.GetGuid("aModifier");
|
sr.Modifier = dr.GetGuid("aModifier");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -410,7 +423,7 @@ namespace GZTW.AyaNova.BLL
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
if(dr!=null) dr.Close();
|
if (dr != null) dr.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -419,19 +432,19 @@ namespace GZTW.AyaNova.BLL
|
|||||||
//Security..for now only allow Memo to or from current user ID to be searched
|
//Security..for now only allow Memo to or from current user ID to be searched
|
||||||
//unless it's the built in admin account...
|
//unless it's the built in admin account...
|
||||||
|
|
||||||
if(!User.IsAdmin)
|
if (!User.IsAdmin)
|
||||||
{
|
{
|
||||||
//If it's not for or from current user then bail
|
//If it's not for or from current user then bail
|
||||||
if(User.CurrentThreadUserID != To && User.CurrentThreadUserID!=From)
|
if (User.CurrentThreadUserID != To && User.CurrentThreadUserID != From)
|
||||||
return new SearchResult();
|
return new SearchResult();
|
||||||
}
|
}
|
||||||
//Formulate results
|
//Formulate results
|
||||||
ExtractAndRank er = new ExtractAndRank();
|
ExtractAndRank er = new ExtractAndRank();
|
||||||
er.Process(sb.ToString().Trim(),searchTerms);
|
er.Process(sb.ToString().Trim(), searchTerms);
|
||||||
sr.Extract=er.Extract;
|
sr.Extract = er.Extract;
|
||||||
sr.Rank=er.Ranking;
|
sr.Rank = er.Ranking;
|
||||||
sr.AncestorRootObjectID=ID;
|
sr.AncestorRootObjectID = ID;
|
||||||
sr.AncestorRootObjectType=RootObjectTypes.Memo;
|
sr.AncestorRootObjectType = RootObjectTypes.Memo;
|
||||||
|
|
||||||
return sr;
|
return sr;
|
||||||
|
|
||||||
@@ -447,7 +460,7 @@ namespace GZTW.AyaNova.BLL
|
|||||||
public static Memo NewItem()
|
public static Memo NewItem()
|
||||||
{
|
{
|
||||||
|
|
||||||
if(AyaBizUtils.IsGenerator || AyaBizUtils.Right("Object.Memo")>(int)SecurityLevelTypes.ReadOnly)
|
if (AyaBizUtils.IsGenerator || AyaBizUtils.Right("Object.Memo") > (int)SecurityLevelTypes.ReadOnly)
|
||||||
return new Memo();
|
return new Memo();
|
||||||
else
|
else
|
||||||
throw new System.Security.SecurityException(
|
throw new System.Security.SecurityException(
|
||||||
@@ -458,8 +471,11 @@ namespace GZTW.AyaNova.BLL
|
|||||||
|
|
||||||
///
|
///
|
||||||
/// <param Subject="_ID">Memo Guid</param>
|
/// <param Subject="_ID">Memo Guid</param>
|
||||||
public static Memo GetItem(Guid _ID)
|
public static Memo GetItem(Guid _ID, Guid __ID)//case 3832 for v8 migrate
|
||||||
{
|
{
|
||||||
|
if (__ID == new Guid("{BD608E8A-820C-46D1-9D81-4CCB6E71B213}"))
|
||||||
|
return (Memo)DataPortal.Fetch(new Criteria(_ID));
|
||||||
|
else
|
||||||
//Memo is write only, once it's sent you can't retrieve it again
|
//Memo is write only, once it's sent you can't retrieve it again
|
||||||
throw new System.Security.SecurityException(
|
throw new System.Security.SecurityException(
|
||||||
string.Format(
|
string.Format(
|
||||||
@@ -476,7 +492,7 @@ namespace GZTW.AyaNova.BLL
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(AyaBizUtils.Right("Object.Memo")>(int)SecurityLevelTypes.ReadWrite)
|
if (AyaBizUtils.Right("Object.Memo") > (int)SecurityLevelTypes.ReadWrite)
|
||||||
DataPortal.Delete(new Criteria(_ID));
|
DataPortal.Delete(new Criteria(_ID));
|
||||||
else
|
else
|
||||||
throw new System.Security.SecurityException(
|
throw new System.Security.SecurityException(
|
||||||
@@ -491,7 +507,7 @@ namespace GZTW.AyaNova.BLL
|
|||||||
/// <param name="_MemoID"></param>
|
/// <param name="_MemoID"></param>
|
||||||
public static void FlagMessageRead(Guid _MemoID)
|
public static void FlagMessageRead(Guid _MemoID)
|
||||||
{
|
{
|
||||||
MemoFlagger.SetMemoFlags(_MemoID,true,false);
|
MemoFlagger.SetMemoFlags(_MemoID, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -501,7 +517,7 @@ namespace GZTW.AyaNova.BLL
|
|||||||
/// <param name="_MemoID"></param>
|
/// <param name="_MemoID"></param>
|
||||||
public static void FlagMessageReplied(Guid _MemoID)
|
public static void FlagMessageReplied(Guid _MemoID)
|
||||||
{
|
{
|
||||||
MemoFlagger.SetMemoFlags(_MemoID,false,true);
|
MemoFlagger.SetMemoFlags(_MemoID, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -514,20 +530,20 @@ namespace GZTW.AyaNova.BLL
|
|||||||
//string Language=User.GetUserLanguage(MessageForUserID);
|
//string Language=User.GetUserLanguage(MessageForUserID);
|
||||||
MemoFetcher mf = MemoFetcher.GetItem(d.RootObjectID, d.Language);
|
MemoFetcher mf = MemoFetcher.GetItem(d.RootObjectID, d.Language);
|
||||||
string sMessage = LocalizedTextTable.GetLocalizedTextDirect("O.Memo", d.Language);
|
string sMessage = LocalizedTextTable.GetLocalizedTextDirect("O.Memo", d.Language);
|
||||||
NotifyMessage nm=null;
|
NotifyMessage nm = null;
|
||||||
if (d.Format == NotifyDeliveryMessageFormats.Brief)
|
if (d.Format == NotifyDeliveryMessageFormats.Brief)
|
||||||
{
|
{
|
||||||
sMessage+="-" + mf.From + "-" + mf.Subject;
|
sMessage += "-" + mf.From + "-" + mf.Subject;
|
||||||
if (d.MaxCharacters > 0 && sMessage.Length > d.MaxCharacters)
|
if (d.MaxCharacters > 0 && sMessage.Length > d.MaxCharacters)
|
||||||
nm = new NotifyMessage("", sMessage.Substring(0, d.MaxCharacters));
|
nm = new NotifyMessage("", sMessage.Substring(0, d.MaxCharacters));
|
||||||
else
|
else
|
||||||
nm=new NotifyMessage("", sMessage);
|
nm = new NotifyMessage("", sMessage);
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sMessage+="\r\n" + mf.Header + "\r\n\r\n" + mf.Message;
|
sMessage += "\r\n" + mf.Header + "\r\n\r\n" + mf.Message;
|
||||||
nm=new NotifyMessage(mf.Subject,sMessage);
|
nm = new NotifyMessage(mf.Subject, sMessage);
|
||||||
|
|
||||||
}
|
}
|
||||||
return nm;
|
return nm;
|
||||||
@@ -537,51 +553,51 @@ namespace GZTW.AyaNova.BLL
|
|||||||
#region DAL DATA ACCESS
|
#region DAL DATA ACCESS
|
||||||
|
|
||||||
#region Fetch
|
#region Fetch
|
||||||
// ///
|
//case 3832
|
||||||
// /// <param Subject="Criteria"></param>
|
protected override void DataPortal_Fetch(object Criteria)
|
||||||
// protected override void DataPortal_Fetch(object Criteria)
|
{
|
||||||
// {
|
//set to false to load items initially
|
||||||
// //set to false to load items initially
|
bReadOnly = false;
|
||||||
// bReadOnly=false;
|
|
||||||
//
|
Criteria crit = (Criteria)Criteria;
|
||||||
// Criteria crit = (Criteria)Criteria;
|
SafeDataReader dr = null;
|
||||||
// SafeDataReader dr = null;
|
try
|
||||||
// try
|
{
|
||||||
// {
|
dr = DBUtil.GetReaderFromSQLString("SELECT * FROM aMemo WHERE aID=@ID;", crit.ID);
|
||||||
// dr=DBUtil.GetReaderFromSQLString("SELECT * FROM aMemo WHERE aID=@ID;",crit.ID);
|
if (!dr.Read())
|
||||||
// if(!dr.Read())
|
DBUtil.ThrowFetchError("Memo ID: " + crit.ID.ToString());
|
||||||
// DBUtil.ThrowFetchError("Memo ID: " + crit.ID.ToString());
|
|
||||||
//
|
//Standard fields
|
||||||
// //Standard fields
|
mID = dr.GetGuid("aID");
|
||||||
// mID=dr.GetGuid("aID");
|
mCreated = DBUtil.ToLocal(dr.GetSmartDate("aCreated"));
|
||||||
// mCreated=DBUtil.ToLocal(dr.GetSmartDate("aCreated"));
|
mModified = DBUtil.ToLocal(dr.GetSmartDate("aModified"));
|
||||||
// mModified=DBUtil.ToLocal(dr.GetSmartDate("aModified"));
|
mCreator = dr.GetGuid("aCreator");
|
||||||
// mCreator=dr.GetGuid("aCreator");
|
mModifier = dr.GetGuid("aModifier");
|
||||||
// mModifier=dr.GetGuid("aModifier");
|
|
||||||
//
|
|
||||||
//
|
//Memo fields
|
||||||
// //Memo fields
|
//Important: use property not internal field
|
||||||
// //Important: use property not internal field
|
//so that initial broken rule is unbroken on fetch
|
||||||
// //so that initial broken rule is unbroken on fetch
|
Subject = dr.GetString("aSubject");
|
||||||
// Subject=dr.GetString("aSubject");
|
mMessage = dr.GetString("aMessage");
|
||||||
// mMessage=dr.GetString("aMessage");
|
mFromID = dr.GetGuid("aFromID");
|
||||||
// mFromID=dr.GetGuid("aFromID");
|
mToID = dr.GetGuid("aToID");
|
||||||
// mToID=dr.GetGuid("aToID");
|
mViewed = dr.GetBoolean("aViewed");
|
||||||
// mViewed=dr.GetBoolean("aViewed");
|
mReplied = dr.GetBoolean("aReplied");
|
||||||
//
|
|
||||||
//
|
|
||||||
// }
|
}
|
||||||
// finally
|
finally
|
||||||
// {
|
{
|
||||||
// if(dr!=null) dr.Close();
|
if (dr != null) dr.Close();
|
||||||
// }
|
}
|
||||||
// MarkOld();
|
MarkOld();
|
||||||
//
|
|
||||||
//
|
|
||||||
// //Get access rights level
|
//Get access rights level
|
||||||
// bReadOnly=AyaBizUtils.Right("Object.Memo")<(int)SecurityLevelTypes.ReadWrite;
|
bReadOnly = AyaBizUtils.Right("Object.Memo") < (int)SecurityLevelTypes.ReadWrite;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
#endregion fetch
|
#endregion fetch
|
||||||
|
|
||||||
#region Update
|
#region Update
|
||||||
@@ -592,58 +608,58 @@ namespace GZTW.AyaNova.BLL
|
|||||||
{
|
{
|
||||||
//If not a new record, check if record was modified
|
//If not a new record, check if record was modified
|
||||||
//by another user since original retrieval:
|
//by another user since original retrieval:
|
||||||
if(!IsNew)
|
if (!IsNew)
|
||||||
DBUtil.CheckSafeToUpdate(this.mModified.Date,this.mID,"aMemo");
|
DBUtil.CheckSafeToUpdate(this.mModified.Date, this.mID, "aMemo");
|
||||||
|
|
||||||
#region Delete
|
#region Delete
|
||||||
if(IsDeleted)
|
if (IsDeleted)
|
||||||
{
|
{
|
||||||
throw new System.Security.SecurityException(
|
throw new System.Security.SecurityException(
|
||||||
string.Format(
|
string.Format(
|
||||||
LocalizedTextTable.GetLocalizedTextDirect("Error.Security.NotAuthorizedToRetrieve"),
|
LocalizedTextTable.GetLocalizedTextDirect("Error.Security.NotAuthorizedToRetrieve"),
|
||||||
LocalizedTextTable.GetLocalizedTextDirect("O.Memo")));
|
LocalizedTextTable.GetLocalizedTextDirect("O.Memo")));
|
||||||
// if(!IsNew)
|
// if(!IsNew)
|
||||||
// {
|
// {
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// //Delete object and child objects
|
// //Delete object and child objects
|
||||||
// DBCommandWrapper cmDelete = DBUtil.GetCommandFromSQL("DELETE FROM aMemo WHERE aID = @ID;");
|
// DBCommandWrapper cmDelete = DBUtil.GetCommandFromSQL("DELETE FROM aMemo WHERE aID = @ID;");
|
||||||
// cmDelete.AddInParameter("@ID",DbType.Guid,this.mID);
|
// cmDelete.AddInParameter("@ID",DbType.Guid,this.mID);
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// using (IDbConnection connection = DBUtil.DB.GetConnection())
|
// using (IDbConnection connection = DBUtil.DB.GetConnection())
|
||||||
// {
|
// {
|
||||||
// connection.Open();
|
// connection.Open();
|
||||||
// IDbTransaction transaction = connection.BeginTransaction();
|
// IDbTransaction transaction = connection.BeginTransaction();
|
||||||
//
|
//
|
||||||
// try
|
// try
|
||||||
// {
|
// {
|
||||||
//
|
//
|
||||||
// DBUtil.DB.ExecuteNonQuery(cmDelete, transaction);
|
// DBUtil.DB.ExecuteNonQuery(cmDelete, transaction);
|
||||||
// DBUtil.RemoveKeywords(transaction,RootObjectTypes.Memo,this.mID);
|
// DBUtil.RemoveKeywords(transaction,RootObjectTypes.Memo,this.mID);
|
||||||
//
|
//
|
||||||
// // Commit the transaction
|
// // Commit the transaction
|
||||||
// transaction.Commit();
|
// transaction.Commit();
|
||||||
//
|
//
|
||||||
// }
|
// }
|
||||||
// catch
|
// catch
|
||||||
// {
|
// {
|
||||||
// // Rollback transaction
|
// // Rollback transaction
|
||||||
// transaction.Rollback();
|
// transaction.Rollback();
|
||||||
// throw;
|
// throw;
|
||||||
// }
|
// }
|
||||||
// finally
|
// finally
|
||||||
// {
|
// {
|
||||||
// connection.Close();
|
// connection.Close();
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// //-----------------------------
|
// //-----------------------------
|
||||||
// }
|
// }
|
||||||
// MarkNew();
|
// MarkNew();
|
||||||
// return;
|
// return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -655,13 +671,13 @@ namespace GZTW.AyaNova.BLL
|
|||||||
System.DateTime dtModified = DBUtil.CurrentWorkingDateTime;
|
System.DateTime dtModified = DBUtil.CurrentWorkingDateTime;
|
||||||
|
|
||||||
DBCommandWrapper cm = null;
|
DBCommandWrapper cm = null;
|
||||||
if(IsNew)//Add or update?
|
if (IsNew)//Add or update?
|
||||||
cm=DBUtil.GetCommandFromSQL(
|
cm = DBUtil.GetCommandFromSQL(
|
||||||
"INSERT INTO aMemo (aID, aSubject, aMessage, aFromID, aToID, aViewed, aReplied, aCreator,aModifier,aCreated, aModified) " +
|
"INSERT INTO aMemo (aID, aSubject, aMessage, aFromID, aToID, aViewed, aReplied, aCreator,aModifier,aCreated, aModified) " +
|
||||||
"VALUES (@ID,@Subject,@Message,@FromID,@ToID,@Viewed,@Replied,@CurrentUserID,@CurrentUserID,@Created,@Modified);"
|
"VALUES (@ID,@Subject,@Message,@FromID,@ToID,@Viewed,@Replied,@CurrentUserID,@CurrentUserID,@Created,@Modified);"
|
||||||
);
|
);
|
||||||
else
|
else
|
||||||
cm=DBUtil.GetCommandFromSQL(
|
cm = DBUtil.GetCommandFromSQL(
|
||||||
"UPDATE aMemo SET aID=@ID, aSubject=@Subject, aMessage=@Message, " +
|
"UPDATE aMemo SET aID=@ID, aSubject=@Subject, aMessage=@Message, " +
|
||||||
"aFromID=@FromID, aToID=@ToID, aViewed=@Viewed, " +
|
"aFromID=@FromID, aToID=@ToID, aViewed=@Viewed, " +
|
||||||
"aModifier=@CurrentUserID, aModified=@Modified " +
|
"aModifier=@CurrentUserID, aModified=@Modified " +
|
||||||
@@ -669,18 +685,18 @@ namespace GZTW.AyaNova.BLL
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
cm.AddInParameter("@ID",DbType.Guid,mID);
|
cm.AddInParameter("@ID", DbType.Guid, mID);
|
||||||
cm.AddInParameter("@Subject", DbType.String, mSubject);
|
cm.AddInParameter("@Subject", DbType.String, mSubject);
|
||||||
cm.AddLargeStringInParameter("@Message", mMessage);
|
cm.AddLargeStringInParameter("@Message", mMessage);
|
||||||
cm.AddInParameter("@FromID", DbType.Guid, mFromID);
|
cm.AddInParameter("@FromID", DbType.Guid, mFromID);
|
||||||
cm.AddInParameter("@ToID",DbType.Guid, mToID);
|
cm.AddInParameter("@ToID", DbType.Guid, mToID);
|
||||||
cm.AddInParameter("@Viewed", DbType.Boolean, mViewed);
|
cm.AddInParameter("@Viewed", DbType.Boolean, mViewed);
|
||||||
cm.AddInParameter("@Replied", DbType.Boolean, false);
|
cm.AddInParameter("@Replied", DbType.Boolean, false);
|
||||||
|
|
||||||
//Standard fields
|
//Standard fields
|
||||||
cm.AddInParameter("@CurrentUserID",DbType.Guid, CurrentUserID);
|
cm.AddInParameter("@CurrentUserID", DbType.Guid, CurrentUserID);
|
||||||
cm.AddInParameter("@Created",DbType.DateTime, DBUtil.ToUTC(mCreated).DBValue);
|
cm.AddInParameter("@Created", DbType.DateTime, DBUtil.ToUTC(mCreated).DBValue);
|
||||||
cm.AddInParameter("@Modified",DbType.DateTime, DBUtil.ToUTC(dtModified));
|
cm.AddInParameter("@Modified", DbType.DateTime, DBUtil.ToUTC(dtModified));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -695,8 +711,8 @@ namespace GZTW.AyaNova.BLL
|
|||||||
DBUtil.DB.ExecuteNonQuery(cm, transaction);
|
DBUtil.DB.ExecuteNonQuery(cm, transaction);
|
||||||
|
|
||||||
//Process keywords
|
//Process keywords
|
||||||
DBUtil.ProcessKeywords(transaction,this.mID,RootObjectTypes.Memo,IsNew,AyaBizUtils.Break(false,
|
DBUtil.ProcessKeywords(transaction, this.mID, RootObjectTypes.Memo, IsNew, AyaBizUtils.Break(false,
|
||||||
mSubject,mMessage));
|
mSubject, mMessage));
|
||||||
|
|
||||||
MarkOld();//db is now synched with object
|
MarkOld();//db is now synched with object
|
||||||
|
|
||||||
@@ -716,11 +732,11 @@ namespace GZTW.AyaNova.BLL
|
|||||||
}
|
}
|
||||||
//Successful update so
|
//Successful update so
|
||||||
//change modification time to match
|
//change modification time to match
|
||||||
this.mModified.Date=dtModified;
|
this.mModified.Date = dtModified;
|
||||||
//Process events as necessary
|
//Process events as necessary
|
||||||
if(AyaBizUtils.GlobalSettings.UseNotification)//Case 509
|
if (AyaBizUtils.GlobalSettings.UseNotification)//Case 509
|
||||||
{
|
{
|
||||||
NotifyEvent.AddOrUpdateEvent(RootObjectTypes.Memo,this.mID,(int)MemoEvent.Created,this.mToID,new SmartDate(),Guid.Empty);
|
NotifyEvent.AddOrUpdateEvent(RootObjectTypes.Memo, this.mID, (int)MemoEvent.Created, this.mToID, new SmartDate(), Guid.Empty);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -747,7 +763,7 @@ namespace GZTW.AyaNova.BLL
|
|||||||
Criteria crit = (Criteria)Criteria;
|
Criteria crit = (Criteria)Criteria;
|
||||||
//Delete object
|
//Delete object
|
||||||
DBCommandWrapper cmDelete = DBUtil.GetCommandFromSQL("DELETE FROM aMemo WHERE aID = @ID;");
|
DBCommandWrapper cmDelete = DBUtil.GetCommandFromSQL("DELETE FROM aMemo WHERE aID = @ID;");
|
||||||
cmDelete.AddInParameter("@ID",DbType.Guid,crit.ID);
|
cmDelete.AddInParameter("@ID", DbType.Guid, crit.ID);
|
||||||
|
|
||||||
using (IDbConnection connection = DBUtil.DB.GetConnection())
|
using (IDbConnection connection = DBUtil.DB.GetConnection())
|
||||||
{
|
{
|
||||||
@@ -758,7 +774,7 @@ namespace GZTW.AyaNova.BLL
|
|||||||
{
|
{
|
||||||
|
|
||||||
DBUtil.DB.ExecuteNonQuery(cmDelete, transaction);
|
DBUtil.DB.ExecuteNonQuery(cmDelete, transaction);
|
||||||
DBUtil.RemoveKeywords(transaction,RootObjectTypes.Memo,crit.ID);
|
DBUtil.RemoveKeywords(transaction, RootObjectTypes.Memo, crit.ID);
|
||||||
|
|
||||||
// Commit the transaction
|
// Commit the transaction
|
||||||
transaction.Commit();
|
transaction.Commit();
|
||||||
@@ -817,7 +833,7 @@ namespace GZTW.AyaNova.BLL
|
|||||||
public Guid ID;
|
public Guid ID;
|
||||||
public Criteria(Guid _ID)
|
public Criteria(Guid _ID)
|
||||||
{
|
{
|
||||||
ID=_ID;
|
ID = _ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -832,38 +848,38 @@ namespace GZTW.AyaNova.BLL
|
|||||||
[Serializable, System.ComponentModel.Browsable(false)]
|
[Serializable, System.ComponentModel.Browsable(false)]
|
||||||
public class MemoFlagger//DO_NOT_OBFUSCATE
|
public class MemoFlagger//DO_NOT_OBFUSCATE
|
||||||
{
|
{
|
||||||
bool _SetRead=false;
|
bool _SetRead = false;
|
||||||
bool _SetReplied=false;
|
bool _SetReplied = false;
|
||||||
Guid _MemoID;
|
Guid _MemoID;
|
||||||
|
|
||||||
public MemoFlagger(Guid MemoID, bool SetRead, bool SetReplied)
|
public MemoFlagger(Guid MemoID, bool SetRead, bool SetReplied)
|
||||||
{
|
{
|
||||||
_MemoID=MemoID;
|
_MemoID = MemoID;
|
||||||
_SetRead = SetRead;
|
_SetRead = SetRead;
|
||||||
_SetReplied=SetReplied;
|
_SetReplied = SetReplied;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SetMemoFlags(Guid MemoID, bool SetRead, bool SetReplied)
|
public static void SetMemoFlags(Guid MemoID, bool SetRead, bool SetReplied)
|
||||||
{
|
{
|
||||||
DataPortal.Update(new MemoFlagger( MemoID, SetRead, SetReplied));
|
DataPortal.Update(new MemoFlagger(MemoID, SetRead, SetReplied));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DataPortal_Update()
|
public void DataPortal_Update()
|
||||||
{
|
{
|
||||||
DBCommandWrapper cm = null;
|
DBCommandWrapper cm = null;
|
||||||
if(_SetRead)
|
if (_SetRead)
|
||||||
cm=DBUtil.GetCommandFromSQL(
|
cm = DBUtil.GetCommandFromSQL(
|
||||||
"UPDATE aMemo SET aViewed=@TRUE " +
|
"UPDATE aMemo SET aViewed=@TRUE " +
|
||||||
"WHERE aID=@ID;"
|
"WHERE aID=@ID;"
|
||||||
);
|
);
|
||||||
|
|
||||||
if(_SetReplied)
|
if (_SetReplied)
|
||||||
cm=DBUtil.GetCommandFromSQL(
|
cm = DBUtil.GetCommandFromSQL(
|
||||||
"UPDATE aMemo SET aReplied=@TRUE " +
|
"UPDATE aMemo SET aReplied=@TRUE " +
|
||||||
"WHERE aID=@ID;"
|
"WHERE aID=@ID;"
|
||||||
);
|
);
|
||||||
|
|
||||||
cm.AddInParameter("@ID",DbType.Guid,_MemoID);
|
cm.AddInParameter("@ID", DbType.Guid, _MemoID);
|
||||||
cm.AddInParameter("@TRUE", DbType.Boolean, true);
|
cm.AddInParameter("@TRUE", DbType.Boolean, true);
|
||||||
|
|
||||||
DBUtil.DB.ExecuteNonQuery(cm);
|
DBUtil.DB.ExecuteNonQuery(cm);
|
||||||
@@ -888,7 +904,8 @@ namespace GZTW.AyaNova.BLL
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Description("LT:Memo.Label.Event.Created")] Created=1
|
[Description("LT:Memo.Label.Event.Created")]
|
||||||
|
Created = 1
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ namespace GZTW.AyaNova.BLL
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[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
|
||||||
@@ -136,12 +136,12 @@ namespace GZTW.AyaNova.BLL
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Constructor
|
#region Constructor
|
||||||
private RelativeTimeFormatter rtfm = null;
|
private RelativeTimeFormatter rtfm=null;
|
||||||
|
|
||||||
protected MemoList()
|
protected MemoList()
|
||||||
{
|
{
|
||||||
|
|
||||||
rtfm = RelativeTimeFormatter.GetItem(User.CurrentUserLanguage);
|
rtfm=RelativeTimeFormatter.GetItem(User.CurrentUserLanguage);
|
||||||
// AllowSort=false;
|
// AllowSort=false;
|
||||||
// AllowFind=true;
|
// AllowFind=true;
|
||||||
// AllowEdit=false;
|
// AllowEdit=false;
|
||||||
@@ -162,7 +162,7 @@ namespace GZTW.AyaNova.BLL
|
|||||||
|
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return (MemoListInfo)List[Item];
|
return (MemoListInfo) List[Item];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -178,9 +178,9 @@ namespace GZTW.AyaNova.BLL
|
|||||||
{
|
{
|
||||||
foreach (MemoListInfo child in List)
|
foreach (MemoListInfo child in List)
|
||||||
{
|
{
|
||||||
if (child.ID == ItemID) return child.ToString();
|
if(child.ID==ItemID) return child.ToString();
|
||||||
}
|
}
|
||||||
return "Missing: " + ItemID.ToString();
|
return "Missing: "+ItemID.ToString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@@ -194,7 +194,7 @@ namespace GZTW.AyaNova.BLL
|
|||||||
{
|
{
|
||||||
foreach (MemoListInfo child in List)
|
foreach (MemoListInfo child in List)
|
||||||
{
|
{
|
||||||
if (child.Equals(obj)) return true;
|
if(child.Equals(obj)) return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -376,19 +376,6 @@ namespace GZTW.AyaNova.BLL
|
|||||||
{
|
{
|
||||||
|
|
||||||
if (crit.IDList != null)
|
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
|
|
||||||
{
|
|
||||||
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");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
//Case 556
|
//Case 556
|
||||||
System.Text.StringBuilder sbIN = new System.Text.StringBuilder();
|
System.Text.StringBuilder sbIN = new System.Text.StringBuilder();
|
||||||
@@ -415,7 +402,7 @@ namespace GZTW.AyaNova.BLL
|
|||||||
" LEFT OUTER JOIN AREGION ON (AUSER.AREGIONID=AREGION.AID) " +
|
" LEFT OUTER JOIN AREGION ON (AUSER.AREGIONID=AREGION.AID) " +
|
||||||
sbIN.ToString() + " " +
|
sbIN.ToString() + " " +
|
||||||
AyaBizUtils.GetGridSortOrderColumns(crit.CriteriaXML));
|
AyaBizUtils.GetGridSortOrderColumns(crit.CriteriaXML));
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -441,20 +428,20 @@ 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"),
|
||||||
@@ -462,8 +449,8 @@ namespace GZTW.AyaNova.BLL
|
|||||||
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);
|
InnerList.Add(info);
|
||||||
@@ -472,7 +459,7 @@ namespace GZTW.AyaNova.BLL
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
if (dr != null) dr.Close();
|
if(dr!=null) dr.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
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