/// <summary> /// 更新一条数据 /// </summary> public bool Update(Model.APP.Recharge model) { try { return(dal.Update(model)); } catch (Exception ex) { ExceptionHandler.HandleException(ex); return(false); } }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Model.APP.Recharge model) { try { return(dal.Add(model)); } catch (Exception ex) { ExceptionHandler.HandleException(ex); return(0); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Model.APP.Recharge model) { int rowsAffected = 0; SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int, 4), new SqlParameter("@paytype", SqlDbType.Int, 4), new SqlParameter("@rechtype", SqlDbType.TinyInt, 1), new SqlParameter("@orderid", SqlDbType.VarChar, 30), new SqlParameter("@account", SqlDbType.NVarChar, 50), new SqlParameter("@userid", SqlDbType.Int, 4), new SqlParameter("@rechargeAmt", SqlDbType.Decimal, 9), new SqlParameter("@realPayAmt", SqlDbType.Decimal, 9), new SqlParameter("@addtime", SqlDbType.DateTime), new SqlParameter("@status", SqlDbType.TinyInt, 1), new SqlParameter("@processstatus", SqlDbType.TinyInt, 1), new SqlParameter("@processtime", SqlDbType.DateTime), new SqlParameter("@smsnotification", SqlDbType.Bit, 1), new SqlParameter("@field1", SqlDbType.NVarChar, 50), new SqlParameter("@field2", SqlDbType.NVarChar, 50), new SqlParameter("@remark", SqlDbType.NVarChar, 200) }; parameters[0].Value = model.id; parameters[1].Value = model.paytype; parameters[2].Value = model.rechtype; parameters[3].Value = model.orderid; parameters[4].Value = model.account; parameters[5].Value = model.userid; parameters[6].Value = model.rechargeAmt; parameters[7].Value = model.realPayAmt; parameters[8].Value = model.addtime; parameters[9].Value = model.status; parameters[10].Value = model.processstatus; parameters[11].Value = model.processtime; parameters[12].Value = model.smsnotification; parameters[13].Value = model.field1; parameters[14].Value = model.field2; parameters[15].Value = model.remark; DbHelperSQL.RunProcedure("proc_apprecharge_Update", parameters, out rowsAffected); if (rowsAffected > 0) { return(true); } return(false); }
/// <summary> /// 得到一个对象实体 /// </summary> public Model.APP.Recharge GetModel(string orderid) { SqlParameter[] parameters = { new SqlParameter("@orderid", SqlDbType.VarChar, 30) }; parameters[0].Value = orderid; var model = new Model.APP.Recharge(); DataSet ds = DbHelperSQL.RunProcedure("proc_apprecharge_GetModel", parameters, "ds"); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } return(null); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Model.APP.Recharge model) { int rowsAffected; SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int, 4), new SqlParameter("@paytype", SqlDbType.Int, 4), new SqlParameter("@rechtype", SqlDbType.TinyInt, 1), new SqlParameter("@orderid", SqlDbType.VarChar, 30), new SqlParameter("@account", SqlDbType.NVarChar, 50), new SqlParameter("@userid", SqlDbType.Int, 4), new SqlParameter("@rechargeAmt", SqlDbType.Decimal, 9), new SqlParameter("@realPayAmt", SqlDbType.Decimal, 9), new SqlParameter("@addtime", SqlDbType.DateTime), new SqlParameter("@status", SqlDbType.TinyInt, 1), new SqlParameter("@processstatus", SqlDbType.TinyInt, 1), new SqlParameter("@processtime", SqlDbType.DateTime), new SqlParameter("@smsnotification", SqlDbType.Bit, 1), new SqlParameter("@field1", SqlDbType.NVarChar, 50), new SqlParameter("@field2", SqlDbType.NVarChar, 50), new SqlParameter("@remark", SqlDbType.NVarChar, 200), new SqlParameter("@suppid", SqlDbType.Int, 4) }; parameters[0].Direction = ParameterDirection.Output; parameters[1].Value = model.paytype; parameters[2].Value = model.rechtype; parameters[3].Value = model.orderid; parameters[4].Value = model.account; parameters[5].Value = model.userid; parameters[6].Value = model.rechargeAmt; parameters[7].Value = model.realPayAmt; parameters[8].Value = model.addtime; parameters[9].Value = model.status; parameters[10].Value = model.processstatus; parameters[11].Value = model.processtime; parameters[12].Value = model.smsnotification; parameters[13].Value = model.field1; parameters[14].Value = model.field2; parameters[15].Value = model.remark; parameters[16].Value = model.suppid; DbHelperSQL.RunProcedure("proc_apprecharge_ADD", parameters, out rowsAffected); return((int)parameters[0].Value); }
/// <summary> /// 得到一个对象实体 /// </summary> public Model.APP.Recharge DataRowToModel(DataRow row) { var model = new Model.APP.Recharge(); if (row != null) { if (row["id"] != null && row["id"].ToString() != "") { model.id = int.Parse(row["id"].ToString()); } if (row["paytype"] != null && row["paytype"].ToString() != "") { model.paytype = int.Parse(row["paytype"].ToString()); } if (row["suppid"] != null && row["suppid"].ToString() != "") { model.suppid = int.Parse(row["suppid"].ToString()); } if (row["rechtype"] != null && row["rechtype"].ToString() != "") { model.rechtype = int.Parse(row["rechtype"].ToString()); } if (row["orderid"] != null) { model.orderid = row["orderid"].ToString(); } if (row["account"] != null) { model.account = row["account"].ToString(); } if (row["userid"] != null && row["userid"].ToString() != "") { model.userid = int.Parse(row["userid"].ToString()); } if (row["rechargeAmt"] != null && row["rechargeAmt"].ToString() != "") { model.rechargeAmt = decimal.Parse(row["rechargeAmt"].ToString()); } if (row["realPayAmt"] != null && row["realPayAmt"].ToString() != "") { model.realPayAmt = decimal.Parse(row["realPayAmt"].ToString()); } if (row["addtime"] != null && row["addtime"].ToString() != "") { model.addtime = DateTime.Parse(row["addtime"].ToString()); } if (row["status"] != null && row["status"].ToString() != "") { model.status = int.Parse(row["status"].ToString()); } if (row["processstatus"] != null && row["processstatus"].ToString() != "") { model.processstatus = int.Parse(row["processstatus"].ToString()); } if (row["processtime"] != null && row["processtime"].ToString() != "") { model.processtime = DateTime.Parse(row["processtime"].ToString()); } if (row["smsnotification"] != null && row["smsnotification"].ToString() != "") { if ((row["smsnotification"].ToString() == "1") || (row["smsnotification"].ToString().ToLower() == "true")) { model.smsnotification = true; } else { model.smsnotification = false; } } if (row["field1"] != null) { model.field1 = row["field1"].ToString(); } if (row["field2"] != null) { model.field2 = row["field2"].ToString(); } if (row["remark"] != null) { model.remark = row["remark"].ToString(); } } return(model); }