示例#1
0
        //
        // GET: /JG_Product/Create
        public ActionResult Create(string notice_type)
        {
            var member = CurrentMember();
            if (member == null)
            {
                return RedirectToAction("Login", "Member");
            }
            if (notice_type == "success")
            {
                ViewData["notice"] = "金融产品发布成功,可进入我的发布中查阅!";
            }

            BindCustomerType();
            BindAgency();
            var t_jg_product = new T_JG_Product();
            return View(t_jg_product);
        }
示例#2
0
        public ActionResult Create(T_JG_Product t_jg_product, FormCollection collection)
        {
            if (ModelState.IsValid)
            {
                if (collection.GetValue("checkboxType") != null)
                {
                    string strType = collection.GetValue("checkboxType").AttemptedValue;
                    t_jg_product.CustomerType = strType;
                }
                t_jg_product.AgencyID = GetAgencyIDbyMemberID((int)Session["MemberID"]);
                t_jg_product.IsValid = true;
                t_jg_product.OP = 0;
                t_jg_product.CreateTime = DateTime.Now;
                t_jg_product.UpdateTime = DateTime.Now;
                t_jg_product.Member = CurrentMember();
                HttpPostedFileBase file = Request.Files[0];
                //存入文件
                if (file.ContentLength > 0)
                {
                    t_jg_product.Pic = new byte[Request.Files[0].InputStream.Length];
                    Request.Files[0].InputStream.Read(t_jg_product.Pic, 0, t_jg_product.Pic.Length);
                }

                db.T_JG_Product.Add(t_jg_product);
                int result = db.SaveChanges();
                if (result > 0)
                {
                    Logging("发布了新的产品", (int)OperateTypes.Create, (int)GenerateSystem.Publish);
                    return RedirectToAction("Create", new { notice_type = "success" });
                }
                else
                {
                    LoggingError((int)LogLevels.warn, "金融产品发布失败", (int)OperateTypes.Create, (int)GenerateTypes.FromMember, (int)GenerateSystem.Publish);
                    ViewData["error"] = "金融产品发布失败!请检查输入信息或联系我们!";
                    return View(t_jg_product);
                }
            }
            ViewData["error"] = "金融产品发布失败!请检查输入信息或联系我们!";
            return View(t_jg_product);
        }
示例#3
0
        public ActionResult Edit(T_JG_Product t_jg_product, FormCollection collection)
        {
            if (ModelState.IsValid)
            {
                db.Entry(t_jg_product).State = EntityState.Modified;
                t_jg_product.AgencyID = Convert.ToInt32(collection["AgencyList"]);
                t_jg_product.Superiority = t_jg_product.Superiority == null ? "" : t_jg_product.Superiority;
                t_jg_product.RepaymentType = t_jg_product.RepaymentType == null ? "" : t_jg_product.RepaymentType;
                t_jg_product.AppCondition = t_jg_product.AppCondition == null ? "" : t_jg_product.AppCondition;
                t_jg_product.Process = t_jg_product.Process == null ? "" : t_jg_product.Process;
                t_jg_product.CustomerType = collection["checkboxType"] == null ? "" : collection["checkboxType"];
                t_jg_product.UpdateTime = DateTime.Now;

                HttpPostedFileBase file = Request.Files[0];
                //存入文件
                if (file.ContentLength > 0)
                {
                    t_jg_product.Pic = new byte[Request.Files[0].InputStream.Length];
                    Request.Files[0].InputStream.Read(t_jg_product.Pic, 0, t_jg_product.Pic.Length);
                }

                int result = db.SaveChanges();
                if (result > 0)
                    return ReturnJson(true, "操作成功", "", "", true, "");
                else
                    return ReturnJson(false, "操作失败", "", "", false, "");
            }
            return Json(new { });
        }
示例#4
0
        public ActionResult Create(T_JG_Product t_jg_product, FormCollection collection)
        {
            if ((bool)CheckProductName(t_jg_product.ProductName).Data)
            {
                return ReturnJson(false, "该产品已经存在", "", "", false, "");
            }
            if (ModelState.IsValid)
            {
                if (collection.GetValue("checkboxType") != null)
                {
                    string strType = collection.GetValue("checkboxType").AttemptedValue;
                    t_jg_product.CustomerType = strType;
                }
                t_jg_product.AgencyID = Convert.ToInt32(collection["AgencyList"]);
                t_jg_product.Superiority = t_jg_product.Superiority == null ? "" : t_jg_product.Superiority;
                t_jg_product.RepaymentType = t_jg_product.RepaymentType == null ? "" : t_jg_product.RepaymentType;
                t_jg_product.AppCondition = t_jg_product.AppCondition == null ? "" : t_jg_product.AppCondition;
                t_jg_product.Process = t_jg_product.Process == null ? "" : t_jg_product.Process;
                t_jg_product.IsValid = true;
                t_jg_product.OP = 0;
                t_jg_product.CreateTime = DateTime.Now;
                t_jg_product.UpdateTime = DateTime.Now;

                HttpPostedFileBase file = Request.Files[0];
                //存入文件
                if (file.ContentLength > 0)
                {
                    t_jg_product.Pic = new byte[Request.Files[0].InputStream.Length];
                    Request.Files[0].InputStream.Read(t_jg_product.Pic, 0, t_jg_product.Pic.Length);
                }

                db.T_JG_Product.Add(t_jg_product);
                int result = db.SaveChanges();
                if (result > 0)
                    return ReturnJson(true, "操作成功", "", "", true, "");
                else
                    return ReturnJson(false, "操作失败", "", "", false, "");
            }
            return Json(new { });
        }
示例#5
0
 //
 // GET: /JG_Product/Create
 public ActionResult Create()
 {
     BindCustomerType();
     BindAgency();
     var t_jg_product = new T_JG_Product();
     return View(t_jg_product);
 }
示例#6
0
        public ActionResult Edit(T_JG_Product t_jg_product, FormCollection collection)
        {
            if (ModelState.IsValid)
            {
                db.Entry(t_jg_product).State = EntityState.Modified;
                t_jg_product.CustomerType = collection["checkboxType"];
                t_jg_product.UpdateTime = DateTime.Now;

                HttpPostedFileBase file = Request.Files[0];
                //存入文件
                if (file.ContentLength > 0)
                {
                    t_jg_product.Pic = new byte[Request.Files[0].InputStream.Length];
                    Request.Files[0].InputStream.Read(t_jg_product.Pic, 0, t_jg_product.Pic.Length);
                }

                int result = db.SaveChanges();
                if (result > 0)
                {
                    Logging("更新了金融产品信息", (int)OperateTypes.Create, (int)GenerateSystem.Publish);
                    return RedirectToAction("Edit", new { notice_type = "success" });
                }
                else
                {
                    LoggingError((int)LogLevels.warn, "更新了金融产品信息失败", (int)OperateTypes.Create, (int)GenerateTypes.FromMember, (int)GenerateSystem.Publish);
                    ViewData["error"] = "金融产品更新失败!请检查输入信息或联系我们!";
                    return View(t_jg_product);
                }
            }
            return Json(new { });
        }