public int SaveOnlinePayConfig(OnlinePayConfig config) { var prams = new List <DbParameter> { Database.MakeInParam("PayType", config.PayType), Database.MakeInParam("PayName", config.PayName), Database.MakeInParam("UID", config.UID), Database.MakeInParam("PayUrl", config.PayUrl), Database.MakeInParam("Md5key", config.Md5key), Database.MakeInParam("PrivateKey", config.PrivateKey), Database.MakeInParam("PublicKey", config.PublicKey), Database.MakeInParam("MaxAmount", config.MaxAmount), Database.MakeInParam("MinAmount", config.MinAmount), Database.MakeInParam("ShoutCut", config.ShoutCut), Database.MakeInParam("PayIdentity", config.PayIdentity), Database.MakeInParam("SortID", config.SortID), Database.MakeInParam("PresentScore", config.PresentScore), Database.MakeInParam("FristPresent", config.FristPresent), Database.MakeInParam("ChanelID", config.ChanelID), Database.MakeInParam("Nullity", config.Nullity), Database.MakeInParam("ChanelName", config.ChanelName), Database.MakeInParam("AttachStr1", config.AttachStr1), Database.MakeInParam("AttachStr2", config.AttachStr1) }; string sqlQuery; if (config.ID == 0) { sqlQuery = @"INSERT INTO OnlinePayConfig(PayType,PayName,UID,PayUrl,Md5key,PrivateKey,PublicKey,MinAmount,MaxAmount,ShoutCut,PayIdentity,SortID,PresentScore,FristPresent,Nullity,ChanelID,ChanelName,AttachStr1) VALUES(@PayType,@PayName,@UID,@PayUrl,@Md5key,@PrivateKey,@PublicKey,@MinAmount,@MaxAmount,@ShoutCut,@PayIdentity,@SortID,@PresentScore,@FristPresent,@Nullity,@ChanelID,@ChanelName,@AttachStr1)"; } else { prams.Add(Database.MakeInParam("ID", config.ID)); StringBuilder sql = new StringBuilder(); sql.Append("UPDATE OnlinePayConfig SET ") .Append("PayType=@PayType, ") .Append("PayName=@PayName, ") .Append("UID=@UID, ") .Append("PayUrl=@PayUrl, ") .Append("Md5key=@Md5key, ") .Append("PrivateKey=@PrivateKey, ") .Append("PublicKey=@PublicKey, ") .Append("MinAmount=@MinAmount, ") .Append("MaxAmount=@MaxAmount, ") .Append("ShoutCut=@ShoutCut, ") .Append("PayIdentity=@PayIdentity, ") .Append("SortID=@SortID, ") .Append("PresentScore=@PresentScore, ") .Append("FristPresent=@FristPresent, ") .Append("ChanelID=@ChanelID, ") .Append("ChanelName=@ChanelName, ") .Append("AttaChStr1=@AttachStr1, ") .Append("AttaChStr2=@AttachStr2, ") .Append("Nullity=@Nullity ") .Append("WHERE ID=@ID"); sqlQuery = sql.ToString(); } return(Database.ExecuteNonQuery(CommandType.Text, sqlQuery, prams.ToArray())); }
protected void btnSave_Click(object sender, EventArgs e) { OnlinePayConfig config = new OnlinePayConfig(); if (IntParam > 0) { if (!AuthUserOperationPermission(Permission.Edit)) { return; } config = FacadeManage.aideTreasureFacade.GetOnlinePayConfig(IntParam); } else { if (!AuthUserOperationPermission(Permission.Add)) { return; } } config.PayType = Convert.ToByte(ddlProductType.SelectedValue); config.PayName = CtrlHelper.GetText(txtProductName); config.UID = CtrlHelper.GetText(tetUID); config.Md5key = CtrlHelper.GetText(TexMd5); config.PublicKey = CtrlHelper.GetText(TxtPublicKey); config.PrivateKey = CtrlHelper.GetText(TxtPrivateKey); config.MaxAmount = FacadeManage.ConversionMoneyToReal(Convert.ToInt32(TextMax.Text)); config.MinAmount = FacadeManage.ConversionMoneyToReal(Convert.ToInt32(TextMin.Text)); config.ShoutCut = FacadeManage.ConverToShow(CtrlHelper.GetText(txtPrice)); config.PayIdentity = Convert.ToByte(DropDownList1.SelectedValue); config.SortID = Convert.ToInt32(SortID.Text); config.FristPresent = Convert.ToInt32(txtFristPresent.Text); config.PresentScore = Convert.ToInt32(txtPresentScore.Text); config.ChanelID = Convert.ToInt32(DropDownList2.SelectedValue); config.ChanelName = DropDownList2.SelectedItem.Text; config.AttachStr1 = CtrlHelper.GetText(AttaBox1); config.AttachStr2 = CtrlHelper.GetText(AttaBox2); config.PayUrl = CtrlHelper.GetText(TexPayUrl); config.Nullity = (byte)(ckbLock.Checked ? 1 : 0); if (IntParam > 0) { config.ID = IntParam; } int result = FacadeManage.aideTreasureFacade.SaveOnlinePayConfig(config); if (result > 0) { ShowInfo("配置信息操作成功", "OnLinePayPage.aspx", 1200); } else { ShowError("配置信息操作失败"); } }
private void BindData() { ChangePayType(Convert.ToInt32(ddlProductType.SelectedValue)); if (IntParam > 0) { OnlinePayConfig config = FacadeManage.aideTreasureFacade.GetOnlinePayConfig(IntParam); if (config != null) { ChangePayType(config.PayType); ddlProductType.SelectedValue = config.PayType.ToString(); txtProductName.Text = config.PayName; DropDownList2.SelectedValue = config.ChanelID.ToString(); tetUID.Text = config.UID; TexMd5.Text = config.Md5key; TxtPrivateKey.Text = config.PrivateKey; TxtPublicKey.Text = config.PublicKey; TextMin.Text = (config.MinAmount / 1000).ToString(); TextMax.Text = (config.MaxAmount / 1000).ToString(); ckbLock.Checked = config.Nullity == 1; string[] mm = config.ShoutCut.Split(','); string shout = ""; for (int i = 0; i < mm.Length; ++i) { shout += Convert.ToInt32(mm[i]) / 1000 + ","; } txtPrice.Text = shout.Substring(0, shout.Length - 1);; DropDownList1.SelectedValue = config.PayIdentity.ToString(); txtFristPresent.Text = config.FristPresent.ToString(); txtPresentScore.Text = config.PresentScore.ToString(); SortID.Text = config.SortID.ToString(); TexPayUrl.Text = config.PayUrl; AttaBox1.Text = config.AttachStr1; AttaBox2.Text = config.AttachStr2; } } }
public int SaveOnlinePayConfig(OnlinePayConfig config) { return(aideTreasureData.SaveOnlinePayConfig(config)); }