/// <summary> /// 修改商务权限方法 /// </summary> /// <returns></returns> public JsonResult BusinessAjaxUpdateLimit() { object retJson = new { success = 0, msg = "操作失败" }; m_limit.l_id = int.Parse(Request["lid"]); m_limit.l_name = Request["name"]; m_limit.l_url = Request["url"]; m_limit.l_sort = int.Parse(Request["values"]); m_limit.l_topid = int.Parse(Request["topid"]); m_limit.l_state = int.Parse(Request["state"]); m_limit.l_icon = Request["icon"]; m_limit.l_type = 2; JMP.MDL.jmp_limit old_m_limit = new JMP.MDL.jmp_limit(); old_m_limit = bll_limit.GetModel(int.Parse(Request["lid"]));//查询本次更新前的数据 bool result = bll_limit.Update(m_limit); if (result) { Logger.ModifyLog("操作更新权限页面,进行权限修改", old_m_limit, m_limit); retJson = new { success = 1, msg = "操作成功" }; } return(Json(retJson)); }
/// <summary> /// 得到一个对象实体 /// </summary> public JMP.MDL.jmp_limit GetModel(int l_id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select l_id, l_name, l_topid, l_url, l_sort, l_state, l_icon, l_type "); strSql.Append(" from jmp_limit "); strSql.Append(" where l_id=@l_id"); SqlParameter[] parameters = { new SqlParameter("@l_id", SqlDbType.Int, 4) }; parameters[0].Value = l_id; JMP.MDL.jmp_limit model = new JMP.MDL.jmp_limit(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["l_id"].ToString() != "") { model.l_id = int.Parse(ds.Tables[0].Rows[0]["l_id"].ToString()); } model.l_name = ds.Tables[0].Rows[0]["l_name"].ToString(); if (ds.Tables[0].Rows[0]["l_topid"].ToString() != "") { model.l_topid = int.Parse(ds.Tables[0].Rows[0]["l_topid"].ToString()); } model.l_url = ds.Tables[0].Rows[0]["l_url"].ToString(); if (ds.Tables[0].Rows[0]["l_sort"].ToString() != "") { model.l_sort = int.Parse(ds.Tables[0].Rows[0]["l_sort"].ToString()); } if (ds.Tables[0].Rows[0]["l_state"].ToString() != "") { model.l_state = int.Parse(ds.Tables[0].Rows[0]["l_state"].ToString()); } model.l_icon = ds.Tables[0].Rows[0]["l_icon"].ToString(); if (ds.Tables[0].Rows[0]["l_type"].ToString() != "") { model.l_type = int.Parse(ds.Tables[0].Rows[0]["l_type"].ToString()); } return(model); } else { return(null); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(JMP.MDL.jmp_limit model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update jmp_limit set "); strSql.Append(" l_name = @l_name , "); strSql.Append(" l_topid = @l_topid , "); strSql.Append(" l_url = @l_url , "); strSql.Append(" l_sort = @l_sort , "); strSql.Append(" l_state = @l_state , "); strSql.Append(" l_icon = @l_icon , "); strSql.Append(" l_type = @l_type "); strSql.Append(" where l_id=@l_id "); SqlParameter[] parameters = { new SqlParameter("@l_id", SqlDbType.Int, 4), new SqlParameter("@l_name", SqlDbType.NVarChar, -1), new SqlParameter("@l_topid", SqlDbType.Int, 4), new SqlParameter("@l_url", SqlDbType.NVarChar, -1), new SqlParameter("@l_sort", SqlDbType.Int, 4), new SqlParameter("@l_state", SqlDbType.Int, 4), new SqlParameter("@l_icon", SqlDbType.NVarChar, -1), new SqlParameter("@l_type", SqlDbType.Int, 4) }; parameters[0].Value = model.l_id; parameters[1].Value = model.l_name; parameters[2].Value = model.l_topid; parameters[3].Value = model.l_url; parameters[4].Value = model.l_sort; parameters[5].Value = model.l_state; parameters[6].Value = model.l_icon; parameters[7].Value = model.l_type; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 获得数据列表 /// </summary> public List <JMP.MDL.jmp_limit> DataTableToList(DataTable dt) { List <JMP.MDL.jmp_limit> modelList = new List <JMP.MDL.jmp_limit>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { JMP.MDL.jmp_limit model; for (int n = 0; n < rowsCount; n++) { model = new JMP.MDL.jmp_limit(); if (dt.Rows[n]["l_id"].ToString() != "") { model.l_id = int.Parse(dt.Rows[n]["l_id"].ToString()); } model.l_name = dt.Rows[n]["l_name"].ToString(); if (dt.Rows[n]["l_topid"].ToString() != "") { model.l_topid = int.Parse(dt.Rows[n]["l_topid"].ToString()); } model.l_url = dt.Rows[n]["l_url"].ToString(); if (dt.Rows[n]["l_sort"].ToString() != "") { model.l_sort = int.Parse(dt.Rows[n]["l_sort"].ToString()); } if (dt.Rows[n]["l_state"].ToString() != "") { model.l_state = int.Parse(dt.Rows[n]["l_state"].ToString()); } model.l_icon = dt.Rows[n]["l_icon"].ToString(); if (dt.Rows[n]["l_type"].ToString() != "") { model.l_type = int.Parse(dt.Rows[n]["l_type"].ToString()); } modelList.Add(model); } } return(modelList); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(JMP.MDL.jmp_limit model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into jmp_limit("); strSql.Append("l_name,l_topid,l_url,l_sort,l_state,l_icon,l_type"); strSql.Append(") values ("); strSql.Append("@l_name,@l_topid,@l_url,@l_sort,@l_state,@l_icon,@l_type"); strSql.Append(") "); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@l_name", SqlDbType.NVarChar, -1), new SqlParameter("@l_topid", SqlDbType.Int, 4), new SqlParameter("@l_url", SqlDbType.NVarChar, -1), new SqlParameter("@l_sort", SqlDbType.Int, 4), new SqlParameter("@l_state", SqlDbType.Int, 4), new SqlParameter("@l_icon", SqlDbType.NVarChar, -1), new SqlParameter("@l_type", SqlDbType.Int, 4) }; parameters[0].Value = model.l_name; parameters[1].Value = model.l_topid; parameters[2].Value = model.l_url; parameters[3].Value = model.l_sort; parameters[4].Value = model.l_state; parameters[5].Value = model.l_icon; parameters[6].Value = model.l_type; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(JMP.MDL.jmp_limit model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(JMP.MDL.jmp_limit model) { return(dal.Add(model)); }