public void ShowInfo(string strEnerpid) { AgentModel = AgentBll.GetModel(int.Parse(strEnerpid)); txtUsername.Text = AgentModel.UserName; txtName.Text = AgentModel.Name; if (AgentModel.ParentId != 0 && AgentModel.ParentId.ToString().Length > 0) { txtPraent.Text = AgentBll.GetModel(AgentModel.ParentId).UserName; } else { txtPraent.Text = ""; } //txtPraent.Text= AgentBll. AgentModel.ParentId txtBusinessLicense.Text = AgentModel.BusinessLicense; txtCellPhone.Text = AgentModel.CellPhone; //txtAccountBank.Text = AgentModel.AccountBank; txtAccountInfo.Text = AgentModel.AccountInfo; txtAccountNum.Text = AgentModel.AccountNum; //txtWithdrawBank.Text = AgentModel.WithdrawBank; txtWithdrawInfo.Text = AgentModel.WithdrawInfo; txtWithdrawNum.Text = AgentModel.WithdrawNum; txtBalance.Text = AgentModel.Balance.ToString(); }
public void ShowInfo(string strEnerpid) { AgentModel = AgentBll.GetModel(int.Parse(strEnerpid)); txtUserName.Text = AgentModel.UserName; txtName.Text = AgentModel.Name; if (AgentModel.ParentId.ToString().Length > 0 && AgentModel.ParentId != 0) { txtParentLd.Text = AgentBll.GetModel(AgentModel.ParentId).UserName;// AgentModel.SimpleName;//显示推荐人账号 } else { txtParentLd.Text = ""; } ddlStatus.SelectedValue = AgentModel.Status.ToString(); txtBalance.Text = AgentModel.Balance.ToString(); txtBusinessLicense.Text = AgentModel.BusinessLicense; txtTelPhone.Text = AgentModel.TelPhone; txtCellPhone.Text = AgentModel.CellPhone; txtAccountBank.Text = AgentModel.AccountBank; txtAccountInfo.Text = AgentModel.AccountInfo; txtAccountNum.Text = AgentModel.AccountNum; txtWithdrawBank.Text = AgentModel.WithdrawBank; txtWithdrawInfo.Text = AgentModel.WithdrawInfo; txtWithdrawNum.Text = AgentModel.WithdrawNum; txtContactMail.Text = AgentModel.ContactMail; txtAddress.Text = AgentModel.Address; txtRemark.Text = AgentModel.Remark; }
/// <summary> /// 获取代理商名称 /// </summary> /// <param name="target"></param> /// <returns></returns> protected string GetAgentName(object target) { int agentId = YSWL.Common.Globals.SafeInt(target, 0); ColoPay.Model.Pay.Agent Model = agentBll.GetModelByCache(agentId); return(Model == null ? "平台" : Model.Name); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ColoPay.Model.Pay.Agent agentModel = agentBll.GetModel(CurrAgentID); this.txtAmount.Text = agentModel.Balance.ToString("F"); this.txtWithdrawBank.Text = agentModel.WithdrawBank; this.txtWithdrawInfo.Text = agentModel.WithdrawInfo; this.txtWithdrawNum.Text = agentModel.WithdrawNum; } }
public void btnSave_Click(object sender, System.EventArgs e) { ColoPay.Model.Pay.Agent agentModel = agentBll.GetModel(CurrAgentID); decimal amount = YSWL.Common.Globals.SafeDecimal(this.txtAmount.Text, 0); string withdrawBank = this.txtWithdrawBank.Text; string withdrawInfo = this.txtWithdrawInfo.Text; string withdrawNum = this.txtWithdrawNum.Text; string userName = this.txtUserName.Text; if (amount > agentModel.Balance) { lblMsg.Text = "提现金额不能超过余额,请重新输入!"; return; } if (String.IsNullOrWhiteSpace(withdrawBank) || String.IsNullOrWhiteSpace(withdrawInfo) || String.IsNullOrWhiteSpace(withdrawNum)) { lblMsg.Text = "提现银行不完善,请检查!"; return; } ColoPay.Model.Pay.Withdraw model = new Model.Pay.Withdraw(); model.AgentId = CurrAgentID; model.WithdrawCode = "TX" + DateTime.Now.ToString("yyyyMMddHHmmssfff"); model.Amount = amount; model.CreatedDate = DateTime.Now; model.CreatedUserId = currentUser.UserID; model.UserName = userName; model.EnterpriseID = 0; model.Type = 1; model.WithdrawBank = withdrawBank; model.WithdrawInfo = withdrawInfo; model.WithdrawNum = withdrawNum; model.Remark = txtRemark.Text; model.Status = 0; bool isSuccess = withdrawBll.AddWithdraw(model); //申请成功 if (isSuccess) { YSWL.Common.MessageBox.ShowSuccessTip(this, "申请提现成功!"); Response.Redirect("WithdrawList.aspx"); } else { YSWL.Common.MessageBox.ShowFailTip(this, "申请提现失败,请稍后再试!"); return; } }
/// <summary> /// 获取企业名称 /// </summary> /// <param name="target"></param> /// <returns></returns> protected string GetEnterpriseName(object objEnterprise, object objAgent, object objType) { int enterpriseId = YSWL.Common.Globals.SafeInt(objEnterprise, 0); int agentId = YSWL.Common.Globals.SafeInt(objAgent, 0); int type = YSWL.Common.Globals.SafeInt(objType, 0); if (type == 0) { ColoPay.Model.Pay.Enterprise enterpriseModel = enterpriseBll.GetModelByCache(enterpriseId); return(enterpriseModel == null ? "未知" : enterpriseModel.Name); } else { ColoPay.Model.Pay.Agent agentModel = agentBll.GetModelByCache(agentId); return(agentModel == null ? "未知" : agentModel.Name); } }
/// <summary> /// 得到一个对象实体 /// </summary> public ColoPay.Model.Pay.Agent GetModel(int AgentId) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 AgentId,Name,UserName,ParentId,Status,Balance,CreatedDate,CreatedUserId,BusinessLicense,TelPhone,CellPhone,AccountBank,AccountInfo,AccountNum,WithdrawBank,WithdrawInfo,WithdrawNum,ContactMail,Address,RegisterIp,Remark from Pay_Agent "); strSql.Append(" where AgentId=@AgentId"); SqlParameter[] parameters = { new SqlParameter("@AgentId", SqlDbType.Int, 4) }; parameters[0].Value = AgentId; ColoPay.Model.Pay.Agent model = new ColoPay.Model.Pay.Agent(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
public void ShowInfoEnter(string strEnerpid) { AgentModel = AgentBll.GetModel(int.Parse(strEnerpid)); lbEnterName.Text = AgentModel.UserName; }
/// <summary> /// 增加一条数据 /// </summary> public int Add(ColoPay.Model.Pay.Agent model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into Pay_Agent("); strSql.Append("Name,UserName,ParentId,Status,Balance,CreatedDate,CreatedUserId,BusinessLicense,TelPhone,CellPhone,AccountBank,AccountInfo,AccountNum,WithdrawBank,WithdrawInfo,WithdrawNum,ContactMail,Address,RegisterIp,Remark)"); strSql.Append(" values ("); strSql.Append("@Name,@UserName,@ParentId,@Status,@Balance,@CreatedDate,@CreatedUserId,@BusinessLicense,@TelPhone,@CellPhone,@AccountBank,@AccountInfo,@AccountNum,@WithdrawBank,@WithdrawInfo,@WithdrawNum,@ContactMail,@Address,@RegisterIp,@Remark)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@Name", SqlDbType.NVarChar, 100), new SqlParameter("@UserName", SqlDbType.NVarChar, 50), new SqlParameter("@ParentId", SqlDbType.Int, 4), new SqlParameter("@Status", SqlDbType.SmallInt, 2), new SqlParameter("@Balance", SqlDbType.Money, 8), new SqlParameter("@CreatedDate", SqlDbType.DateTime), new SqlParameter("@CreatedUserId", SqlDbType.Int, 4), new SqlParameter("@BusinessLicense", SqlDbType.NVarChar, 200), new SqlParameter("@TelPhone", SqlDbType.NVarChar, 50), new SqlParameter("@CellPhone", SqlDbType.NVarChar, 50), new SqlParameter("@AccountBank", SqlDbType.NVarChar, 300), new SqlParameter("@AccountInfo", SqlDbType.NVarChar, 200), new SqlParameter("@AccountNum", SqlDbType.NVarChar, 200), new SqlParameter("@WithdrawBank", SqlDbType.NVarChar, 300), new SqlParameter("@WithdrawInfo", SqlDbType.NVarChar, 200), new SqlParameter("@WithdrawNum", SqlDbType.NVarChar, 200), new SqlParameter("@ContactMail", SqlDbType.NVarChar, 50), new SqlParameter("@Address", SqlDbType.NVarChar, 50), new SqlParameter("@RegisterIp", SqlDbType.NVarChar, 50), new SqlParameter("@Remark", SqlDbType.NVarChar, 1000) }; parameters[0].Value = model.Name; parameters[1].Value = model.UserName; parameters[2].Value = model.ParentId; parameters[3].Value = model.Status; parameters[4].Value = model.Balance; parameters[5].Value = model.CreatedDate; parameters[6].Value = model.CreatedUserId; parameters[7].Value = model.BusinessLicense; parameters[8].Value = model.TelPhone; parameters[9].Value = model.CellPhone; parameters[10].Value = model.AccountBank; parameters[11].Value = model.AccountInfo; parameters[12].Value = model.AccountNum; parameters[13].Value = model.WithdrawBank; parameters[14].Value = model.WithdrawInfo; parameters[15].Value = model.WithdrawNum; parameters[16].Value = model.ContactMail; parameters[17].Value = model.Address; parameters[18].Value = model.RegisterIp; parameters[19].Value = model.Remark; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }
/// <summary> /// 得到一个对象实体 /// </summary> public ColoPay.Model.Pay.Agent DataRowToModel(DataRow row) { ColoPay.Model.Pay.Agent model = new ColoPay.Model.Pay.Agent(); if (row != null) { if (row["AgentId"] != null && row["AgentId"].ToString() != "") { model.AgentId = int.Parse(row["AgentId"].ToString()); } if (row["Name"] != null) { model.Name = row["Name"].ToString(); } if (row["UserName"] != null) { model.UserName = row["UserName"].ToString(); } if (row["ParentId"] != null && row["ParentId"].ToString() != "") { model.ParentId = int.Parse(row["ParentId"].ToString()); } if (row["Status"] != null && row["Status"].ToString() != "") { model.Status = int.Parse(row["Status"].ToString()); } if (row["Balance"] != null && row["Balance"].ToString() != "") { model.Balance = decimal.Parse(row["Balance"].ToString()); } if (row["CreatedDate"] != null && row["CreatedDate"].ToString() != "") { model.CreatedDate = DateTime.Parse(row["CreatedDate"].ToString()); } if (row["CreatedUserId"] != null && row["CreatedUserId"].ToString() != "") { model.CreatedUserId = int.Parse(row["CreatedUserId"].ToString()); } if (row["BusinessLicense"] != null) { model.BusinessLicense = row["BusinessLicense"].ToString(); } if (row["TelPhone"] != null) { model.TelPhone = row["TelPhone"].ToString(); } if (row["CellPhone"] != null) { model.CellPhone = row["CellPhone"].ToString(); } if (row["AccountBank"] != null) { model.AccountBank = row["AccountBank"].ToString(); } if (row["AccountInfo"] != null) { model.AccountInfo = row["AccountInfo"].ToString(); } if (row["AccountNum"] != null) { model.AccountNum = row["AccountNum"].ToString(); } if (row["WithdrawBank"] != null) { model.WithdrawBank = row["WithdrawBank"].ToString(); } if (row["WithdrawInfo"] != null) { model.WithdrawInfo = row["WithdrawInfo"].ToString(); } if (row["WithdrawNum"] != null) { model.WithdrawNum = row["WithdrawNum"].ToString(); } if (row["ContactMail"] != null) { model.ContactMail = row["ContactMail"].ToString(); } if (row["Address"] != null) { model.Address = row["Address"].ToString(); } if (row["RegisterIp"] != null) { model.RegisterIp = row["RegisterIp"].ToString(); } if (row["Remark"] != null) { model.Remark = row["Remark"].ToString(); } } return(model); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(ColoPay.Model.Pay.Agent model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update Pay_Agent set "); strSql.Append("Name=@Name,"); strSql.Append("UserName=@UserName,"); strSql.Append("ParentId=@ParentId,"); strSql.Append("Status=@Status,"); strSql.Append("Balance=@Balance,"); strSql.Append("CreatedDate=@CreatedDate,"); strSql.Append("CreatedUserId=@CreatedUserId,"); strSql.Append("BusinessLicense=@BusinessLicense,"); strSql.Append("TelPhone=@TelPhone,"); strSql.Append("CellPhone=@CellPhone,"); strSql.Append("AccountBank=@AccountBank,"); strSql.Append("AccountInfo=@AccountInfo,"); strSql.Append("AccountNum=@AccountNum,"); strSql.Append("WithdrawBank=@WithdrawBank,"); strSql.Append("WithdrawInfo=@WithdrawInfo,"); strSql.Append("WithdrawNum=@WithdrawNum,"); strSql.Append("ContactMail=@ContactMail,"); strSql.Append("Address=@Address,"); strSql.Append("RegisterIp=@RegisterIp,"); strSql.Append("Remark=@Remark"); strSql.Append(" where AgentId=@AgentId"); SqlParameter[] parameters = { new SqlParameter("@Name", SqlDbType.NVarChar, 100), new SqlParameter("@UserName", SqlDbType.NVarChar, 50), new SqlParameter("@ParentId", SqlDbType.Int, 4), new SqlParameter("@Status", SqlDbType.SmallInt, 2), new SqlParameter("@Balance", SqlDbType.Money, 8), new SqlParameter("@CreatedDate", SqlDbType.DateTime), new SqlParameter("@CreatedUserId", SqlDbType.Int, 4), new SqlParameter("@BusinessLicense", SqlDbType.NVarChar, 200), new SqlParameter("@TelPhone", SqlDbType.NVarChar, 50), new SqlParameter("@CellPhone", SqlDbType.NVarChar, 50), new SqlParameter("@AccountBank", SqlDbType.NVarChar, 300), new SqlParameter("@AccountInfo", SqlDbType.NVarChar, 200), new SqlParameter("@AccountNum", SqlDbType.NVarChar, 200), new SqlParameter("@WithdrawBank", SqlDbType.NVarChar, 300), new SqlParameter("@WithdrawInfo", SqlDbType.NVarChar, 200), new SqlParameter("@WithdrawNum", SqlDbType.NVarChar, 200), new SqlParameter("@ContactMail", SqlDbType.NVarChar, 50), new SqlParameter("@Address", SqlDbType.NVarChar, 50), new SqlParameter("@RegisterIp", SqlDbType.NVarChar, 50), new SqlParameter("@Remark", SqlDbType.NVarChar, 1000), new SqlParameter("@AgentId", SqlDbType.Int, 4) }; parameters[0].Value = model.Name; parameters[1].Value = model.UserName; parameters[2].Value = model.ParentId; parameters[3].Value = model.Status; parameters[4].Value = model.Balance; parameters[5].Value = model.CreatedDate; parameters[6].Value = model.CreatedUserId; parameters[7].Value = model.BusinessLicense; parameters[8].Value = model.TelPhone; parameters[9].Value = model.CellPhone; parameters[10].Value = model.AccountBank; parameters[11].Value = model.AccountInfo; parameters[12].Value = model.AccountNum; parameters[13].Value = model.WithdrawBank; parameters[14].Value = model.WithdrawInfo; parameters[15].Value = model.WithdrawNum; parameters[16].Value = model.ContactMail; parameters[17].Value = model.Address; parameters[18].Value = model.RegisterIp; parameters[19].Value = model.Remark; parameters[20].Value = model.AgentId; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
public void btnSave_Click(object sender, System.EventArgs e) { if (lbAgentid.Text.Trim() != "") { AgentModel = AgentBll.GetModel(int.Parse(lbAgentid.Text)); userModel = userbll.GetModel(AgentModel.UserName); } User newUser = new User(); #pragma warning disable CS0219 // 变量“strErr”已被赋值,但从未使用过它的值 string strErr = ""; #pragma warning restore CS0219 // 变量“strErr”已被赋值,但从未使用过它的值 //if (newUser.HasUserByUserName(txtUserName.Text)) //{ // strErr += Resources.Site.TooltipUserExist; //} //if (strErr != "") //{ // YSWL.Common.MessageBox.ShowSuccessTip(this, strErr); // return; //} newUser.UserName = txtUserName.Text; newUser.Password = AccountsPrincipal.EncryptPassword("111111"); newUser.NickName = newUser.UserName; //昵称和用户名相同 SNS模块使用 newUser.TrueName = txtName.Text; newUser.Sex = "1"; newUser.EmployeeID = 0; newUser.Activity = true; newUser.UserType = "EE"; newUser.Style = 1; newUser.User_dateCreate = DateTime.Now; newUser.User_iCreator = CurrentUser.UserID; newUser.User_dateValid = DateTime.Now; newUser.User_cLang = "zh-CN"; AgentModel.UserName = txtUserName.Text; AgentModel.Name = txtName.Text; AgentModel.ParentId = AgentBll.GetAgentId(txtParentLd.Text.Trim());// 显示推荐人ID AgentModel.Status = int.Parse(ddlStatus.SelectedValue); AgentModel.BusinessLicense = txtBusinessLicense.Text; AgentModel.TelPhone = txtTelPhone.Text; AgentModel.CellPhone = txtCellPhone.Text; AgentModel.AccountBank = txtAccountBank.Text; AgentModel.AccountInfo = txtAccountInfo.Text; AgentModel.AccountNum = txtAccountNum.Text; AgentModel.WithdrawBank = txtWithdrawBank.Text; AgentModel.WithdrawInfo = txtWithdrawInfo.Text; AgentModel.WithdrawNum = txtWithdrawNum.Text; AgentModel.Balance = decimal.Parse(txtBalance.Text.Trim()); AgentModel.ContactMail = txtContactMail.Text; AgentModel.Address = txtAddress.Text; AgentModel.CreatedDate = DateTime.Now; AgentModel.CreatedUserId = CurrentUser.UserID; AgentModel.RegisterIp = ""; AgentModel.Remark = txtRemark.Text; if (lbAgentid.Text == "") { if (AgentBll.ExistsUsername(txtUserName.Text)) { lblMsg.Text = "用户名已存在,请重新输入!"; return; } else { int userid = newUser.Create(); if (userid == -100) { //ERROR YSWL.Common.MessageBox.ShowSuccessTip(this, Resources.Site.TooltipUserExist); return; } //新增代理商成功 if (AgentBll.Add(AgentModel) > 0) { YSWL.Common.MessageBox.ShowSuccessTip(this, string.Format("新增代理商:【{0}】成功!", txtUserName.Text)); LogHelp.AddUserLog(CurrentUser.UserName, CurrentUser.UserType, string.Format("新增代理商:【{0}】", txtUserName.Text), this); Response.Redirect("AgentList.aspx"); } } } else { if (AgentBll.ExistsUsername(lbAgentid.Text, txtUserName.Text)) { lblMsg.Text = "用户名已存在,请重新输入!"; } else { userModel.UserName = txtUserName.Text; AgentBll.Update(AgentModel);//修改企业信息 YSWL.Common.MessageBox.ShowSuccessTip(this, string.Format("修改代理商信息:【{0}】成功!", txtUserName.Text)); Response.Redirect("AgentList.aspx"); } } }