public bool ChuyenQuay(QuayModel toQuay, int number, int matb, int manv) { try { db = new QMSEntities(); var xlyc = db.XULYYCs.Where(x => x.MAPHIEU == number && (x.MATT == eStatus.Procesing || x.MATT == eStatus.Waiting)); //if (xlyc != null) //{ // xlyc.MATT = eStatus.Done; // xlyc.GKETTHUC = DateTime.Now; //} var nghiepvu = db.NV_NGHIEPVU.OrderBy(x => x.UUTIEN).FirstOrDefault(x => x.MANV == toQuay.MaNV); var newObj = new XULYYC(); newObj.MAPHIEU = number; newObj.MANVU = nghiepvu.MANVU; newObj.MANVUT = nghiepvu.MANVU; // newObj.GLAYPHIEU = xlyc.GLAYPHIEU; // newObj.GDENQUAY = xlyc.GDENQUAY; newObj.MATT = eStatus.Waiting; newObj.NB = 0; newObj.STT = (db.XULYYCs.Count() + 1); db.XULYYCs.Add(newObj); db.SaveChanges(); return(true); } catch (Exception) { } return(false); }
public ResponseBase InsertOrUpdate(Q_EvaluateDetail obj) { var rs = new ResponseBase(); try { db = new Models.QMSEntities(); if (obj.Id == 0) { db.Q_EvaluateDetail.Add(obj); rs.IsSuccess = false; } else { var oldObj = Get(obj.Id); if (oldObj != null) { oldObj.EvaluateId = obj.EvaluateId; oldObj.Index = obj.Index; oldObj.Name = obj.Name; oldObj.IsDefault = obj.IsDefault; oldObj.Note = obj.Note; oldObj.Icon = obj.Icon; } } db.SaveChanges(); rs.IsSuccess = true; } catch { } return(rs); }
public ResponseBase Delete(int manv) { try { db = new QMSEntities(); var result = new ResponseBase(); var nv = db.NHANVIENs.FirstOrDefault(x => x.MANV == manv); if (nv == null) { result.IsSuccess = false;; result.Errors.Add(new Error() { MemberName = "Delete", Message = "Dữ liệu bạn đang thao tác đã bị xóa hoặc không tồn tại. Vui lòng kiểm tra lại !." }); } else { db.NHANVIENs.Remove(nv); db.SaveChanges(); result.IsSuccess = true; } return(result); } catch (Exception ex) { throw ex; } }
public bool InsertOrUpdate(Q_BookService obj) { var rs = false; try { if (obj.Id == 0) { db.Q_BookService.Add(obj); rs = false; } else { var oldObj = db.Q_BookService.FirstOrDefault(x => x.Id == obj.Id); if (oldObj != null) { oldObj.MaNV = obj.MaNV; oldObj.KhachHang = obj.KhachHang; oldObj.SoXe = obj.SoXe; oldObj.SoDienThoai = obj.SoDienThoai; oldObj.GioHen = obj.GioHen; oldObj.NgayHen = obj.NgayHen; } } db.SaveChanges(); rs = true; } catch { } return(rs); }
public ResponseBase InsertOrUpdate(Q_Evaluate obj) { var rs = new ResponseBase(); try { if (obj.Id == 0) { db.Q_Evaluate.Add(obj); rs.IsSuccess = false; } else { var oldObj = Get(obj.Id); if (oldObj != null) { oldObj.Index = obj.Index; oldObj.Name = obj.Name; oldObj.Note = obj.Note; } } db.SaveChanges(); rs.IsSuccess = true; } catch { } return(rs); }
public ResponseBase InsertServiceRequire(YEUCAU model) { db = new QMSEntities(); try { var result = new ResponseBase(); var requireObjs = db.YEUCAUs.Where(x => x.MADV == model.MADV).OrderByDescending(x => x.GIOCAP).ToList(); var serviceObj = db.DICHVUs.Where(x => x.MADV == model.MADV).FirstOrDefault(); double minutes = 0; DateTime time = DateTime.Now; if (serviceObj != null) { model.GIOCAP = time; model.MATT = eStatusName.Wating; if (requireObjs.Count > 0) { model.MAPHIEU = requireObjs[0].MAPHIEU + 1; var processObj = requireObjs.Where(x => eStatusName.Processing == x.MATT).FirstOrDefault(); if (processObj != null) { minutes = TimeSpan.Parse(serviceObj.THOIGIANXULY).TotalMinutes *((int)requireObjs[0].MAPHIEU - (int)processObj.MAPHIEU); } else { minutes = TimeSpan.Parse(serviceObj.THOIGIANXULY).TotalMinutes *requireObjs.Count; } model.TGPHUCVU_DK = time.AddMinutes(minutes); } else { model.MAPHIEU = serviceObj.SOPHIEU.Value + 1; model.TGPHUCVU_DK = time; } db.YEUCAUs.Add(model); db.SaveChanges(); result.IsSuccess = true; result.Data = "Khách hàng có Số điện thoại : " + model.PHONE + " <br/>đã chọn Dịch vụ : " + serviceObj.TENDV + "<br/>được cấp STT : " + model.MAPHIEU + "<br/>Thời gian phục vụ dự kiến :" + model.TGPHUCVU_DK.Value.ToString("HH'h : 'mm"); } else { result.IsSuccess = false; result.Errors.Add(new Error() { MemberName = "them", Message = "Không tìm thấy Dịch Vu theo yêu cầu.Vui lòng thử lại." }); } return(result); } catch (Exception ex) { throw ex; } }
public bool CallNext(int num, Login login) { //db = new QMSEntities(); //// var xlyc = db.XULYYCs.Where(x => x.MAPHIEU.Value.ToString() == num.ToString() && x.MATB == login.iCounterId && x.MATB == login.iStaffId).FirstOrDefault(); //var xlyc = db.XULYYCs.Where(x => x.MAPHIEU.Value == num && x.MATB == login.iCounterId && x.MANV == login.iStaffId).FirstOrDefault(); //if (xlyc != null) //{ // xlyc.GKETTHUC = DateTime.Now; // xlyc.MATT = eStatus.Done; // //var yc = db.YEUCAUs.FirstOrDefault(x => x.MAPHIEU == num); // //yc.MATT = eStatus.Done; // db.SaveChanges(); // return true; //} //return false; try { db = new QMSEntities(); var xlycs = db.XULYYCs.Where(x => x.MATB == login.iCounterId && x.MANV == login.iStaffId && x.MAPHIEU == num).ToList(); if (xlycs != null) { bool done = false; foreach (var item in xlycs) { item.GKETTHUC = DateTime.Now; item.MATT = eStatus.Done; if (!done) { var newObj = new Q_UserEvaluate(); newObj.UserId = item.MANV ?? 0; newObj.TicketNumber = num; newObj.Score = "0"; newObj.GLAYPHIEU = item.GLAYPHIEU; newObj.GDENQUAY = item.GDENQUAY; newObj.GGIAODICH = item.GGIAODICH; newObj.GKETTHUC = item.GKETTHUC; db.Q_UserEvaluate.Add(newObj); done = true; } } var yc = db.YEUCAUs.FirstOrDefault(x => x.MAPHIEU == num); yc.MATT = eStatus.Done; db.SaveChanges(); return(true); } } catch (Exception) { } return(false); }
public void WriteLogin(int iCounterId, int iStaffId, DateTime dLoginTime) { db = new QMSEntities(); var obj = new LOGON(); obj.MATB = (Int16)iCounterId; obj.MANV = (Int16)iStaffId; obj.NGAY = dLoginTime; obj.GIO = dLoginTime; obj.MATT = eStatus.Login; db.LOGONs.Add(obj); db.SaveChanges(); WriteRequired(iCounterId, "LOGIN", "0", DateTime.Now); }
public void CheckRequiredDayPass() { db = new QMSEntities(); var now = DateTime.Now; var objs = db.CounterSofts.Where(x => x.Status != 0 && x.UpdateTime.Value.Year != now.Year && x.UpdateTime.Value.Month != now.Month && x.UpdateTime.Value.Day != now.Day); if (objs != null && objs.Count() > 0) { foreach (var item in objs) { item.Status = 0; } db.SaveChanges(); } }
public void WriteFinishStatus(int iCounterId, bool isViewList) { db = new QMSEntities(); var obj = db.CounterSofts.FirstOrDefault(x => x.CounterSoftId == iCounterId); if (obj != null) { obj.Status = 0; if (isViewList) { obj.Required = ""; } db.SaveChanges(); } }
public Q_CallButtonNext FindButtonClick(Login obj) { db = new QMSEntities(); var data = db.Q_CallButtonNext.FirstOrDefault(x => x.CounterId == obj.iCounterId && x.UserId == obj.iStaffId && x.IsClick); if (data != null) { data.IsClick = false; db.SaveChanges(); return(data); } else { return(null); } }
public bool ChangeStatusToDG(Login obj) { db = new QMSEntities(); var xlYC = db.XULYYCs.FirstOrDefault(x => x.MANV == obj.iStaffId && x.MATB == obj.iCounterId && x.MATT == eStatus.Procesing); if (xlYC != null) { xlYC.MATT = eStatus.Rating; var yc = db.YEUCAUs.FirstOrDefault(x => x.MAPHIEU == xlYC.MAPHIEU); if (yc != null) { yc.MATT = eStatus.Rating; } db.SaveChanges(); return(true); } return(false); }
public bool WriteLogout(int iCounterId, int iStaffId, DateTime dLoginTime) { try { db = new QMSEntities(); var obj = db.LOGONs.FirstOrDefault(x => x.MATB == iCounterId && x.MANV == iStaffId && x.MATT == eStatus.Login); if (obj != null) { obj.MATT = eStatus.LogOut; obj.LOGOUTTIME = dLoginTime; db.SaveChanges(); WriteRequired(iCounterId, "LOGOU", "0", dLoginTime); return(true); } } catch (Exception) { } return(false); }
public ResponseBase Evaluate(string username, string value, int num) { var rs = new ResponseBase(); try { db = new QMSEntities(); var ticketinfo = db.XULYYCs.FirstOrDefault(x => x.MAPHIEU == num); if (ticketinfo != null) { var user = db.NHANVIENs.FirstOrDefault(x => x.USERNAME.Trim().ToUpper().Equals(username.Trim().ToUpper())); var obj = new Q_UserEvaluate(); obj.UserId = user.MANV; obj.TicketNumber = num; obj.GLAYPHIEU = ticketinfo.GLAYPHIEU; obj.GDENQUAY = ticketinfo.GDENQUAY; obj.GGIAODICH = ticketinfo.GGIAODICH; obj.GKETTHUC = ticketinfo.GKETTHUC; } //if (obj.Id == 0) //{ // db.Q_Evaluate.Add(obj); // rs.IsSuccess = false; //} //else //{ // var oldObj = Get(obj.Id); // if (oldObj != null) // { // oldObj.Index = obj.Index; // oldObj.Name = obj.Name; // oldObj.Note = obj.Note; // } //} db.SaveChanges(); rs.IsSuccess = true; } catch { } return(rs); }
public bool SaveUser(NHANVIEN obj, bool changImg) { db = new QMSEntities(); var old = db.NHANVIENs.FirstOrDefault(x => x.MANV == obj.MANV); if (old != null) { old.TENNV = obj.TENNV; old.ChuyenMon = obj.ChuyenMon; old.ChucVu = obj.ChucVu; old.GIOITINH = obj.GIOITINH; old.DIACHI = obj.DIACHI; old.QTCongTac = obj.QTCongTac; if (changImg) { old.Hinh = obj.Hinh; } db.SaveChanges(); return(true); } return(false); }
public void CheckLogin(int iCounterId, int iStaffId) { try { db = new QMSEntities(); var objs = db.LOGONs.Where(x => x.MANV == iStaffId && x.MATT == eStatus.Login); if (objs.Count() > 0) { foreach (var item in objs) { item.MATT = eStatus.LogOut; item.LOGOUTTIME = DateTime.Now; // WriteRequired(item.MATB ?? 0, "LOGOU", "0", DateTime.Now); } db.SaveChanges(); } } catch (Exception ex) { } }
public bool Delete(int Id) { try { db = new QMSEntities(); var obj = db.Q_BookService.FirstOrDefault(x => x.Id == Id); if (obj != null) { obj.IsDeleted = true; db.SaveChanges(); return(true); } else { return(false); } } catch (Exception ex) { return(false); } return(true); }
public void WriteRequired(int iCounterId, string sRequired, string sRequiredParam, DateTime dUpdateTime) { db = new QMSEntities(); CounterSoft counter = db.CounterSofts.FirstOrDefault(x => x.CounterSoftId == iCounterId); if (counter != null) { counter.Required = sRequired; counter.RequiredParam = sRequiredParam; counter.Status = 1; counter.UpdateTime = dUpdateTime; } else { counter = new CounterSoft(); counter.Required = sRequired; counter.RequiredParam = sRequiredParam; counter.Status = 1; counter.UpdateTime = dUpdateTime; counter.CounterSoftId = (Int16)iCounterId; db.CounterSofts.Add(counter); } db.SaveChanges(); }
public ResponseBase Delete(int Id) { var rs = new ResponseBase(); try { db = new Models.QMSEntities(); var obj = Get(Id); if (obj != null) { obj.IsDeleted = true; db.SaveChanges(); rs.IsSuccess = true; } else { rs.IsSuccess = false; } } catch (Exception) { } return(rs); }
public ViewModel GetDayInfo() { db = new QMSEntities(); DateTime Now = DateTime.Now; var totalrequireds = db.YEUCAUs.Where(x => x.GIOCAP.Value.Day == DateTime.Now.Day && x.GIOCAP.Value.Month == DateTime.Now.Month && x.GIOCAP.Value.Year == DateTime.Now.Year).ToList(); var dayInfo = new ViewModel(); dayInfo.Date = DateTime.Now.ToString("dd'/'MM'/'yyyy"); dayInfo.Time = DateTime.Now.ToString("HH' : 'mm' : 'ss"); dayInfo.TotalCar = totalrequireds.Select(x => x.MAPHIEU).Distinct().Count(); dayInfo.TotalCarWaiting = totalrequireds.Where(x => x.MATT == eStatusName.Wating).Select(x => x.MAPHIEU).Distinct().Count(); if (ConfigurationManager.AppSettings["IsTIENTHU"] == "1") { var numbers = db.XULYYCs.Where(x => x.GLAYPHIEU.Value.Day == Now.Day && x.GLAYPHIEU.Value.Month == Now.Month && x.GLAYPHIEU.Value.Year == Now.Year && x.MANV.Value == 16 && x.MATT == eStatusName.Processing).Select(x => x.MAPHIEU).Distinct().ToList(); dayInfo.TotalCarProcessing = totalrequireds.Where(x => !numbers.Contains(x.MAPHIEU) && x.MATT == eStatusName.Processing).Select(x => x.MAPHIEU).Distinct().Count(); dayInfo.TotalCarServed = totalrequireds.Where(x => x.MATT == eStatusName.Done || numbers.Contains(x.MAPHIEU)).Select(x => x.MAPHIEU).Distinct().Count(); } else { dayInfo.TotalCarProcessing = totalrequireds.Where(x => x.MATT == eStatusName.Processing).Select(x => x.MAPHIEU).Distinct().Count(); dayInfo.TotalCarServed = totalrequireds.Where(x => x.MATT == eStatusName.Done).Select(x => x.MAPHIEU).Distinct().Count(); } try { dayInfo.Details.AddRange(db.QUAYs.Where(x => x.IsShow).Select(x => new ViewDetailModel() { CarNumber = "0", TableId = x.MAQUAY, TableName = x.TENQUAY, Start = null, TicketNumber = 0, TimeProcess = "0", StartStr = "0" }).ToList()); var objs = db.XULYYCs.Where(x => x.MATT == eStatusName.Processing && x.GDENQUAY.Value.Day == DateTime.Now.Day && x.GDENQUAY.Value.Month == DateTime.Now.Month && x.GDENQUAY.Value.Year == DateTime.Now.Year).Select(x => new ViewDetailModel() { STT = (int)x.STT, TableId = x.THIETBI.MAQUAY.Value, CarNumber = x.YEUCAU.SOXE, TableName = x.THIETBI.QUAY.TENQUAY, Start = x.GGIAODICH.Value, TicketNumber = (int)x.MAPHIEU, Temp = x.Temp.Value }).ToList(); if (dayInfo.Details.Count > 0 && objs.Count > 0) { foreach (var item in dayInfo.Details) { var find = objs.FirstOrDefault(x => x.TableId == item.TableId); if (find != null) { if (find.Temp == null) { var fObj = db.XULYYCs.FirstOrDefault(x => x.STT == find.STT); fObj.Temp = find.Start; find.Temp = find.Start; } item.CarNumber = !string.IsNullOrEmpty(find.CarNumber) ? find.CarNumber : "0"; item.TicketNumber = find.TicketNumber; item.Start = find.Temp; if (find.Start != null) { TimeSpan time = DateTime.Now.Subtract(item.Start.Value); item.TimeProcess = time.Hours + "<span class=\"blue\">'</span> " + time.Minutes + "<span class=\"blue\">\"</span>"; item.StartStr = (item.Start.Value.Hour > 9 ? item.Start.Value.Hour.ToString() : ("0" + item.Start.Value.Hour)) + "<span class=\"blue\"> : </span> " + (item.Start.Value.Minute > 9 ? item.Start.Value.Minute.ToString() : ("0" + item.Start.Value.Minute)); } else { item.TimeProcess = "0"; item.StartStr = "0"; } } } db.SaveChanges(); } } catch (Exception) { } return(dayInfo); }
public int CheckInfo(Login obj, int stt, int current) { db = new QMSEntities(); int retun = 0; var now = DateTime.Now; var last = db.XULYYCs.OrderByDescending(x => x.STT).FirstOrDefault(); if (last != null) { var counterSof = db.CounterSofts.FirstOrDefault(x => x.CounterSoftId == obj.iCounterId); if (counterSof != null) { var currentXLYC = db.XULYYCs.FirstOrDefault(x => x.MANV == obj.iStaffId && x.MATB == obj.iCounterId && x.MATT == eStatus.Procesing && x.GLAYPHIEU.Value.Day == now.Day && x.GLAYPHIEU.Value.Month == now.Month && x.GLAYPHIEU.Value.Year == now.Year); counterSof.Result = currentXLYC != null?currentXLYC.MAPHIEU.Value.ToString() : "0"; //if ((last.STT > stt || current != Convert.ToInt32(counterSof.Result) || (currentXLYC != null && currentXLYC.MAPHIEU != current))) //{ // var NghiepVuIds = db.NV_NGHIEPVU.Where(x => x.MANV == obj.iStaffId).ToList().Select(x => Convert.ToInt32(x.MANVU)).ToList(); // if (NghiepVuIds != null) // { // if (currentXLYC != null) // //var XLYCs = db.XULYYCs.Where(x => x.MANVU != null && NghiepVuIds.Contains(x.MANVU.Value) && x.MATT == eStatus.Waiting).ToList(); // //counterSof.WaitingList = ""; // //counterSof.GeneralWaitingList = ""; // //if (XLYCs.Count > 0) // // for (int i = 0; i < XLYCs.Count; i++) // // { // // counterSof.WaitingList += XLYCs[i].MAPHIEU.Value.ToString(); // // counterSof.GeneralWaitingList += XLYCs[i].MAPHIEU.Value.ToString(); // // if (i < (XLYCs.Count - 1)) // // { // // counterSof.WaitingList += " "; // // counterSof.GeneralWaitingList += " "; // // } // // } // } //} //else // counterSof.Result = "0"; var generals = db.XULYYCs.Where(x => x.MATT == eStatus.Waiting && x.GLAYPHIEU.Value.Day == now.Day && x.GLAYPHIEU.Value.Month == now.Month && x.GLAYPHIEU.Value.Year == now.Year).ToList(); if (generals.Count() > 0) { string gen = "", only = ""; XULYYC temp; var NghiepVuIds = db.NV_NGHIEPVU.Where(x => x.MANV == obj.iStaffId).ToList().Select(x => Convert.ToInt32(x.MANVU)).ToList(); for (int i = 0; i < generals.Count; i++) { if (!gen.Contains(generals[i].MAPHIEU.ToString())) { gen += generals[i].MAPHIEU; } if (NghiepVuIds.Contains(generals[i].MANVU.Value) && !only.Contains(generals[i].MAPHIEU.ToString())) { only += generals[i].MAPHIEU; } if (i < generals.Count - 1) { gen += " "; only += " "; } } counterSof.GeneralWaitingList = gen; counterSof.WaitingList = only; } else { counterSof.GeneralWaitingList = "0"; counterSof.WaitingList = "0"; } counterSof.TotalDone = db.XULYYCs.Where(x => x.MATB != null && x.MANV != null && x.MATB.Value == obj.iCounterId && x.MANV.Value == obj.iStaffId && x.MATT == eStatus.Done && x.GLAYPHIEU.Value.Day == now.Day && x.GLAYPHIEU.Value.Month == now.Month && x.GLAYPHIEU.Value.Year == now.Year).Count(); counterSof.UpdateTime = DateTime.Now; db.SaveChanges(); } retun = (int)last.STT; } return(retun); }
public ResponseBase CreateOrUpdate(NHANVIEN nv) { try { db = new QMSEntities(); var result = new GPRO_QMS_Web.Models.ResponseBase(); bool flag = false; if (CheckExists(nv.TENNV, nv.MANV)) { result.IsSuccess = false; result.Errors.Add(new Error() { MemberName = "Insert", Message = "Tên Nhân Viên này đã được sử dụng. Vui lòng nhập Tên khác !." }); flag = true; } if (!flag) { if (nv.MANV == 0) { int manv = db.NHANVIENs.Count() + 1; var obj = db.NHANVIENs.FirstOrDefault(x => x.MANV == (Int16)manv); //Int16 == short int while ((obj != null)) { manv++; obj = db.NHANVIENs.FirstOrDefault(x => x.MANV == (Int16)manv); } nv.MANV = (Int16)manv; db.NHANVIENs.Add(nv); db.SaveChanges(); } else { NHANVIEN nhanvien = db.NHANVIENs.FirstOrDefault(m => m.MANV == nv.MANV); if (nhanvien == null) { result.IsSuccess = false; result.Errors.Add(new Error() { MemberName = "Update", Message = "Dữ liệu bạn đang thao tác đã bị xóa hoặc không tồn tại. Vui lòng kiểm tra lại !." }); return(result); } else { nhanvien.MANV = nv.MANV; nhanvien.TENNV = nv.TENNV; nhanvien.DIACHI = nv.DIACHI; nhanvien.GIOITINH = nv.GIOITINH; nhanvien.TROGIUP = nv.TROGIUP; nhanvien.USERNAME = nv.USERNAME; nhanvien.PASSWORD = nv.PASSWORD; nhanvien.Hinh = nv.Hinh; nhanvien.ChucVu = nv.ChucVu; nhanvien.QTCongTac = nv.QTCongTac; nhanvien.ChuyenMon = nv.ChuyenMon; db.SaveChanges(); } } result.IsSuccess = true; } return(result); } catch (Exception ex) { throw ex; } }
public ResponseBase Evaluate(string username, string value, int num, string isUseQMS) { var rs = new ResponseBase(); try { db = new QMSEntities(); var user = db.NHANVIENs.FirstOrDefault(x => x.USERNAME.Trim().ToUpper().Equals(username.Trim().ToUpper())); Q_UserEvaluate newObj; var now = DateTime.Now; if (isUseQMS == "1") { #region var ticketInfos = db.XULYYCs.Where(x => x.MAPHIEU == num && x.NHANVIEN.USERNAME.Trim().ToUpper().Equals(username.Trim().ToUpper()) && (x.MATT == eStatusName.Rating || x.MATT == eStatusName.Processing)).ToList(); if (ticketInfos.Count > 0 && user != null) { var firstObj = ticketInfos.FirstOrDefault(); var obj = db.Q_UserEvaluate.FirstOrDefault(x => x.UserId == user.MANV && x.TicketNumber == num && x.GLAYPHIEU == firstObj.GLAYPHIEU); if (obj == null) { newObj = new Q_UserEvaluate(); newObj.UserId = user.MANV; newObj.TicketNumber = num; newObj.Score = value; newObj.GLAYPHIEU = firstObj.GLAYPHIEU; newObj.GDENQUAY = firstObj.GDENQUAY; newObj.GGIAODICH = firstObj.GGIAODICH; newObj.GKETTHUC = firstObj.GKETTHUC; db.Q_UserEvaluate.Add(newObj); //var findButton = db.Q_CallButtonNext.FirstOrDefault(x => x.CounterId == ticketInfo.MATB.Value && x.UserId == ticketInfo.MANV); //if (findButton != null) // findButton.IsClick = true; //else //{ // findButton = new Q_CallButtonNext(); // findButton.UserId = ticketInfo.MANV.Value; // findButton.CounterId = ticketInfo.MATB.Value; // findButton.IsClick = true; // db.Q_CallButtonNext.Add(findButton); //} } foreach (var item in ticketInfos) { item.MATT = eStatusName.Done; item.GKETTHUC = now; } if (ticketInfos.Count > 0) { var yc = db.YEUCAUs.FirstOrDefault(x => x.MAPHIEU == num); if (yc != null) { yc.MATT = eStatusName.Done; } } db.SaveChanges(); rs.IsSuccess = true; } #endregion } else { newObj = new Q_UserEvaluate(); newObj.GKETTHUC = now; newObj.UserId = user.MANV; newObj.TicketNumber = 0; newObj.Score = value; db.Q_UserEvaluate.Add(newObj); db.SaveChanges(); rs.IsSuccess = true; } } catch { } return(rs); }