public JsonResult UpdatePayRart() { JMP.BLL.jmp_paymode bll = new JMP.BLL.jmp_paymode(); JMP.MDL.jmp_paymode model = new JMP.MDL.jmp_paymode(); object retJson = new { success = 0, msg = "操作失败" }; int pid = string.IsNullOrEmpty(Request["pid"]) ? 0 : int.Parse(Request["pid"]); string p_rate = string.IsNullOrEmpty(Request["p_rate"]) ? "0" : Request["p_rate"]; //获取一个实体对象 model = bll.GetModel(pid); if (bll.Update_rate(pid, p_rate)) { //记录日志(会定期清理) Logger.OperateLog("修改接口费率", "操作数据ID:" + pid + ",接口费率由:" + model.p_rate + ",改为:" + p_rate + "。"); //记录日志(不会清理) RateLogger.OperateLog("修改接口费率", "操作数据ID:" + pid + ",接口费率由:" + model.p_rate + ",改为:" + p_rate + "。"); retJson = new { success = 1, msg = "设置接口费率成功" }; } else { retJson = new { success = 0, msg = "设置接口费率失败" }; } return(Json(retJson)); }
/// <summary> /// 获得数据列表 /// </summary> public List <JMP.MDL.jmp_paymode> DataTableToList(DataTable dt) { List <JMP.MDL.jmp_paymode> modelList = new List <JMP.MDL.jmp_paymode>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { JMP.MDL.jmp_paymode model; for (int n = 0; n < rowsCount; n++) { model = new JMP.MDL.jmp_paymode(); if (dt.Rows[n]["p_id"].ToString() != "") { model.p_id = int.Parse(dt.Rows[n]["p_id"].ToString()); } model.p_name = dt.Rows[n]["p_name"].ToString(); if (dt.Rows[n]["p_rate"].ToString() != "") { model.p_rate = decimal.Parse(dt.Rows[n]["p_rate"].ToString()); } if (dt.Rows[n]["p_state"].ToString() != "") { model.p_state = int.Parse(dt.Rows[n]["p_state"].ToString()); } if (dt.Rows[n]["p_islocked"].ToString() != "") { model.p_islocked = int.Parse(dt.Rows[n]["p_islocked"].ToString()); } modelList.Add(model); } } return(modelList); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(JMP.MDL.jmp_paymode model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into jmp_paymode("); strSql.Append("p_name,p_rate,p_state,p_islocked"); strSql.Append(") values ("); strSql.Append("@p_name,@p_rate,@p_state,@p_islocked"); strSql.Append(") "); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@p_name", SqlDbType.NVarChar, -1), new SqlParameter("@p_rate", SqlDbType.Decimal, 5), new SqlParameter("@p_state", SqlDbType.Int, 4), new SqlParameter("@p_islocked", SqlDbType.Int, 4) }; parameters[0].Value = model.p_name; parameters[1].Value = model.p_rate; parameters[2].Value = model.p_state; parameters[3].Value = model.p_islocked; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }
public ActionResult PaymodeAddOrUpdate() { int p_id = string.IsNullOrEmpty(Request["p_id"]) ? 0 : Int32.Parse(Request["p_id"]); JMP.BLL.jmp_paymode bll = new JMP.BLL.jmp_paymode(); JMP.MDL.jmp_paymode mode = new JMP.MDL.jmp_paymode(); if (p_id > 0) { mode = bll.GetModel(p_id); } ViewBag.mode = mode; return(View()); }
/// <summary> /// 设置接口费率 /// </summary> /// <returns></returns> public ActionResult PaymodeRartAdd() { int id = string.IsNullOrEmpty(Request["pid"]) ? 0 : int.Parse(Request["pid"]); JMP.MDL.jmp_paymode model = new JMP.MDL.jmp_paymode(); JMP.BLL.jmp_paymode bll = new JMP.BLL.jmp_paymode(); //查询 model = bll.GetModel(id); ViewBag.model = model; return(View()); }
/// <summary> /// 得到一个对象实体 /// </summary> public JMP.MDL.jmp_paymode GetModel(int p_id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select p_id,p_name,p_rate,p_state,p_islocked "); strSql.Append(" from jmp_paymode "); strSql.Append(" where p_id=@p_id"); SqlParameter[] parameters = { new SqlParameter("@p_id", SqlDbType.Int, 4) }; parameters[0].Value = p_id; JMP.MDL.jmp_paymode model = new JMP.MDL.jmp_paymode(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["p_id"].ToString() != "") { model.p_id = int.Parse(ds.Tables[0].Rows[0]["p_id"].ToString()); } model.p_name = ds.Tables[0].Rows[0]["p_name"].ToString(); if (ds.Tables[0].Rows[0]["p_rate"].ToString() != "") { model.p_rate = decimal.Parse(ds.Tables[0].Rows[0]["p_rate"].ToString()); } if (ds.Tables[0].Rows[0]["p_state"].ToString() != "") { model.p_state = int.Parse(ds.Tables[0].Rows[0]["p_state"].ToString()); } if (ds.Tables[0].Rows[0]["p_islocked"].ToString() != "") { model.p_islocked = int.Parse(ds.Tables[0].Rows[0]["p_islocked"].ToString()); } return(model); } else { return(null); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(JMP.MDL.jmp_paymode model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update jmp_paymode set "); strSql.Append(" p_name = @p_name , "); strSql.Append(" p_rate = @p_rate , "); strSql.Append(" p_state = @p_state , "); strSql.Append(" p_islocked = @p_islocked "); strSql.Append(" where p_id=@p_id "); SqlParameter[] parameters = { new SqlParameter("@p_id", SqlDbType.Int, 4), new SqlParameter("@p_name", SqlDbType.NVarChar, -1), new SqlParameter("@p_rate", SqlDbType.Decimal, 5), new SqlParameter("@p_state", SqlDbType.Int, 4), new SqlParameter("@p_islocked", SqlDbType.Int, 4) }; parameters[0].Value = model.p_id; parameters[1].Value = model.p_name; parameters[2].Value = model.p_rate; parameters[3].Value = model.p_state; parameters[4].Value = model.p_islocked; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(JMP.MDL.jmp_paymode model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(JMP.MDL.jmp_paymode model) { return(dal.Add(model)); }