Example #1
0
        public ActionResult Create(CRMPriceQuotationModel model)
        {
            if (model.CrmCusId > 0)
            {
                model.CrmCusName = "forcust";
            }
            GetBaseData();
            if (!ModelState.IsValid)
            {
                crmCustomer = crmCustomer ?? crmCustomerService.GetModelById(model.CrmCusId);

                var value = new
                {
                    Views       = this.RenderPartialView("_Create", model),
                    ColumnClass = "col-md-11",
                    Title       = string.Format(@"{0}", "Tạo báo giá cho khách hàng " + crmCustomer.CompanyShortName),
                };
                return(JsonResult(value, true));
            }
            model.CreatedBy   = CurrenUser;
            model.CreatedDate = DateTime.Now;
            var id     = priceQuotationService.InsertModel(model);
            var result = new CommandResult(true)
            {
                ErrorResults = new[] { "Tạo báo giá thành công" }
            };

            return(JsonResult(result, null, true));
        }
Example #2
0
        public ActionResult Create(long refId)
        {
            crmCustomer = crmCustomer ?? crmCustomerService.GetModelById(refId);
            var model = new CRMPriceQuotationModel {
                StatusId = (int)CRMPriceStaus.Following, CrmCusId = refId, IsCusCreate = refId > 0
            };

            if (model.IsCusCreate)
            {
                model.CrmCusName = "fromCus";
            }
            GetBaseData();
            var value = new
            {
                Views = this.RenderPartialView("_Create", model),
                Title = string.Format(@"{0}", "Tạo báo giá cho khách hàng " + crmCustomer.CompanyShortName),
            };

            return(JsonResult(value, true));
        }
Example #3
0
        public ActionResult Edit(CRMPriceQuotationModel model)
        {
            GetBaseData();
            if (!ModelState.IsValid)
            {
                crmCustomer = crmCustomer ?? crmCustomerService.GetModelById(model.CrmCusId);
                var value = new
                {
                    Views       = this.RenderPartialView("_Edit", model),
                    ColumnClass = "col-md-11",
                    Title       = string.Format(@"{0}", "Sữa báo giá khách hàng " + crmCustomer.CompanyShortName),
                };
                return(JsonResult(value, true));
            }
            model.ModifiedBy   = CurrenUser;
            model.ModifiedDate = DateTime.Now;
            priceQuotationService.UpdateModel(model);
            var result = new CommandResult(true)
            {
                ErrorResults = new[] { "sữa báo giá thành công" }
            };

            return(JsonResult(result));
        }