Example #1
0
		///<summary></summary>
		public static void Update(QuickPasteNote note){
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
				Meth.GetVoid(MethodBase.GetCurrentMethod(),note);
				return;
			}
			Crud.QuickPasteNoteCrud.Update(note);
		}
Example #2
0
		///<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);
		}
Example #3
0
		///<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);
		}
Example #4
0
 ///<summary></summary>
 public static void Update(QuickPasteNote note)
 {
     if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
     {
         Meth.GetVoid(MethodBase.GetCurrentMethod(), note);
         return;
     }
     Crud.QuickPasteNoteCrud.Update(note);
 }
Example #5
0
 ///<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));
 }
Example #6
0
        ///<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);
        }
Example #7
0
		///<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;
		}
Example #8
0
		///<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;
		}
Example #9
0
        ///<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);
        }
Example #10
0
        ///<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);
        }
Example #11
0
        ///<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);
        }