public bool updateAppointment(APPOINTMENT updateApp) { bool ret = false; try { var result = UShopDB.APPOINTMENTs.Where(o => o.APP_ID == updateApp.APP_ID); APPOINTMENT app = result.SingleOrDefault(); app.APP_DATE = updateApp.APP_DATE; app.CREATED_DATE = updateApp.CREATED_DATE; app.CUS_ID = updateApp.CUS_ID; app.DESCRIPTION = updateApp.DESCRIPTION; app.NOTE = updateApp.NOTE; app.PREPARER_ID = updateApp.PREPARER_ID; app.RECORD_STATUS = updateApp.RECORD_STATUS; UShopDB.SubmitChanges(); ret = true; } catch (Exception e) { Console.WriteLine(e.Message); } return(ret); }
public async Task <IHttpActionResult> PutAPPOINTMENT(int id, APPOINTMENT aPPOINTMENT) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != aPPOINTMENT.Appointment_ID) { return(BadRequest()); } db.Entry(aPPOINTMENT).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!APPOINTMENTExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult DeleteConfirmed(int id) { APPOINTMENT aPPOINTMENT = db.APPOINTMENTs.Find(id); db.APPOINTMENTs.Remove(aPPOINTMENT); db.SaveChanges(); return(RedirectToAction("Index")); }
// GET: api/APPOINTMENTs/5 public async Task <IHttpActionResult> GetAPPOINTMENT(int id) { APPOINTMENT aPPOINTMENT = await db.APPOINTMENTs.FindAsync(id); if (aPPOINTMENT == null) { return(NotFound()); } return(Ok(aPPOINTMENT)); }
public void InsertOrUpdate(APPOINTMENT rate) { if (rate.APPOINTMENTID == default(int)) // New entity { _context.Entry(rate).State = EntityState.Added; } else // Existing entity { _context.Entry(rate).State = EntityState.Modified; } }
public void InsertOrUpdateGraph(APPOINTMENT userGraph) { if (userGraph.State == DOCVIDEO.ObjectState.State.Added) { _context.APPOINTMENTS.Add(userGraph); } else { _context.APPOINTMENTS.Add(userGraph); _context.ApplyStateChanges(); } }
public ActionResult Edit([Bind(Include = "IDAppoint,IDClientAppoint,IDStypeAppoint,DateAppoint,AddTakeOffAppoint,BeginnTimeAppoint")] APPOINTMENT aPPOINTMENT) { if (ModelState.IsValid) { db.Entry(aPPOINTMENT).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.IDClientAppoint = new SelectList(db.CLIENTs, "IDClient", "FnameClient", aPPOINTMENT.IDClientAppoint); ViewBag.IDStypeAppoint = new SelectList(db.STYLEs, "IDStyle", "DesigStyle", aPPOINTMENT.IDStypeAppoint); return(View(aPPOINTMENT)); }
public async Task <IHttpActionResult> DeleteAPPOINTMENT(int id) { APPOINTMENT aPPOINTMENT = await db.APPOINTMENTs.FindAsync(id); if (aPPOINTMENT == null) { return(NotFound()); } db.APPOINTMENTs.Remove(aPPOINTMENT); await db.SaveChangesAsync(); return(Ok(aPPOINTMENT)); }
// GET: APPOINTMENTs/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } APPOINTMENT aPPOINTMENT = db.APPOINTMENTs.Find(id); if (aPPOINTMENT == null) { return(HttpNotFound()); } return(View(aPPOINTMENT)); }
public APPOINTMENT getAppointmentBy(string appCode, RECORD_STATUS status) { APPOINTMENT app = null; try { app = UShopDB.APPOINTMENTs.Where(o => o.APP_CODE.Equals(appCode) && o.RECORD_STATUS.Equals(((char)status) + "") ).SingleOrDefault(); } catch (Exception e) { Console.WriteLine(e.Message); } return(app); }
// GET: APPOINTMENTs/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } APPOINTMENT aPPOINTMENT = db.APPOINTMENTs.Find(id); if (aPPOINTMENT == null) { return(HttpNotFound()); } ViewBag.IDClientAppoint = new SelectList(db.CLIENTs, "IDClient", "FnameClient", aPPOINTMENT.IDClientAppoint); ViewBag.IDStypeAppoint = new SelectList(db.STYLEs, "IDStyle", "DesigStyle", aPPOINTMENT.IDStypeAppoint); return(View(aPPOINTMENT)); }
public void loadExistedAppointment(string appCode) { app = model.getAppointmentBy(appCode, RECORD_STATUS.ACTIVE); if (app != null) { CUSTOMER cus = findCustomerInListBy((int)app.CUS_ID); String cusCodeName = cus.CUS_CODE + "-" + cus.CUS_NAME; String empName = AccountPresenter.currentEmployee.EMP_NAME; isUpdated = true; appAddingView.showInforComponents(app, cusCodeName, empName); } else { isUpdated = false; } }
public void showInforComponents(APPOINTMENT app, String cusCodeName, String empName) { try { txteAAAppCode.Text = app.APP_CODE; txteAADescription.Text = app.DESCRIPTION; txteAAEmployee.Text = empName; cboxStatus.Text = app.NOTE; cmbAACusId.Text = cusCodeName; dpkAAAppDate.Value = (DateTime)app.APP_DATE; dpkAACreatedDate.Value = (DateTime)app.CREATED_DATE; } catch (Exception e) { Console.WriteLine(e.Message); } }
public bool deleteAppointment(string code) { bool ret = false; try { var result = UShopDB.APPOINTMENTs.Where(o => o.APP_CODE.Equals(code)); APPOINTMENT app = result.SingleOrDefault(); app.RECORD_STATUS = ((char)RECORD_STATUS.INACTIVE) + ""; UShopDB.SubmitChanges(); ret = true; } catch (Exception e) { Console.WriteLine(e.Message); } return(ret); }
public bool addAppointment(APPOINTMENT app) { try { UShopDB.APPOINTMENTs.InsertOnSubmit(app); UShopDB.SubmitChanges(); app.APP_CODE = getCODE("APP", app.APP_ID); UShopDB.SubmitChanges(); return(true); } catch (Exception e) { Console.WriteLine(e.Message); return(false); } }
public async Task <IHttpActionResult> PostAPPOINTMENT(Appointment appointment) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } APPOINTMENT aPPOINTMENT = new APPOINTMENT(); aPPOINTMENT.Appointment_Date = appointment.Appointment_Date; aPPOINTMENT.Appointment_Time = appointment.Appointment_Time; aPPOINTMENT.Dentist_ID = appointment.Dentist_ID; aPPOINTMENT.Patient_ID = appointment.Patient_ID; db.APPOINTMENTs.Add(aPPOINTMENT); await db.SaveChangesAsync(); return(CreatedAtRoute("DefaultApi", new { id = aPPOINTMENT.Appointment_ID }, aPPOINTMENT)); }
public AppoinmentPresenter() { app = new APPOINTMENT(); this.model = new AppointmentModel(); }
public void insertOrUpdateAppointment(string cusCode, DateTime createdDT, DateTime appDT, string description, string note) { String error = ""; try { CUSTOMER currentCus = null; if ((currentCus = checkValidCustomerCode(cusCode)) == null) { error += "Tên khách hàng rỗng hoặc không hợp lệ \n";//"Name is empty or invalid\n"; throw new Exception(); } if (!checkValidContent(description)) { error += "Nội dung rỗng hoặc không hợp lệ \n";//"Name is empty or invalid\n"; throw new Exception(); } /* * if (!checkValidCreatedDate(createdDT)) * { * error += "Ngày lập phiếu không hợp lệ \n";//"Address is empty or invalid\n"; * throw new Exception(); * } * * if (!checkValidAppDate(createdDT,appDT)) * { * error += "Ngày trả phiếu không hợp lệ \n";//"Sev Date is empty or invalid\n"; * throw new Exception(); * } * */ app.CUS_ID = currentCus.CUS_ID; app.PREPARER_ID = AccountPresenter.currentEmployee.EMP_ID; app.CREATED_DATE = createdDT; app.APP_DATE = appDT; app.DESCRIPTION = description; app.NOTE = note; app.RECORD_STATUS = (char)RECORD_STATUS.ACTIVE + ""; if (!isUpdated) { if (model.addAppointment(app)) { appAddingView.showMessageBox(Resources.MB_SUCCESS, MessageBoxIcon.Information); app = new APPOINTMENT(); appAddingView.refreshAll(); } else { appAddingView.showMessageBox(Resources.MB_FAILURE, MessageBoxIcon.Information); } } else { if (model.updateAppointment(app)) { appAddingView.showMessageBox(Resources.MB_SUCCESS, MessageBoxIcon.Information); appAddingView.backPreviousForm(); } else { appAddingView.showMessageBox(Resources.MB_FAILURE, MessageBoxIcon.Information); } } } catch (Exception e) { appAddingView.showMessageBox(error, MessageBoxIcon.Error); } }