/// <summary> /// /// </summary> /// <param name="itemInfo"></param> public static void InitDistribution(viviapi.Model.Finance.Withdraw itemInfo) { var info = new Model.Finance.WithdrawSuppTranLog() { trade_no = BLL.Finance.WithdrawSuppTranLog.Instance.GenerateOrderId(), mode = 1, settledId = itemInfo.ID, batchNo = 1, userid = itemInfo.Userid, balance = 0M, bankCode = itemInfo.BankCode, suppid = itemInfo.SuppId, bankName = itemInfo.PayeeBank, bankBranch = itemInfo.Payeeaddress, bankAccountName = itemInfo.PayeeName, bankAccount = itemInfo.Account, charges = itemInfo.Charges, amount = itemInfo.Amount - itemInfo.Charges, balance2 = 0, withdrawNo = itemInfo.Tranno }; int id = BLL.Finance.WithdrawSuppTranLog.Instance.Add(info); if (id > 0) { SellFactory.ReqDistribution(info); } }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Model.Finance.WithdrawSuppTranLog model) { try { return(dal.Add(model)); } catch (Exception exception) { ExceptionHandler.HandleException(exception); return(0); } }
/// <summary> /// /// </summary> /// <param name="info"></param> public static void ReqDistribution(Model.Finance.WithdrawSuppTranLog info) { //bool result = false; //if (info.suppid == 100) //{ // tenpay.distribution.gw api = new viviapi.ETAPI.tenpay.distribution.gw(); // result = api.DoTrans(info); //} //else if (info.suppid == 1004) //{ // //Ebatong.distribution.gw api = new viviapi.ETAPI.Ebatong.distribution.gw(); // //result = api.DoTrans(info); //} }
/// <summary> /// 得到一个对象实体 /// </summary> public Model.Finance.WithdrawSuppTranLog GetModel(int id) { SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int, 4) }; parameters[0].Value = id; Model.Finance.WithdrawSuppTranLog model = new Model.Finance.WithdrawSuppTranLog(); DataSet ds = DbHelperSQL.RunProcedure("withdrawSuppTranLog_GetModel", parameters, "ds"); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Model.Finance.WithdrawSuppTranLog model) { int rowsAffected; SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int, 4), new SqlParameter("@suppid", SqlDbType.Int, 4), new SqlParameter("@mode", SqlDbType.TinyInt, 1), new SqlParameter("@settledId", SqlDbType.Int, 4), new SqlParameter("@withdrawNo", SqlDbType.VarChar, 30), new SqlParameter("@trade_no", SqlDbType.VarChar, 30), new SqlParameter("@batchNo", SqlDbType.Int, 4), new SqlParameter("@supp_trade_no", SqlDbType.VarChar, 50), new SqlParameter("@userid", SqlDbType.Int, 4), new SqlParameter("@balance", SqlDbType.Decimal, 9), new SqlParameter("@bankCode", SqlDbType.VarChar, 50), new SqlParameter("@bankName", SqlDbType.NVarChar, 20), new SqlParameter("@bankBranch", SqlDbType.NVarChar, 255), new SqlParameter("@bankAccountName", SqlDbType.NVarChar, 20), new SqlParameter("@bankAccount", SqlDbType.VarChar, 50), new SqlParameter("@amount", SqlDbType.Decimal, 9), new SqlParameter("@charges", SqlDbType.Decimal, 9), new SqlParameter("@balance2", SqlDbType.Decimal, 9), new SqlParameter("@addTime", SqlDbType.DateTime), new SqlParameter("@processingTime", SqlDbType.DateTime), new SqlParameter("@supp_message", SqlDbType.NVarChar, 200), new SqlParameter("@is_cancel", SqlDbType.Bit, 1), new SqlParameter("@status", SqlDbType.TinyInt, 1), new SqlParameter("@ext1", SqlDbType.VarChar, 50), new SqlParameter("@ext2", SqlDbType.VarChar, 50), new SqlParameter("@ext3", SqlDbType.VarChar, 50), new SqlParameter("@remark", SqlDbType.NVarChar, 500) }; parameters[0].Direction = ParameterDirection.Output; parameters[1].Value = model.suppid; parameters[2].Value = model.mode; parameters[3].Value = model.settledId; parameters[4].Value = model.withdrawNo; parameters[5].Value = model.trade_no; parameters[6].Value = model.batchNo; parameters[7].Value = model.supp_trade_no; parameters[8].Value = model.userid; parameters[9].Value = model.balance; parameters[10].Value = model.bankCode; parameters[11].Value = model.bankName; parameters[12].Value = model.bankBranch; parameters[13].Value = model.bankAccountName; parameters[14].Value = model.bankAccount; parameters[15].Value = model.amount; parameters[16].Value = model.charges; parameters[17].Value = model.balance2; parameters[18].Value = model.addTime; parameters[19].Value = model.processingTime; parameters[20].Value = model.supp_message; parameters[21].Value = model.is_cancel; parameters[22].Value = model.status; parameters[23].Value = model.ext1; parameters[24].Value = model.ext2; parameters[25].Value = model.ext3; parameters[26].Value = model.remark; DbHelperSQL.RunProcedure("proc_withdrawSuppTranLog_add", parameters, out rowsAffected); return((int)parameters[0].Value); }
/// <summary> /// 得到一个对象实体 /// </summary> public Model.Finance.WithdrawSuppTranLog DataRowToModel(DataRow row) { Model.Finance.WithdrawSuppTranLog model = new Model.Finance.WithdrawSuppTranLog(); if (row != null) { if (row["id"] != null && row["id"].ToString() != "") { model.id = int.Parse(row["id"].ToString()); } if (row["suppid"] != null && row["suppid"].ToString() != "") { model.suppid = int.Parse(row["suppid"].ToString()); } if (row["mode"] != null && row["mode"].ToString() != "") { model.mode = int.Parse(row["mode"].ToString()); } if (row["settledId"] != null && row["settledId"].ToString() != "") { model.settledId = int.Parse(row["settledId"].ToString()); } if (row["withdrawNo"] != null) { model.withdrawNo = row["withdrawNo"].ToString(); } if (row["trade_no"] != null) { model.trade_no = row["trade_no"].ToString(); } if (row["batchNo"] != null && row["batchNo"].ToString() != "") { model.batchNo = int.Parse(row["batchNo"].ToString()); } if (row["supp_trade_no"] != null) { model.supp_trade_no = row["supp_trade_no"].ToString(); } if (row["userid"] != null && row["userid"].ToString() != "") { model.userid = int.Parse(row["userid"].ToString()); } if (row["balance"] != null && row["balance"].ToString() != "") { model.balance = decimal.Parse(row["balance"].ToString()); } if (row["bankCode"] != null) { model.bankCode = row["bankCode"].ToString(); } if (row["bankName"] != null) { model.bankName = row["bankName"].ToString(); } if (row["bankBranch"] != null) { model.bankBranch = row["bankBranch"].ToString(); } if (row["bankAccountName"] != null) { model.bankAccountName = row["bankAccountName"].ToString(); } if (row["bankAccount"] != null) { model.bankAccount = row["bankAccount"].ToString(); } if (row["amount"] != null && row["amount"].ToString() != "") { model.amount = decimal.Parse(row["amount"].ToString()); } if (row["charges"] != null && row["charges"].ToString() != "") { model.charges = decimal.Parse(row["charges"].ToString()); } if (row["balance2"] != null && row["balance2"].ToString() != "") { model.balance2 = decimal.Parse(row["balance2"].ToString()); } if (row["addTime"] != null && row["addTime"].ToString() != "") { model.addTime = DateTime.Parse(row["addTime"].ToString()); } if (row["processingTime"] != null && row["processingTime"].ToString() != "") { model.processingTime = DateTime.Parse(row["processingTime"].ToString()); } if (row["supp_message"] != null) { model.supp_message = row["supp_message"].ToString(); } if (row["is_cancel"] != null && row["is_cancel"].ToString() != "") { if ((row["is_cancel"].ToString() == "1") || (row["is_cancel"].ToString().ToLower() == "true")) { model.is_cancel = true; } else { model.is_cancel = false; } } if (row["status"] != null && row["status"].ToString() != "") { model.status = int.Parse(row["status"].ToString()); } if (row["ext1"] != null) { model.ext1 = row["ext1"].ToString(); } if (row["ext2"] != null) { model.ext2 = row["ext2"].ToString(); } if (row["ext3"] != null) { model.ext3 = row["ext3"].ToString(); } if (row["remark"] != null) { model.remark = row["remark"].ToString(); } } return(model); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Model.Finance.WithdrawSuppTranLog model) { return(dal.Update(model)); }