Ejemplo n.º 1
0
 public ActionResult TestAddRepair(BookingRepairViewModel model, FormCollection COLLECTION)
 {
     if (!ModelState.IsValid)
     {
     }
     return(View());
 }
Ejemplo n.º 2
0
        public ActionResult Index(BookingRepairViewModel model)
        {
            if (ModelState.IsValid)
            {
                foreach (string file in Request.Files)
                {
                    var hpf = Request.Files[file] as HttpPostedFileBase;
                    if (hpf.ContentLength == 0)
                    {
                        continue;
                    }

                    string path          = string.Format("/Content/uploads/{0}", Path.GetFileName(hpf.FileName));
                    string savedFileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory + path);
                    model.ApplicationSetting.sLogoUrl = Url.Content(path);

                    hpf.SaveAs(savedFileName);
                }
                ApplicationSettingManager.Save(model.ApplicationSetting);

                ModelState.AddModelError("ApplicationSetting", "success.");
            }
            else
            {
                ModelState.AddModelError("ApplicationSetting", "failed.");
            }

            return(View(model));
        }
Ejemplo n.º 3
0
 public ActionResult Confirm(BookingRepairViewModel model, FormCollection COLLECTION)
 {
     if (!ModelState.IsValid)
     {
         return(View());
     }
     return(PartialView(model));
 }
Ejemplo n.º 4
0
        public ActionResult Index()
        {
            ViewBag.Setting = "first active";

            BookingRepairViewModel model = new BookingRepairViewModel();

            return(View(model));
        }
Ejemplo n.º 5
0
        public ActionResult Index()
        {
            ViewBag.Setting = "first active";

            ViewBag.ClientName = User.Identity.Name;

            BookingRepairViewModel model = new BookingRepairViewModel();

            return(View(model));
        }
Ejemplo n.º 6
0
        public ActionResult UserPassword()
        {
            ViewBag.Setting = "first active";

            BookingRepairViewModel model = new BookingRepairViewModel();

            Guid id = (Guid)Membership.GetUser().ProviderUserKey;

            var users = StaffUserManager.GetUser(id);

            if (users != null)
            {
                model.User = new UserProfileChangePasswordModel
                {
                    UserName = users[0].Username
                };
            }

            return(View(model));
        }
Ejemplo n.º 7
0
        public ActionResult Error()
        {
            BookingRepairViewModel model = new BookingRepairViewModel();

            return(View("Error", model));
        }
Ejemplo n.º 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!this.IsPostBack)
                {
                    model = (BookingRepairViewModel)System.Web.HttpContext.Current.Session["BookingViewModel"];

                    if (model != null)
                    {
                        runRptViewer();

                        #region Application Setting
                        //ReportParameter ApplicationLogo;
                        ReportParameter ApplicationSettingName;
                        ReportParameter ApplicationSettingAddress;
                        ReportParameter ApplicationTel;
                        ReportParameter ApplicationFax;
                        if (model.ApplicationSetting != null)
                        {
                            //if (!String.IsNullOrEmpty(model.ApplicationSetting.sApplicationName))
                            //{
                            //    ApplicationLogo = new ReportParameter("ApplicationLogo", model.ApplicationSetting.sLogoUrl);
                            //}
                            //else
                            //{
                            //    ApplicationLogo = new ReportParameter("ApplicationLogo", "");
                            //}

                            if (!String.IsNullOrEmpty(model.ApplicationSetting.sApplicationName))
                            {
                                ApplicationSettingName = new ReportParameter("ApplicationSettingName", model.ApplicationSetting.sApplicationName);
                            }
                            else
                            {
                                ApplicationSettingName = new ReportParameter("ApplicationSettingName", "-");
                            }

                            if (!String.IsNullOrEmpty(model.ApplicationSetting.vApplicationAddress))
                            {
                                ApplicationSettingAddress = new ReportParameter("ApplicationSettingAddress", model.ApplicationSetting.vApplicationAddress);
                            }
                            else
                            {
                                ApplicationSettingAddress = new ReportParameter("ApplicationSettingAddress", "-");
                            }


                            if (!String.IsNullOrEmpty(model.ApplicationSetting.sPhone))
                            {
                                ApplicationTel = new ReportParameter("ApplicationTel", model.ApplicationSetting.sPhone);
                            }
                            else
                            {
                                ApplicationTel = new ReportParameter("ApplicationTel", "-");
                            }

                            if (!String.IsNullOrEmpty(model.ApplicationSetting.sFax))
                            {
                                ApplicationFax = new ReportParameter("ApplicationFax", model.ApplicationSetting.sFax);
                            }
                            else
                            {
                                ApplicationFax = new ReportParameter("ApplicationFax", "-");
                            }
                        }
                        else
                        {
                            ApplicationSettingName    = new ReportParameter("ApplicationSettingName", "-");
                            ApplicationSettingAddress = new ReportParameter("ApplicationSettingAddress", "-");
                            ApplicationTel            = new ReportParameter("ApplicationTel", "-");
                            ApplicationFax            = new ReportParameter("ApplicationFax", "-");
                        }
                        #endregion

                        #region Customer

                        ReportParameter CustomerName;
                        ReportParameter CustomerMobile;
                        ReportParameter CustomerPhone;
                        if (model.Customer != null)
                        {
                            if (!String.IsNullOrEmpty(model.Customer.sCustomerName))
                            {
                                CustomerName = new ReportParameter("CustomerName", model.Customer.sCustomerName);
                            }
                            else
                            {
                                CustomerName = new ReportParameter("CustomerName", "-");
                            }

                            if (!String.IsNullOrEmpty(model.Customer.sMobile))
                            {
                                CustomerMobile = new ReportParameter("CustomerMobile", model.Customer.sMobile);
                            }
                            else
                            {
                                CustomerMobile = new ReportParameter("CustomerMobile", "-");
                            }

                            if (!String.IsNullOrEmpty(model.Customer.sPhone))
                            {
                                CustomerPhone = new ReportParameter("CustomerPhone", model.Customer.sPhone);
                            }
                            else
                            {
                                CustomerPhone = new ReportParameter("CustomerPhone", "-");
                            }
                        }
                        else
                        {
                            CustomerName   = new ReportParameter("CustomerName", "-");
                            CustomerMobile = new ReportParameter("CustomerMobile", "-");
                            CustomerPhone  = new ReportParameter("CustomerPhone", "-");
                        }
                        #endregion

                        #region Product

                        ReportParameter ProductType;
                        ReportParameter ProductBrand;
                        ReportParameter ProductModel;


                        if (model.Product != null)
                        {
                            if (!String.IsNullOrEmpty(model.Product.vProductTypeDescription))
                            {
                                ProductType = new ReportParameter("ProductType", model.Product.vProductTypeDescription);
                            }
                            else
                            {
                                ProductType = new ReportParameter("ProductType", "-");
                            }

                            if (!String.IsNullOrEmpty(model.Product.vBrandDescription))
                            {
                                ProductBrand = new ReportParameter("ProductBrand", model.Product.vBrandDescription);
                            }
                            else
                            {
                                ProductBrand = new ReportParameter("ProductBrand", "-");
                            }

                            if (!String.IsNullOrEmpty(model.Product.sProductModel))
                            {
                                ProductModel = new ReportParameter("ProductModel", model.Product.sProductModel);
                            }
                            else
                            {
                                ProductModel = new ReportParameter("ProductModel", "-");
                            }
                        }
                        else
                        {
                            ProductType  = new ReportParameter("ProductType", "-");
                            ProductBrand = new ReportParameter("ProductBrand", "-");
                            ProductModel = new ReportParameter("ProductModel", "-");
                        }
                        #endregion

                        #region Repair
                        ReportParameter ReferenceNumber;
                        ReportParameter DateAdd;
                        ReportParameter TimeAdd;
                        ReportParameter Serial;
                        ReportParameter ProductAccessories;
                        ReportParameter ProductColor;
                        ReportParameter DayWarranty;


                        if (model.Repair != null)
                        {
                            if (!String.IsNullOrEmpty(model.Repair.sRepairNo))
                            {
                                ReferenceNumber = new ReportParameter("ReferenceNumber", model.Repair.sRepairNo);
                            }
                            else
                            {
                                ReferenceNumber = new ReportParameter("ReferenceNumber", "-");
                            }

                            if (model.Repair.dtDateAdd.HasValue)
                            {
                                DateAdd = new ReportParameter("DateAdd", DateExtension.DateThaiFormat(model.Repair.dtDateAdd.Value));
                            }
                            else
                            {
                                DateAdd = new ReportParameter("DateAdd", "-");
                            }

                            if (model.Repair.dtDateAdd.HasValue)
                            {
                                TimeAdd = new ReportParameter("TimeAdd", DateTime.Now.ToString(DateExtension.TimeFormat()));
                            }
                            else
                            {
                                TimeAdd = new ReportParameter("TimeAdd", "-");
                            }

                            if (!String.IsNullOrEmpty(model.Repair.sSerial))
                            {
                                Serial = new ReportParameter("Serial", model.Repair.sSerial);
                            }
                            else
                            {
                                Serial = new ReportParameter("Serial", "-");
                            }

                            if (!String.IsNullOrEmpty(model.Repair.sProductAccessories))
                            {
                                ProductAccessories = new ReportParameter("ProductAccessories", model.Repair.sProductAccessories);
                            }
                            else
                            {
                                ProductAccessories = new ReportParameter("ProductAccessories", "-");
                            }

                            if (!String.IsNullOrEmpty(model.Repair.sColor))
                            {
                                ProductColor = new ReportParameter("ProductColor", model.Repair.sColor);
                            }
                            else
                            {
                                ProductColor = new ReportParameter("ProductColor", "-");
                            }

                            if (model.Repair.iDayWarranty.HasValue)
                            {
                                DayWarranty = new ReportParameter("DayWarranty", model.Repair.iDayWarranty.ToString());
                            }
                            else
                            {
                                DayWarranty = new ReportParameter("DayWarranty", "-");
                            }
                        }
                        else
                        {
                            ReferenceNumber    = new ReportParameter("ReferenceNumber", "-");
                            DateAdd            = new ReportParameter("DateAdd", "-");
                            TimeAdd            = new ReportParameter("TimeAdd", "-");
                            Serial             = new ReportParameter("Serial", "-");
                            ProductAccessories = new ReportParameter("ProductAccessories", "-");
                            ProductColor       = new ReportParameter("ProductColor", "-");
                            DayWarranty        = new ReportParameter("DayWarranty", "-");
                        }

                        #endregion

                        ReportParameter InsuranceExpire;
                        if (model.Repair.dtInsuranceExpire != null)
                        {
                            if (model.Repair.dtInsuranceExpire.HasValue)
                            {
                                InsuranceExpire = new ReportParameter("InsuranceExpire", DateExtension.DateThaiFormat(model.Repair.dtInsuranceExpire.Value));
                            }
                            else
                            {
                                InsuranceExpire = new ReportParameter("InsuranceExpire", "-");
                            }
                        }
                        else
                        {
                            InsuranceExpire = new ReportParameter("InsuranceExpire", "-");
                        }

                        ReportParameter DueDate;
                        if (model.Repair.dtDueDate != null)
                        {
                            if (model.Repair.dtDueDate.HasValue)
                            {
                                DueDate = new ReportParameter("DueDate", DateExtension.DateThaiFormat(model.Repair.dtDueDate.Value));
                            }
                            else
                            {
                                DueDate = new ReportParameter("DueDate", "-");
                            }
                        }
                        else
                        {
                            DueDate = new ReportParameter("DueDate", "-");
                        }

                        ReportViewer1.LocalReport.SetParameters(new ReportParameter[] {
                            ApplicationSettingName,
                            ApplicationSettingAddress,
                            CustomerName,
                            CustomerMobile,
                            CustomerPhone,
                            ProductType,
                            ProductBrand,
                            ReferenceNumber,
                            DateAdd,
                            TimeAdd,
                            ApplicationTel,
                            ProductModel,
                            Serial,
                            InsuranceExpire,
                            ProductAccessories,
                            ProductColor,
                            DayWarranty,
                            DueDate,
                            ApplicationFax
                        });
                        Session["BookingViewModel"] = null;
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }