Beispiel #1
0
 //
 // GET: /XM_TZ/Create
 public ActionResult Create()
 {
     BindArea();
     BindIndustry();
     BindTeamworkType();
     BindInvestmentStage();
     BindInvestmentNature();
     var t_xm_investment = new T_XM_Investment();
     return View(t_xm_investment);
 }
        public ActionResult Create(T_XM_Investment t_xm_investment, FormCollection collection)
        {
            var member = CurrentMember();
            if (member == null)
            {
                return RedirectToAction("Login", "Member");
            }
            if (ModelState.IsValid)
            {
                string checkedIndustry = (collection["cbIndustry"] + ",").Replace("false,", "");
                if (checkedIndustry.Length > 1)
                    checkedIndustry = checkedIndustry.Remove(checkedIndustry.Length - 1);
                string checkedProvince = (collection["cbProvince"] + ",").Replace("false,", "");
                if (checkedProvince.Length > 1)
                    checkedProvince = checkedProvince.Remove(checkedProvince.Length - 1);
                string checkedcbTeamWorkType = (collection["cbTeamWorkType"] + ",").Replace("false,", "");
                if (checkedcbTeamWorkType.Length > 1)
                    checkedcbTeamWorkType = checkedcbTeamWorkType.Remove(checkedcbTeamWorkType.Length - 1);
                string checkedcbInvestmentStage = (collection["cbInvestmentStage"] + ",").Replace("false,", "");
                if (checkedcbInvestmentStage.Length > 1)
                    checkedcbInvestmentStage = checkedcbInvestmentStage.Remove(checkedcbInvestmentStage.Length - 1);
                t_xm_investment.AimIndustry = checkedIndustry == "," ? "" : checkedIndustry;
                t_xm_investment.AjmArea = checkedProvince == "," ? "" : checkedProvince;
                t_xm_investment.TeamworkType = checkedcbTeamWorkType == "," ? "" : checkedcbTeamWorkType;
                t_xm_investment.InvestmentStage = checkedcbInvestmentStage == "," ? "" : checkedcbInvestmentStage;
                t_xm_investment.City = collection["ddlCity"];
                t_xm_investment.Description = t_xm_investment.Description == null ? "" : t_xm_investment.Description;
                t_xm_investment.IsValid = true;
                t_xm_investment.OP = 0;
                t_xm_investment.CreateTime = DateTime.Now;
                t_xm_investment.UpdateTime = DateTime.Now;
                t_xm_investment.SubmitTime = DateTime.Now;
                t_xm_investment.MemberID = CurrentMember().ID;
                db.T_XM_Investment.Add(t_xm_investment);
                db.SaveChanges();

                Logging("发布了新的投资意向--" + t_xm_investment.ItemName , (int)OperateTypes.Create,  (int)GenerateSystem.Publish);
                return RedirectToAction("Create", new { notice_type = "success" });
            }
            ViewData["error"] = "投资项目发布失败!请检查输入信息或联系我们!";
            return View(t_xm_investment);
        }
        //
        // GET: /XM_TZ/Create
        public ActionResult Create(string notice_type)
        {
            var member = CurrentMember();
            if (member == null)
            {
                return RedirectToAction("Login", "Member");
            }
            if(notice_type == "success")
            {
                ViewData["notice"] = "投资项目发布成功,可进入我的发布中查阅!";
            }

            BindArea();
            BindIndustry();
            BindTeamworkType();
            BindInvestmentStage();
            BindInvestmentNature();
            var t_xm_investment = new T_XM_Investment();
            return View(t_xm_investment);
        }
Beispiel #4
0
        public ActionResult Create(T_XM_Investment t_xm_investment, FormCollection collection)
        {
            if (ModelState.IsValid)
            {
                string checkedIndustry = (collection["cbIndustry"] + ",").Replace("false,", "");
                if (checkedIndustry.Length > 1)
                    checkedIndustry = checkedIndustry.Remove(checkedIndustry.Length - 1);
                string checkedProvince = (collection["cbProvince"] + ",").Replace("false,", "");
                if (checkedProvince.Length > 1)
                    checkedProvince = checkedProvince.Remove(checkedProvince.Length - 1);
                string checkedcbTeamWorkType = (collection["cbTeamWorkType"] + ",").Replace("false,", "");
                if (checkedcbTeamWorkType.Length > 1)
                    checkedcbTeamWorkType = checkedcbTeamWorkType.Remove(checkedcbTeamWorkType.Length - 1);
                string checkedcbInvestmentStage = (collection["cbInvestmentStage"] + ",").Replace("false,", "");
                if (checkedcbInvestmentStage.Length > 1)
                    checkedcbInvestmentStage = checkedcbInvestmentStage.Remove(checkedcbInvestmentStage.Length - 1);
                t_xm_investment.AimIndustry = checkedIndustry == "," ? "" : checkedIndustry;
                t_xm_investment.AjmArea = checkedProvince == "," ? "" : checkedProvince;
                t_xm_investment.TeamworkType = checkedcbTeamWorkType == "," ? "" : checkedcbTeamWorkType;
                t_xm_investment.InvestmentStage = checkedcbInvestmentStage == "," ? "" : checkedcbInvestmentStage;
                t_xm_investment.City = collection["ddlCity"];
                t_xm_investment.Description = t_xm_investment.Description == null ? "" : t_xm_investment.Description;
                t_xm_investment.IsValid = true;
                t_xm_investment.OP = 0;
                t_xm_investment.CreateTime = DateTime.Now;
                t_xm_investment.SubmitTime = DateTime.Now;

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

                db.T_XM_Investment.Add(t_xm_investment);
                int result = db.SaveChanges();
                if (result > 0)
                    return ReturnJson(true, "操作成功", "", "", true, "");
                else
                    return ReturnJson(false, "操作失败", "", "", false, "");
            }
            return Json(new { });
        }