/// <summary> /// 添加或修改应用类型 /// </summary> /// <returns></returns> public JsonResult InsertOrUpdateAddType(JMP.MDL.jmp_apptype mode) { object retJson = new { success = 0, msg = "操作失败" }; JMP.BLL.jmp_apptype bll = new JMP.BLL.jmp_apptype(); if (mode.t_id > 0) { #region 修改应用类型 JMP.MDL.jmp_apptype mo = new JMP.MDL.jmp_apptype(); mo = bll.GetModel(mode.t_id); var mocole = mo.Clone(); mo.t_name = mode.t_name; mo.t_sort = mode.t_sort; mo.t_topid = mode.t_topid; mo.t_namecj = mode.t_namecj; //mode.t_state = mo.t_state; //string xgzfc = ""; if (bll.Update(mo)) { Logger.ModifyLog("修改应用类型", mocole, mode); retJson = new { success = 1, msg = "修改成功" }; } else { retJson = new { success = 0, msg = "修改失败" }; } #endregion } else { #region 添加应用类型 mode.t_state = 1; int cg = bll.Add(mode); if (cg > 0) { Logger.CreateLog("添加应用类型", mode); retJson = new { success = 1, msg = "添加成功" }; } else { retJson = new { success = 0, msg = "添加失败" }; } #endregion } return(Json(retJson)); }
/// <summary> /// 添加或修改应用类型界面 /// </summary> /// <returns></returns> public ActionResult AppTypeAdd() { JMP.BLL.jmp_apptype bll = new JMP.BLL.jmp_apptype(); List <JMP.MDL.jmp_apptype> list = new List <JMP.MDL.jmp_apptype>(); int t_id = string.IsNullOrEmpty(Request["t_id"]) ? 0 : Int32.Parse(Request["t_id"]); JMP.MDL.jmp_apptype model = new JMP.MDL.jmp_apptype(); if (t_id > 0) { model = bll.GetModel(t_id); } ViewBag.model = model; DataTable dt = bll.GetList(" 1=1 and t_topid='0' ").Tables[0]; list = JMP.TOOL.MdlList.ToList <JMP.MDL.jmp_apptype>(dt); ViewBag.list = list; return(View()); }
/// <summary> /// 修改应用 /// </summary> /// <returns></returns> public ActionResult UpdateAPP(int a_id) { JMP.BLL.jmp_app bll = new JMP.BLL.jmp_app(); JMP.MDL.jmp_app model = new JMP.MDL.jmp_app(); string glpt = ""; string zf = ""; string szmrdj = ""; string yy = ""; if (a_id > 0) { model = bll.SelectId(a_id); #region =========获取应用平台在用信息========= JMP.BLL.jmp_platform bllpl = new JMP.BLL.jmp_platform(); DataTable dt = bllpl.GetList(" 1=1 and p_state='1' ").Tables[0];//获取应用平台在用信息 for (int i = 0; i < dt.Rows.Count; i++) { if (Int32.Parse(dt.Rows[i]["p_id"].ToString()) == model.a_platform_id) { glpt += "<option value=\"" + dt.Rows[i]["p_id"] + "\" selected=\"selected\" >" + dt.Rows[i]["p_name"] + "</option>"; } else { glpt += "<option value=\"" + dt.Rows[i]["p_id"] + "\">" + dt.Rows[i]["p_name"] + "</option>"; } } #endregion #region =====获取支付类型在用信息====== JMP.BLL.jmp_paymode zfbll = new JMP.BLL.jmp_paymode(); DataTable zfdt = zfbll.GetList(" 1=1 and p_state='1' ").Tables[0];//获取支付类型在用信息 string[] a_paymode = model.a_paymode_id.Split(','); for (int k = 0; k < zfdt.Rows.Count; k++) { bool check = true; for (int i = 0; i < a_paymode.Length; i++) { if (zfdt.Rows[k]["p_id"].ToString() == a_paymode[i]) { zf += " <input type=\"checkbox\" name=\"zflx\" class=\"inputChck\" id=paytype_" + zfdt.Rows[k]["p_id"] + " data-stat=" + zfdt.Rows[k]["p_islocked"] + " value=" + zfdt.Rows[k]["p_id"] + " checked=\"checked\" /> " + zfdt.Rows[k]["p_name"]; check = false; break; } } if (check) { zf += " <input type=\"checkbox\" name=\"zflx\" class=\"inputChck\" id=paytype_" + zfdt.Rows[k]["p_id"] + " data-stat=" + zfdt.Rows[k]["p_islocked"] + " value=" + zfdt.Rows[k]["p_id"] + " /> " + zfdt.Rows[k]["p_name"]; } } #endregion #region ========获取应用类型在用信息====== JMP.BLL.jmp_apptype yybll = new JMP.BLL.jmp_apptype(); string where = " t_id in (select DISTINCT(t_topid) from jmp_apptype where t_topid in( select t_id from jmp_apptype where t_topid='0' )) and t_state='1' order by t_sort desc"; DataTable yydt = yybll.GetList(where).Tables[0];//获取应用类型在用信息 JMP.MDL.jmp_apptype models = new JMP.MDL.jmp_apptype(); int t_topid = 0; if (model.a_apptype_id > 0) { models = yybll.GetModel(model.a_apptype_id);//查询单条信息 t_topid = models.t_topid; } string yyid = ""; for (int j = 0; j < yydt.Rows.Count; j++) { yyid = "yy" + yydt.Rows[j]["t_id"].ToString(); if (t_topid > 0) { if (Int32.Parse(yydt.Rows[j]["t_id"].ToString()) == models.t_topid) { szmrdj = yyid; yy += "<input type=\"button\" id='" + yyid + "' name=\"yyname\" onclick=\"xzyylx(this.id,0)\" class=\"xzinput\" value=" + yydt.Rows[j]["t_name"] + " />"; } else { yy += "<input type=\"button\" id='" + yyid + "' name=\"yyname\" onclick=\"xzyylx(this.id,0)\" class=\"inpuwxz\" value=" + yydt.Rows[j]["t_name"] + " />"; } } else { yy += "<input type=\"button\" id='" + yyid + "' name=\"yyname\" onclick=\"xzyylx(this.id,0)\" class=\"inpuwxz\" value=" + yydt.Rows[j]["t_name"] + " />"; } } #endregion #region 根据应用子类型获取风险等级 JMP.BLL.jmp_risklevelallocation ribll = new JMP.BLL.jmp_risklevelallocation(); List <JMP.MDL.jmp_risklevelallocation> rilist = new List <JMP.MDL.jmp_risklevelallocation>(); rilist = ribll.SelectAppType(model.a_apptype_id); ViewBag.rilist = rilist; #endregion } ViewBag.model = model; ViewBag.glpt = glpt; ViewBag.zf = zf; ViewBag.yy = yy; ViewBag.szmrdj = szmrdj; return(View()); }