///<summary></summary> public static void Update(QuickPasteNote note){ if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) { Meth.GetVoid(MethodBase.GetCurrentMethod(),note); return; } Crud.QuickPasteNoteCrud.Update(note); }
///<summary></summary> public static long Insert(QuickPasteNote note) { if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) { note.QuickPasteNoteNum=Meth.GetLong(MethodBase.GetCurrentMethod(),note); return note.QuickPasteNoteNum; } return Crud.QuickPasteNoteCrud.Insert(note); }
///<summary></summary> public static void Delete(QuickPasteNote note){ if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) { Meth.GetVoid(MethodBase.GetCurrentMethod(),note); return; } string command="DELETE from quickpastenote WHERE QuickPasteNoteNum = '" +POut.Long(note.QuickPasteNoteNum)+"'"; Db.NonQ(command); }
///<summary></summary> public static void Update(QuickPasteNote note) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { Meth.GetVoid(MethodBase.GetCurrentMethod(), note); return; } Crud.QuickPasteNoteCrud.Update(note); }
///<summary></summary> public static long Insert(QuickPasteNote note) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { note.QuickPasteNoteNum = Meth.GetLong(MethodBase.GetCurrentMethod(), note); return(note.QuickPasteNoteNum); } return(Crud.QuickPasteNoteCrud.Insert(note)); }
///<summary></summary> public static void Delete(QuickPasteNote note) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { Meth.GetVoid(MethodBase.GetCurrentMethod(), note); return; } string command = "DELETE from quickpastenote WHERE QuickPasteNoteNum = '" + POut.Long(note.QuickPasteNoteNum) + "'"; Db.NonQ(command); }
///<summary>When saving an abbrev, this makes sure that the abbreviation is not already in use.</summary> public static bool AbbrAlreadyInUse(QuickPasteNote note){ if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) { return Meth.GetBool(MethodBase.GetCurrentMethod(),note); } string command="SELECT * FROM quickpastenote WHERE " +"Abbreviation='"+POut.String(note.Abbreviation)+"' " +"AND QuickPasteNoteNum != '"+POut.Long (note.QuickPasteNoteNum)+"'"; DataTable table=Db.GetTable(command); if(table.Rows.Count==0){ return false; } return true; }
///<summary>Only used from FormQuickPaste to get all notes for the selected cat.</summary> public static QuickPasteNote[] GetForCat(long cat) { //No need to check RemotingRole; no call to db. if(List==null) { RefreshCache(); } ArrayList ALnotes=new ArrayList(); for(int i=0;i<List.Length;i++){ if(List[i].QuickPasteCatNum==cat){ ALnotes.Add(List[i]); } } QuickPasteNote[] retArray=new QuickPasteNote[ALnotes.Count]; for(int i=0;i<ALnotes.Count;i++){ retArray[i]=(QuickPasteNote)ALnotes[i]; } return retArray; }
///<summary>When saving an abbrev, this makes sure that the abbreviation is not already in use.</summary> public static bool AbbrAlreadyInUse(QuickPasteNote note) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { return(Meth.GetBool(MethodBase.GetCurrentMethod(), note)); } string command = "SELECT * FROM quickpastenote WHERE " + "Abbreviation='" + POut.String(note.Abbreviation) + "' " + "AND QuickPasteNoteNum != '" + POut.Long(note.QuickPasteNoteNum) + "'"; DataTable table = Db.GetTable(command); if (table.Rows.Count == 0) { return(false); } return(true); }
///<summary>When saving an abbrev, this makes sure that the abbreviation is not already in use. ///This checks the current cache for duplicates.</summary> public static string AbbrAlreadyInUse(QuickPasteNote note) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { return(Meth.GetString(MethodBase.GetCurrentMethod(), note)); } string msgText = ""; List <QuickPasteCat> listQuickPasteCats = QuickPasteCats.GetDeepCopy(); List <QuickPasteNote> listDuplicates = GetWhere(x => note.Abbreviation == x.Abbreviation && note.QuickPasteNoteNum != x.QuickPasteNoteNum).ToList(); if (listDuplicates.Count <= 0) { return(msgText); } msgText = Lans.g("FormQuickPasteNoteEdit", "The abbreviation") + " '" + note.Abbreviation + "' " + Lans.g("FormQuickPasteNoteEdit", "is in use in the categories:") + "\r\n" + String.Join(", ", listQuickPasteCats.Where(x => x.QuickPasteCatNum.In(listDuplicates.Select(z => z.QuickPasteCatNum))).Select(x => x.Description)) + "\r\n" + Lans.g("FormQuickPasteNoteEdit", "Do you wish to continue?"); return(msgText); }
///<summary>Only used from FormQuickPaste to get all notes for the selected cat.</summary> public static QuickPasteNote[] GetForCat(long cat) { //No need to check RemotingRole; no call to db. if (List == null) { RefreshCache(); } ArrayList ALnotes = new ArrayList(); for (int i = 0; i < List.Length; i++) { if (List[i].QuickPasteCatNum == cat) { ALnotes.Add(List[i]); } } QuickPasteNote[] retArray = new QuickPasteNote[ALnotes.Count]; for (int i = 0; i < ALnotes.Count; i++) { retArray[i] = (QuickPasteNote)ALnotes[i]; } return(retArray); }