示例#1
0
        public ActionResult Edit(T_JG_Agency t_jg_agency)
        {
            if (ModelState.IsValid)
            {
                db.Entry(t_jg_agency).State = EntityState.Modified;
                t_jg_agency.Services = t_jg_agency.Services == null ? "" : t_jg_agency.Services;
                t_jg_agency.Remark = t_jg_agency.Remark == null ? "" : t_jg_agency.Remark;
                db.SaveChanges();

                Logging("更新了机构详细信息", (int)OperateTypes.Edit, (int)GenerateSystem.Personal);
                return Json(new { statusCode = "200", message = "信息保存成功!", type = "success" });
            }
            return Json(new { statusCode = "200", message = "信息保存失败!", type = "error" });
        }
示例#2
0
 //
 // GET: /JG_Agency/Create
 public ActionResult Create()
 {
     BindArea();
     BindAgencyType();
     ViewBag.MemberID = new SelectList(db.T_HY_Member, "ID", "LoginName");
     var t_jg_agency = new T_JG_Agency();
     return View(t_jg_agency);
 }
示例#3
0
        public ActionResult Edit(T_JG_Agency t_jg_agency)
        {
            if (ModelState.IsValid)
            {
                db.Entry(t_jg_agency).State = EntityState.Modified;
                t_jg_agency.Services = t_jg_agency.Services == null ? "" : t_jg_agency.Services;
                t_jg_agency.Remark = t_jg_agency.Remark == null ? "" : t_jg_agency.Remark;
                if (t_jg_agency.RegTime == null)
                    t_jg_agency.RegTime = DateTime.MaxValue;
                t_jg_agency.UpdateTime = DateTime.Now;
                HttpPostedFileBase file = Request.Files[0];
                //存入文件
                if (file.ContentLength > 0)
                {
                    t_jg_agency.Pic = new byte[Request.Files[0].InputStream.Length];
                    Request.Files[0].InputStream.Read(t_jg_agency.Pic, 0, t_jg_agency.Pic.Length);
                }

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

            ViewBag.MemberID = new SelectList(db.T_HY_Member, "ID", "LoginName", t_jg_agency.MemberID);
            return Json(new { });
        }
示例#4
0
        public ActionResult Create(T_JG_Agency t_jg_agency)
        {
            if ((bool)CheckAgencyName(t_jg_agency.AgencyName).Data)
            {
                return ReturnJson(false, "该机构已经存在", "", "", false, "");
            }
            if (ModelState.IsValid)
            {
                t_jg_agency.Services = t_jg_agency.Services == null ? "" : t_jg_agency.Services;
                t_jg_agency.Remark = t_jg_agency.Remark == null ? "" : t_jg_agency.Remark;
                t_jg_agency.MemberID = Convert.ToInt32(Session["MemberID"] == null ? 0 : Session["MemberID"]);
                t_jg_agency.IsValid = true;
                t_jg_agency.OP = 0;
                t_jg_agency.CreateTime = DateTime.Now;
                t_jg_agency.UpdateTime = DateTime.Now;

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

                db.T_JG_Agency.Add(t_jg_agency);
                int result = db.SaveChanges();
                if (result > 0)
                    return ReturnJson(true, "操作成功", "", "", true, "");
                else
                    return ReturnJson(false, "操作失败", "", "", false, "");
            }

            ViewBag.MemberID = new SelectList(db.T_HY_Member, "ID", "LoginName", t_jg_agency.MemberID);
            return Json(new { });
        }
示例#5
0
        public bool InitAgency(int member_id,string member_name)
        {
            try
            {
                T_JG_Agency agency = new T_JG_Agency();
                agency.MemberID = member_id;
                agency.AgencyName = member_name;
                db.T_JG_Agency.Add(agency);

                if (db.SaveChanges() > 0)
                {
                    return true;
                }
                return false;
            }
            catch
            {
                return false;
            }
        }