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(); } }
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 { } }
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(); } }