/// <summary> /// 获得数据列表 /// </summary> public List <JMP.MDL.jmp_system> DataTableToList(DataTable dt) { List <JMP.MDL.jmp_system> modelList = new List <JMP.MDL.jmp_system>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { JMP.MDL.jmp_system model; for (int n = 0; n < rowsCount; n++) { model = new JMP.MDL.jmp_system(); if (dt.Rows[n]["s_id"].ToString() != "") { model.s_id = int.Parse(dt.Rows[n]["s_id"].ToString()); } model.s_name = dt.Rows[n]["s_name"].ToString(); model.s_value = dt.Rows[n]["s_value"].ToString(); if (dt.Rows[n]["s_state"].ToString() != "") { model.s_state = int.Parse(dt.Rows[n]["s_state"].ToString()); } model.s_remarks = dt.Rows[n]["s_remarks"].ToString(); modelList.Add(model); } } return(modelList); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(JMP.MDL.jmp_system model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into jmp_system("); strSql.Append("s_name,s_value,s_state,s_remarks"); strSql.Append(") values ("); strSql.Append("@s_name,@s_value,@s_state,@s_remarks"); strSql.Append(") "); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@s_name", SqlDbType.NVarChar, -1), new SqlParameter("@s_value", SqlDbType.NVarChar, -1), new SqlParameter("@s_state", SqlDbType.Int, 4), new SqlParameter("@s_remarks", SqlDbType.NVarChar, -1) }; parameters[0].Value = model.s_name; parameters[1].Value = model.s_value; parameters[2].Value = model.s_state; parameters[3].Value = model.s_remarks; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }
/// <summary> /// 添加或修改系统配置 /// </summary> /// <param name="mode"></param> /// <returns></returns> public JsonResult InsertOrUpdateSystem(JMP.MDL.jmp_system mode) { object retJson = new { success = 0, msg = "操作失败" }; JMP.BLL.jmp_system bll = new JMP.BLL.jmp_system(); JMP.MDL.jmp_system mo = new JMP.MDL.jmp_system(); if (mode.s_id > 0) { mo = bll.GetModel(mode.s_id); mode.s_state = mo.s_state; if (mo.s_name == "password") { //md5加密 mode.s_value = DESEncrypt.Encrypt(mode.s_value); } if (bll.Update(mode)) { #region 日志说明 Logger.ModifyLog("用户" + UserInfo.UserName + "修改系统配置", mo, mode); #endregion retJson = new { success = 1, msg = "修改成功" }; } else { retJson = new { success = 0, msg = "修改失败" }; }; } else { #region mode.s_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> public JMP.MDL.jmp_system GetModel_name(string name) { StringBuilder strSql = new StringBuilder(); strSql.Append("select s_id, s_name, s_value, s_state, s_remarks "); strSql.Append(" from jmp_system "); strSql.Append(" where s_name=@name"); SqlParameter[] parameters = { new SqlParameter("@name", SqlDbType.NVarChar, -1) }; parameters[0].Value = name; JMP.MDL.jmp_system model = new JMP.MDL.jmp_system(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["s_id"].ToString() != "") { model.s_id = int.Parse(ds.Tables[0].Rows[0]["s_id"].ToString()); } model.s_name = ds.Tables[0].Rows[0]["s_name"].ToString(); model.s_value = ds.Tables[0].Rows[0]["s_value"].ToString(); if (ds.Tables[0].Rows[0]["s_state"].ToString() != "") { model.s_state = int.Parse(ds.Tables[0].Rows[0]["s_state"].ToString()); } model.s_remarks = ds.Tables[0].Rows[0]["s_remarks"].ToString(); return(model); } else { return(null); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(JMP.MDL.jmp_system model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update jmp_system set "); strSql.Append(" s_name = @s_name , "); strSql.Append(" s_value = @s_value , "); strSql.Append(" s_state = @s_state , "); strSql.Append(" s_remarks = @s_remarks "); strSql.Append(" where s_id=@s_id "); SqlParameter[] parameters = { new SqlParameter("@s_id", SqlDbType.Int, 4), new SqlParameter("@s_name", SqlDbType.NVarChar, -1), new SqlParameter("@s_value", SqlDbType.NVarChar, -1), new SqlParameter("@s_state", SqlDbType.Int, 4), new SqlParameter("@s_remarks", SqlDbType.NVarChar, -1) }; parameters[0].Value = model.s_id; parameters[1].Value = model.s_name; parameters[2].Value = model.s_value; parameters[3].Value = model.s_state; parameters[4].Value = model.s_remarks; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
public JsonResult paysAdd() { object result = new { success = 0, msg = "操作失败!" }; JMP.BLL.jmp_user userbll = new JMP.BLL.jmp_user(); JMP.BLL.jmp_system systembll = new JMP.BLL.jmp_system(); //可提现金额 decimal ketiMoney = Convert.ToDecimal(Request["ketiMoney"] ?? "0"); //提现金额 decimal payMoney = Convert.ToDecimal(Request["payMoney"] ?? "0"); //提现银行卡信息 string b_bankid = string.IsNullOrEmpty(Request["b_bankid"]) ? "" : Request["b_bankid"]; //提现选中账单ID string payid = string.IsNullOrEmpty(Request["payid"]) ? "0" : Request["payid"]; //支付密码 string PayPwd = string.IsNullOrEmpty(Request["PayPwd"]) ? "" : Request["PayPwd"]; //提现类型(1:单卡提现,2:多卡提现) int WithdrawalsType = string.IsNullOrEmpty(Request["WithdrawalsType"]) ? 0 : int.Parse(Request["WithdrawalsType"]); //查询开发者信息 JMP.MDL.jmp_user j_user = userbll.GetModel(UserInfo.UserId); //查询超级密码 JMP.MDL.jmp_system j_sys = systembll.GetModel_name("password"); //提现最小金额 string WithdrawalsMinimum = System.Configuration.ConfigurationManager.AppSettings["WithdrawalsMinimum"].ToString(); //验证提现金额 if (payMoney >= decimal.Parse(WithdrawalsMinimum)) { if (payMoney > ketiMoney) { result = new { success = 0, msg = "提现金额不能超过可提金额!" }; } else { #region 提现金额验证成功,后续处理 //判断是否验证原支付密码 if (!string.IsNullOrEmpty(PayPwd)) { string temp = DESEncrypt.Encrypt(PayPwd); if (temp == j_user.u_paypwd || temp == j_sys.s_value) { #region 拼装提款表与银行打款对接表sql if (WithdrawalsType == 1 || WithdrawalsType == 2) { List <string> sqllist = new List <string>(); if (WithdrawalsType == 1) { sqllist = BankPaySongle(payMoney, b_bankid, payid); } else { sqllist = BankPay(payMoney, b_bankid, payid); } if (sqllist.Count > 0) { JMP.BLL.jmp_BankPlaymoney bankBll = new JMP.BLL.jmp_BankPlaymoney(); //执行多条SQL语句,实现数据库事务。 int num = bankBll.SelectBankPayMoney(sqllist); if (num > 0) { string log = "用户:" + UserInfo.UserId + ",申请提现:" + payMoney + ",申请时间:" + DateTime.Now; Logger.OperateLog("提现申请", log); result = new { success = 1, msg = "提现申请成功,请等待审核通过!" }; } else { result = new { success = 0, msg = "提现申请失败!" }; } } else { result = new { success = 0, msg = "提现申请失败!" }; } } else { Logger.OperateLog("提现申请失败", "提现类型(1:单卡提现,2:多卡提现):" + WithdrawalsType); result = new { success = 0, msg = "提现申请失败!" }; } #endregion } else { result = new { success = 0, msg = "支付密码输入错误!" }; } } else { result = new { success = 0, msg = "请输入支付密码!" }; } #endregion } } else { result = new { success = 0, msg = "提现金额不能为空且必须大于等于100!" }; } return(Json(result)); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(JMP.MDL.jmp_system model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(JMP.MDL.jmp_system model) { return(dal.Add(model)); }