Пример #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));
        }
Пример #2
0
        public ActionResult Create(long refId = 0, bool isEventAction = false)
        {
            crmCustomer = crmCustomer ?? crmCustomerService.GetModelById(refId);
            var model = new CRMEventModel()
            {
                DateBegin     = DateTime.Now,
                DateEnd       = DateTime.Now,
                DateEvent     = DateTime.Now,
                Status        = CRMEventStatus.Follow,
                CrmCusId      = refId,
                IsEventAction = isEventAction,
                TimeOfRemider = "9:00",
                FilesList     = new List <ServerFile>()
            };

            model.CheckModels        = LoadCheckModel(model.DayOfWeek);
            ViewData["CRMEventType"] = evetypeService.GetAll();
            if (crmCustomer != null)
            {
                model.CusName = crmCustomer.CompanyShortName;
            }
            var value = new
            {
                Views = this.RenderPartialView("_EditTemplate", model),
                Title = string.Format(@"Tạo {0} {1} ", isEventAction ? "sự kiện" : "viếng thăm", crmCustomer != null ? "cho khách hàng " + crmCustomer.CompanyShortName : ""),
            };

            return(JsonResult(value, true));
        }
Пример #3
0
        public ActionResult ListByCus(long refId)
        {
            var sort     = new SSM.Services.SortField("Subject", true);
            var totalRow = 0;
            var search   = new PriceSearchModel()
            {
                CusId = refId
            };
            IEnumerable <CRMPriceQuotation> customers = priceQuotationService.GetAll(search, sort, out totalRow, 1, 100, CurrenUser);

            crmCustomer = crmCustomer ?? crmCustomerService.GetModelById(refId);
            var value = new
            {
                Views      = this.RenderPartialView("_ListForCus", customers),
                CloseOther = true,
                Title      = string.Format(@"{0}", "List Bao gia cua khách hàng " + crmCustomer.CompanyShortName),
            };

            return(JsonResult(value, true));
        }
Пример #4
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));
        }
Пример #5
0
        public ActionResult Edit(long cusId, long id = 0)
        {
            var model = new CrmCusDocumentModel {
                CrmCusId = cusId, FilesList = new List <ServerFile>()
            };
            var doc = documentService.GetModel(id);

            crmCustomer = crmCustomer ?? crmCustomerService.GetModelById(cusId);
            if (doc != null)
            {
                model           = doc;
                model.FilesList = fileService.GetServerFile(id, new CrmCusDocumentModel().GetType().ToString());
            }
            var value = new
            {
                Views = this.RenderPartialView("_TemplateEditView", model),
                Title = string.Format(@"{0} tài liệu {1} ", id > 0 ? "Sửa " : "Tạo ", crmCustomer.CompanyShortName),
            };

            return(JsonResult(value, true));
        }
Пример #6
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));
        }