Beispiel #1
0
 public FamilyResult(int fid, int campus, int thisday, int page, bool waslocked)
 {
     this.fid = fid;
     this.campus = campus;
     this.thisday = thisday;
     this.page = page;
     this.waslocked = waslocked;
     if (fid > 0)
     {
         var db = new CMSDataContext(Util.ConnectionString);
         var lockf = db.FamilyCheckinLocks.SingleOrDefault(f => f.FamilyId == fid);
         if (lockf == null)
         {
             lockf = new FamilyCheckinLock { FamilyId = fid, Created = DateTime.Now };
             db.FamilyCheckinLocks.InsertOnSubmit(lockf);
         }
         lockf.Locked = true;
         if (!waslocked)
             lockf.Created = DateTime.Now;
         db.SubmitChanges();
     }
 }
Beispiel #2
0
 private void detach_FamilyCheckinLocks(FamilyCheckinLock entity)
 {
     this.SendPropertyChanging();
     entity.Family = null;
 }
Beispiel #3
0
		private void detach_FamilyCheckinLocks(FamilyCheckinLock entity)
		{
			this.SendPropertyChanging();
			entity.Family = null;
		}
        public ActionResult LockFamily(string data)
        {
            if (!Auth())
                return BaseMessage.createErrorReturn("Authentication failed, please try again", BaseMessage.API_ERROR_INVALID_CREDENTIALS);

            BaseMessage dataIn = BaseMessage.createFromString(data);

            var lockf = DbUtil.Db.FamilyCheckinLocks.SingleOrDefault(f => f.FamilyId == dataIn.argInt);

            if (lockf == null)
            {
                lockf = new FamilyCheckinLock { FamilyId = dataIn.argInt, Created = DateTime.Now };
                DbUtil.Db.FamilyCheckinLocks.InsertOnSubmit(lockf);
            }

            lockf.Locked = true;
            lockf.Created = DateTime.Now;

            DbUtil.Db.SubmitChanges();

            BaseMessage br = new BaseMessage();
            br.setNoError();
            br.id = dataIn.argInt;
            return br;
        }