Exemplo n.º 1
0
        public static void SetDataDescription(int userID, DateTime date, string desc)
        {
            CompareCondition <DateTime> cond = new CompareCondition <DateTime>(
                DataObject.Schema.Date, new ValueCondition <DateTime>(date), COMPARE_KIND.EQUAL);
            var user     = ServerModel.DB.Load <TblUsers>(userID);
            var notesIds = ServerModel.DB.LookupIds <TblUserNotes>(user, cond);
            var notes    = ServerModel.DB.Load <TblUserNotes>(notesIds);

            if (notes.Count == 0)
            {
                TblUserNotes note = new TblUserNotes()
                {
                    Date        = date,
                    Description = desc,
                    SysState    = 0,
                    UserRef     = userID
                }
                ;
                ServerModel.DB.Insert(note);
            }
            else
            {
                TblUserNotes note = notes[0];
                note.Description = desc;
                ServerModel.DB.Update(note);
            }
        }
Exemplo n.º 2
0
 public static void SetDataDescription(int userID, DateTime date, string desc)
 {
     CompareCondition<DateTime> cond = new CompareCondition<DateTime>(
         DataObject.Schema.Date, new ValueCondition<DateTime>(date), COMPARE_KIND.EQUAL);
     var user = ServerModel.DB.Load<TblUsers>(userID);
     var notesIds = ServerModel.DB.LookupIds<TblUserNotes>(user, cond);
     var notes = ServerModel.DB.Load<TblUserNotes>(notesIds);
     if (notes.Count == 0)
     {
         TblUserNotes note = new TblUserNotes()
                                 {
                                     Date = date,
                                     Description = desc,
                                     SysState = 0,
                                     UserRef = userID                                     
                                 }
         ;
         ServerModel.DB.Insert(note);
     }
     else
     {
         TblUserNotes note = notes[0];
         note.Description = desc;
         ServerModel.DB.Update(note);
     }
 }