Exemple #1
0
 public void CreateGoLeave(int ID, string text, string pathAvatar, string pathPlate, string pathFull)
 {
     try
     {
         using (var context = new admin_dangkythitoeicEntities())
         {
             var old = context.GoLeaves
                       .OrderByDescending(p => p.GoDT)
                       .First();
             if (DateTime.Now.Subtract(old.GoDT.Value).Seconds > 4)
             {
                 GoLeave goLeave = new GoLeave
                 {
                     GoAvatar = pathAvatar,
                     GoDT     = DateTime.Now,
                     GoFull   = pathFull,
                     GoPlate  = pathPlate,
                     GoOCR    = text,
                     OwnerID  = ID
                 };
                 context.GoLeaves.Add(goLeave);
                 context.SaveChanges();
             }
         }
     }
     catch { }
 }
Exemple #2
0
 public LeaveError CheckGoLeave(int ID, string text, string pathAvatar, string pathPlate, string pathFull)
 {
     try
     {
         using (var context = new admin_dangkythitoeicEntities())
         {
             var single = context.GoLeaves.Where(p => p.OwnerID == ID && !p.IsFinish).OrderByDescending(p => p.GoDT).FirstOrDefault();
             if (single != null)
             {
                 if (single.GoOCR == text)
                 {
                     single.leaveAvatar          = pathAvatar;
                     single.LeaveDT              = DateTime.Now;
                     single.LeaveFull            = pathFull;
                     single.LeavePlate           = pathPlate;
                     single.OutOCR               = text;
                     single.IsFinish             = true;
                     context.Entry(single).State = EntityState.Modified;
                     context.SaveChanges();
                     return(LeaveError.SUCCESSS);
                 }
                 else
                 {
                     return(LeaveError.WRONGOCG);
                 }
             }
             else
             {
                 return(LeaveError.NOTFOUND);
             }
         }
     }
     catch { }
     return(LeaveError.UNKNWON);
 }
Exemple #3
0
 public void CreateMember(string text, string pathAvatar, string pathPlate, string pathFull)
 {
     using (var context = new admin_dangkythitoeicEntities())
     {
         Member member = new Member
         {
             CreateDT     = DateTime.Now,
             UpdateDT     = DateTime.Now,
             Address      = "",
             UniversityID = 0,
             IsDeleted    = false,
         };
         context.Members.Add(member);
         GoLeave goLeave = new GoLeave
         {
             GoAvatar = pathAvatar,
             GoDT     = DateTime.Now,
             GoFull   = pathFull,
             GoPlate  = pathPlate,
             GoOCR    = text,
             OwnerID  = member.ID
         };
         context.GoLeaves.Add(goLeave);
         context.SaveChanges();
     }
 }
Exemple #4
0
 public void CreateReason(string goText, string leaveText,
                          string goPathAvatar, string leavePathAvatar,
                          string goPathPlate, string leavePathPlate,
                          string goPathFull, string leavePathFull)
 {
     using (var context = new admin_dangkythitoeicEntities())
     {
         Member member = new Member
         {
             CreateDT     = DateTime.Now,
             UpdateDT     = DateTime.Now,
             Address      = "",
             UniversityID = 0,
             IsDeleted    = false,
         };
         context.Members.Add(member);
         GoLeave goLeave = new GoLeave
         {
             GoAvatar    = goPathAvatar,
             GoDT        = DateTime.Now,
             GoFull      = goPathFull,
             GoPlate     = goPathPlate,
             GoOCR       = goPathPlate,
             LeavePlate  = leavePathPlate,
             leaveAvatar = leavePathAvatar,
             LeaveDT     = DateTime.Now,
             LeaveFull   = leavePathFull,
             IsFinish    = true,
             OutOCR      = leaveText,
             OwnerID     = member.ID,
         };
         context.GoLeaves.Add(goLeave);
         context.SaveChanges();
     }
 }