Exemplo n.º 1
0
        public ActionResult Book_App_Customer(AppointmentModel Model)
        {
            Boolean New = (Request.Form).AllKeys[(Request.Form).AllKeys.GetUpperBound(0)].Trim() == "savenew" ? true : false;

            try
            {
                if (Model.CUSTOMER_SEQ_ID > 0)
                {
                    CustomerModel subModel = new CustomerModel();
                    subModel.SEQ_ID            = Model.CUSTOMER_SEQ_ID;
                    subModel                   = new Brill.Helper().SelectModelFromDatabase(subModel);
                    Model.FIRST_NAME           = subModel.FIRST_NAME;
                    Model.LAST_NAME            = subModel.LAST_NAME;
                    Model.MOBILE_NO            = subModel.MOBILE_NO;
                    Model.PAYMENT_MODE_SEQ_ID  = subModel.PAYMENT_MODE_SEQ_ID;
                    Model.CUSTOMER_TYPE_SEQ_ID = subModel.CUSTOMER_TYPE_SEQ_ID;
                }
                else
                {
                    CustomerModel subModel = new CustomerModel();
                    subModel.FIRST_NAME           = Model.FIRST_NAME;
                    subModel.LAST_NAME            = Model.LAST_NAME;
                    subModel.MOBILE_NO            = Model.MOBILE_NO;
                    subModel.PAYMENT_MODE_SEQ_ID  = Model.PAYMENT_MODE_SEQ_ID;
                    subModel.CUSTOMER_TYPE_SEQ_ID = Model.CUSTOMER_TYPE_SEQ_ID;
                    subModel.CREATED_BY           = Convert.ToInt32(Session["USERID"]);
                    subModel.CREATED_ON           = DateTime.Now;

                    Model.CUSTOMER_SEQ_ID = new Brill.Helper().InsertModelInDatabase(subModel);
                }

                if (Model.SEQ_ID > 0)
                {
                    Model.MODIFIED_BY = Convert.ToInt32(Session["USERID"]);
                    Model.MODIFIED_ON = DateTime.Now;
                    new Brill.Helper().UpdateModelInDatabase(Model);
                }
                else
                {
                    Model.CREATED_BY = Convert.ToInt32(Session["USERID"]);
                    Model.CREATED_ON = DateTime.Now;
                    Model.SEQ_ID     = new Brill.Helper().InsertModelInDatabase(Model);
                }

                if (New)
                {
                    return(RedirectToAction("Book_App_Location", "Appointment", new { ID = Model.SEQ_ID }));
                }
                else
                {
                    return(RedirectToAction("Dashboard", "Admin"));
                }
            }
            catch (Exception ex)
            {
                Helper();
                ViewBag.Message = ex.InnerException;
                return(View(Model));
            }
        }
Exemplo n.º 2
0
        public static int GetValue(string LookUpName)
        {
            LookupModel Model = new LookupModel();

            Model.ATTR_NAME = LookUpName;
            Model           = new Brill.Helper().SelectModelFromDatabase(Model);
            return(Model.SEQ_ID);
        }
Exemplo n.º 3
0
        public ActionResult Index()
        {
            CustomerModel        Model     = new CustomerModel();
            List <CustomerModel> ModelList = new Brill.Helper().SelectModelListFromDatabase(Model);

            Helper();
            return(View(ModelList));
        }
Exemplo n.º 4
0
        public static List <DropDownModel> GetDropDownValues(int LOOKUP_ID)
        {
            DropDownModel Model = new DropDownModel();

            Model.LOOKUP_SEQ_ID = LOOKUP_ID;
            List <DropDownModel> ModelList = new Brill.Helper().SelectModelListFromDatabase(Model);

            return(ModelList);
        }
Exemplo n.º 5
0
        public ActionResult Index()
        {
            DriverModel Model = new DriverModel();

            Model.ACTIVE = true;
            List <DriverModel> ModelList = new Brill.Helper().SelectModelListFromDatabase(Model);

            Helper();
            return(View(ModelList));
        }
Exemplo n.º 6
0
        public ActionResult COMPLETED(string ID)
        {
            AppointmentModel Model = new AppointmentModel();

            Model.SEQ_ID        = Convert.ToInt32(ID);
            Model               = new Brill.Helper().SelectModelFromDatabase(Model);
            Model.STATUS_SEQ_ID = 21;
            new Brill.Helper().UpdateModelInDatabase(Model);
            return(Redirect(Request.UrlReferrer.AbsoluteUri.ToString()));
        }
Exemplo n.º 7
0
        public ActionResult WebPage(string ID = null)
        {
            DriverModel Model = new DriverModel();

            if (!string.IsNullOrEmpty(ID))
            {
                Model.SEQ_ID = Convert.ToInt32(ID);
                Model        = new Brill.Helper().SelectModelFromDatabase(Model);
            }
            Helper();
            return(View(Model));
        }
Exemplo n.º 8
0
        public ActionResult Book_App_Customer(string ID = null)
        {
            AppointmentModel Model = new AppointmentModel();

            if (!string.IsNullOrEmpty(ID))
            {
                Model.SEQ_ID = Convert.ToInt32(ID);
                Model        = new Brill.Helper().SelectModelFromDatabase(Model);
            }
            Helper();
            return(View(Model));
        }
Exemplo n.º 9
0
        void GetCustomers()
        {
            Dictionary <string, string> List = new Dictionary <string, string>();
            CustomerModel        Model       = new CustomerModel();
            List <CustomerModel> ModelList   = new Brill.Helper().SelectModelListFromDatabase(Model);

            foreach (CustomerModel m in ModelList)
            {
                List.Add(m.SEQ_ID.ToString(), m.CODE + " | " + m.FIRST_NAME + " " + m.LAST_NAME);
            }
            ViewData["CustomerList"] = new SelectList(List, "Key", "Value");
        }
Exemplo n.º 10
0
        void GetCars()
        {
            Dictionary <string, string> List = new Dictionary <string, string>();
            VehicleModel Model = new VehicleModel();

            Model.ACTIVE = true;
            List <VehicleModel> ModelList = new Brill.Helper().SelectModelListFromDatabase(Model);

            foreach (VehicleModel m in ModelList)
            {
                List.Add(m.SEQ_ID.ToString(), m.DESCRIPTION);
            }
            ViewData["CarList"] = new SelectList(List, "Key", "Value");
        }
Exemplo n.º 11
0
        void GetDrivers()
        {
            Dictionary <string, string> List = new Dictionary <string, string>();
            DriverModel Model = new DriverModel();

            Model.ACTIVE = true;
            List <DriverModel> ModelList = new Brill.Helper().SelectModelListFromDatabase(Model);

            foreach (DriverModel m in ModelList)
            {
                List.Add(m.SEQ_ID.ToString(), m.FIRST_NAME + " " + m.LAST_NAME);
            }
            ViewData["DriverList"] = new SelectList(List, "Key", "Value");
        }
Exemplo n.º 12
0
        public JsonResult FetchCustomerData(string sID = null, string sMobile = null, string sFirstName = null, string sLastName = null)
        {
            CustomerModel Model = new CustomerModel();

            if (!string.IsNullOrEmpty(sID))
            {
                Model.SEQ_ID = Convert.ToInt32(sID);
                Model        = new Brill.Helper().SelectModelFromDatabase(Model);
            }
            else if (!string.IsNullOrEmpty(sMobile))
            {
                Model.MOBILE_NO = sMobile.Trim();
                Model           = new Brill.Helper().SelectModelFromDatabase(Model);
            }
            else if (!string.IsNullOrEmpty(sFirstName) && !string.IsNullOrEmpty(sLastName))
            {
                Model.FIRST_NAME = sFirstName.Trim();
                Model.LAST_NAME  = sLastName.Trim();
                Model            = new Brill.Helper().SelectModelFromDatabase(Model);
            }
            else if (!string.IsNullOrEmpty(sFirstName))
            {
                Model.FIRST_NAME = sFirstName.Trim();
                Model            = new Brill.Helper().SelectModelFromDatabase(Model);
            }
            else if (!string.IsNullOrEmpty(sLastName))
            {
                Model.LAST_NAME = sLastName.Trim();
                Model           = new Brill.Helper().SelectModelFromDatabase(Model);
            }
            else
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }

            //Session["FIRST_NAME"] = Model.FIRST_NAME;
            //Session["LAST_NAME"] = Model.LAST_NAME;
            //Session["MOBILE_NO"] = Model.MOBILE_NO;
            //Session["CUSTOMER_TYPE_SEQ_ID"] = Model.CUSTOMER_TYPE_SEQ_ID;
            //Session["PAYMENT_MODE_SEQ_ID"] = Model.PAYMENT_MODE_SEQ_ID;

            return(Json(Model, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 13
0
        public ActionResult Book_App_Fare(string ID)
        {
            AppointmentModel Model = new AppointmentModel();

            if (!string.IsNullOrEmpty(ID))
            {
                Model.SEQ_ID = Convert.ToInt32(ID);
                Model        = new Brill.Helper().SelectModelFromDatabase(Model);

                VehicleModel VehicleModel = new VehicleModel();
                VehicleModel.SEQ_ID = Model.CAR_SEQ_ID;
                VehicleModel        = new Brill.Helper().SelectModelFromDatabase(VehicleModel);
                Model.FARE          = CalculateFare(Model.DISTANCE, VehicleModel.BASICFARE, VehicleModel.ADDITIONALKMFARE);
                Model.OTHER_CHARGES = string.IsNullOrEmpty(Model.OTHER_CHARGES) ? "0.0" : Model.OTHER_CHARGES;
                Model.TOTAL_AMOUNT  = Convert.ToString(Convert.ToDouble(Model.FARE) + Convert.ToDouble(Model.OTHER_CHARGES));
            }
            Helper();
            return(View(Model));
        }
Exemplo n.º 14
0
        public ActionResult Dashboard(string Filter = null, int D = 0)
        {
            AppointmentModel        Model     = new AppointmentModel();
            List <AppointmentModel> ModelList = new List <AppointmentModel>();

            if (Filter == null)
            {
                ModelList.AddRange(new Brill.Helper().SelectModelListFromDatabase(Model));

                Model.LUGGAGE         = true;
                Model.WAIT_AND_RETURN = true;

                ModelList.AddRange(new Brill.Helper().SelectModelListFromDatabase(Model));

                ModelList = ModelList.OrderByDescending(s => s.DATE).ToList();
                Helper();
                return(View(ModelList));
            }
            else if (Filter == "Unassigned")
            {
                ModelList = new Brill.Helper().SelectModelListFromDatabase(Model);
                if (D == 1)
                {
                    ModelList = ModelList.Where(s => s.DRIVER_SEQ_ID == 0 && s.DATE == DateTime.Now.Date).ToList();
                }
                else
                {
                    ModelList = ModelList.Where(s => s.DRIVER_SEQ_ID == 0).ToList();
                }
                Helper();
                return(View(ModelList));
            }

            switch (Filter)
            {
            case "TodaysAppointments":
                Model.DATE = DateTime.Now.Date;
                break;

            case "ReadyforDispatch":
                Model.STATUS_SEQ_ID = 23;
                if (D == 1)
                {
                    Model.DATE = DateTime.Now.Date;
                }
                break;

            case "Dispatched":
                Model.STATUS_SEQ_ID = 22;
                if (D == 1)
                {
                    Model.DATE = DateTime.Now.Date;
                }
                break;

            case "Completed":
                Model.STATUS_SEQ_ID = 21;
                if (D == 1)
                {
                    Model.DATE = DateTime.Now.Date;
                }
                break;

            case "Cancelled":
                Model.STATUS_SEQ_ID = 20;
                if (D == 1)
                {
                    Model.DATE = DateTime.Now.Date;
                }
                break;

            default:
                break;
            }

            ModelList = new Brill.Helper().SelectModelListFromDatabase(Model);
            Helper();
            return(View(ModelList));
        }