Beispiel #1
0
        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));
        }
Beispiel #3
0
        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));
        }
Beispiel #5
0
 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;
     }
 }
Beispiel #6
0
 public void InsertOrUpdateGraph(APPOINTMENT userGraph)
 {
     if (userGraph.State == DOCVIDEO.ObjectState.State.Added)
     {
         _context.APPOINTMENTS.Add(userGraph);
     }
     else
     {
         _context.APPOINTMENTS.Add(userGraph);
         _context.ApplyStateChanges();
     }
 }
Beispiel #7
0
 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));
        }
Beispiel #9
0
        // 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));
        }
Beispiel #10
0
        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);
        }
Beispiel #11
0
        // 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));
        }
Beispiel #12
0
        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;
            }
        }
Beispiel #13
0
        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);
            }
        }
Beispiel #14
0
        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);
        }
Beispiel #15
0
        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));
        }
Beispiel #17
0
 public AppoinmentPresenter()
 {
     app        = new APPOINTMENT();
     this.model = new AppointmentModel();
 }
Beispiel #18
0
        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);
            }
        }