Exemplo n.º 1
0
        public ActionResult EditDesign_ExceptedBuy(Design_CustomerExceptedBuyViewModel model)
        {
            //if (Session["method"].ToString() == "Y")
            //{
            //    string str = string.Format("<script>alert('重复操作!');window.history.go(-1);</script>");
            //    return Content(str);
            //}
            SetEmployee();
            销售_设计案提交表_客户意向产品明细 m = new 销售_设计案提交表_客户意向产品明细();

            m.id     = model.Id;
            m.分类     = model.分类;
            m.单位     = model.单位;
            m.称      = model.称;
            m.品牌     = model.品牌;
            m.尺寸     = model.尺寸;
            m.接待记录ID = design_CustomerExceptedBuyBLL.GetModel(p => p.id == model.Id).接待记录ID;
            m.数量     = model.数量;
            m.更新人    = employeeName;
            m.更新日期   = DateTime.Now;
            m.空间     = model.空间;
            m.系列     = model.系列;
            m.编号     = model.编号;
            m.设计提交案  = design_CustomerExceptedBuyBLL.GetModel(p => p.id == model.Id).设计提交案;
            m.配置     = model.配置;

            if (ModelState.IsValid)
            {
                design_CustomerExceptedBuyBLL.Modify(m);
                Session["method"] = "Y";
            }
            else
            {
                List <string> sb = new List <string>();
                //获取所有错误的Key
                List <string> Keys = ModelState.Keys.ToList();
                //获取每一个key对应的ModelStateDictionary
                foreach (var key in Keys)
                {
                    var errors = ModelState[key].Errors.ToList();
                    //将错误描述添加到sb中
                    foreach (var error in errors)
                    {
                        sb.Add(error.ErrorMessage);
                    }
                }
                string s = null;
                foreach (var item in sb)
                {
                    s += item.ToString() + ";";
                }
                return(Content("<script>alert('" + s + "');window.history.go(-1);</script>"));
            }

            return(RedirectToAction("Design_ExceptedBuyIndex", new { id = model.设计提交案 }));
        }
Exemplo n.º 2
0
        /// <summary>
        /// 添加客户意向明细
        /// </summary>
        /// <param name="id">设计案提交表ID</param>
        /// <returns></returns>
        public ActionResult AddDesign_ExceptedBuyView(int id)
        {
            Session["method"] = "N";
            SetEmployee();
            ViewBag.Store      = store;
            ViewBag.Employee   = employeeName;
            ViewBag.IsManager  = storeEmployeesBLL.GetModel(p => p.ID == employeeID).是否店长;
            ViewBag.IsDesigner = storeEmployeesBLL.GetModel(p => p.ID == employeeID).是否设计师;
            ViewBag.IsEmployee = storeEmployeesBLL.GetModel(p => p.ID == employeeID).是否销售;
            Design_CustomerExceptedBuyViewModel model = new Design_CustomerExceptedBuyViewModel
            {
                设计提交案 = id
            };

            return(View(model));
        }
Exemplo n.º 3
0
        /// <summary>
        /// 根据接待id查询产品信息
        /// </summary>
        private List <Design_CustomerExceptedBuyViewModel> BuildDesign_ExceptedBuy(int id)
        {
            if (id == 0)
            {
                return(null);
            }
            List <Design_CustomerExceptedBuyViewModel> models = new List <Design_CustomerExceptedBuyViewModel>();
            List <销售_设计案提交表_客户意向产品明细> exceptedBuy             = new List <销售_设计案提交表_客户意向产品明细>();

            try
            {
                exceptedBuy = design_CustomerExceptedBuyBLL.GetModels(p => p.设计提交案 == id).ToList();
            }
            catch (Exception e)
            {
                exceptedBuy = null;
            }

            if (exceptedBuy != null)
            {
                foreach (var item in exceptedBuy)
                {
                    Design_CustomerExceptedBuyViewModel exceptedBuyModel = new Design_CustomerExceptedBuyViewModel
                    {
                        Id     = item.id,
                        称      = item.称,
                        尺寸     = item.尺寸,
                        单位     = item.单位,
                        数量     = item.数量,
                        配置     = item.配置,
                        设计提交案  = item.设计提交案,
                        接待记录ID = item.接待记录ID,
                        更新人    = item.更新人,
                        更新日期   = item.更新日期,
                        空间     = item.空间,
                        系列     = item.系列,
                        分类     = item.分类,
                        品牌     = item.品牌
                    };
                    exceptedBuyModel.编号 = item.编号;
                    models.Add(exceptedBuyModel);
                }
                return(models);
            }
            return(null);
        }