📄 memberadd2.aspx.cs
字号:
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using YXShop.Common;
using System.Collections.Generic;
using Shop.Web.UI;
namespace YXShop.Web.Admin.Member
{
public partial class MemberAdd2 : System.Web.UI.Page
{
BasePage bp = new BasePage();
protected void Page_Load(object sender, EventArgs e)
{
if (!PowerTree.PowerPass.isPass("008001002", PowerTree.PowerPanel.PowerType.add))
{
bp = new BasePage();
bp.PageError("对不起,你没有添加会员的权限!", "../index.aspx");
}
if (!Page.IsPostBack)
{
InitMember();
}
}
#region 会员组
private void InitMember()
{
YXShop.BLL.MemberRand membBll = new YXShop.BLL.MemberRand();
List<YXShop.Model.MemberRand> li = membBll.GetAll();
if(li.Count>0)
{
DropDownList1.DataSource = li;
DropDownList1.DataBind();
}
}
#endregion
protected void okBtn_Click(object sender, EventArgs e)
{
YXShop.BLL.MemberInfo memeber = new YXShop.BLL.MemberInfo();
YXShop.BLL.UserCommon databu = new YXShop.BLL.UserCommon();
string userName = YXShop.Common.WebUtility.replaceStr(uUserName.Text.Trim());
List<YXShop.Model.UserCommon> ucList = databu.GetListByColumn("UserName", userName);
if (ucList != null && ucList.Count == 1)
{
bp.PageError("错误的参数,用户以存在!", "javascript:history.back();");
}
else
{
#region 创建参数
YXShop.Model.MemberInfo model = new YXShop.Model.MemberInfo();
YXShop.Model.UserCommon ucModel = new YXShop.Model.UserCommon();
//会员基本信息,主表创建
#region 用户主表信息
ucModel.UserType = 0;
ucModel.UserName = userName;
ucModel.PassWord = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(this.uUserPwd.Text.Trim(), "MD5");
ucModel.UEmail = this.uUserEmail.Text;
ucModel.UQuestion = this.uFindQuestion.Text;
ucModel.USolution = this.uFindAnswer.Text;
ucModel.UCeateDate = System.DateTime.Now;
ucModel.UState = 1;
#endregion
model.uGroupId = Convert.ToInt32(this.DropDownList1.SelectedValue);
model.post = this.tbPost.Text;
model.fMemberState = this.uUserState.Checked ? 1 : 0;
#region 文件上传fMemberState
string ImgAddr = "";
if (userImgFU.HasFile)
{
string fileUpPath = ConfigurationSettings.AppSettings["memberImgFile"].ToString();
string imgPre = ConfigurationSettings.AppSettings["imgFilePre"].ToString();
ImgAddr = YXShop.DBUtility.UploadFile.UploadPicFile(userImgFU, fileUpPath, imgPre);
if (ImgAddr.StartsWith("error"))
{
YXShop.Common.alert.Show(this, ImgAddr.Replace("error:", ""));
return;
}
}
#endregion
model.uPhotoAddr = ImgAddr;
model.uPhotoH = this.imgH.Text != "" ? Convert.ToInt32(this.imgH.Text.Trim()) : 0;
model.uPhotoW = this.imgW.Text != "" ? Convert.ToInt32(this.imgW.Text.Trim()) : 0;
model.fRegisterTime = DateTime.Now;
#region 扩展属性参数
model.cAddrInfo = WebUtility.replaceStr(cAddrInfo.Text);
model.pPapersNumber = TextBox8.Text.Trim();
model.cFaxNumber = cFaxNumber.Text.Trim();
model.cHomePhone = cHomePhone.Text.Trim();
model.cICQNumber = cICQNumber.Text.Trim();
model.cMobilePhone = cMobilePhone.Text.Trim();
model.cMSNNumber = cMSNNumber.Text.Trim();
model.cOfficePhone = cOfficePhone.Text.Trim();
model.cPersonIndex = cPersonIndex.Text.Trim();
model.cPHSNumber = cPHSNumber.Text.Trim();
model.cPrefixal = WebUtility.replaceStr(cPrefixal.Text.Trim());
model.cQQNumber = cQQNumber.Text.Trim();
model.cTrueName = WebUtility.replaceStr(cTrueName.Text.Trim());
model.cUCNumber = cUCNumber.Text;
model.pAaH = pAaH.Text.Replace(",", ",").TrimEnd(',');
model.pAH = WebUtility.replaceStr(pAH.Text.Trim());
model.pBirthday = pBirthday.Date;
model.pCaH = WebUtility.replaceStr(pCaH.Text.Replace(",", ",").TrimEnd(','));
model.pEaL = WebUtility.replaceStr(pEaL.Text.Replace(",", ",").TrimEnd(','));
model.pEB = pEB.SelectedItem.Text;
model.pFamilyInfo = WebUtility.StringToHtml(WebUtility.replaceStr(string.Empty));
model.pLaH = WebUtility.replaceStr(pLaH.Text.Replace(",", ",").TrimEnd(','));
model.pMarriage = GetRadionListValue(pMarriage);
model.pMonthlyIncome = Convert.ToInt32(gongzi.SelectedValue);
model.pNation = WebUtility.replaceStr(pNation.Text);
model.pNos = WebUtility.replaceStr(pNos.Text);
model.pPaH = WebUtility.replaceStr(pPaH.Text.Replace(",", ",").TrimEnd(','));
model.pPapersType = GetDropdownListValue(pPapersType);
model.pSex = GetRadionListValue(pSex);
model.uPrivacySettings = 0;
model.dIncName = string.Empty;
model.dIncAddr = string.Empty;
model.dDepartment = string.Empty;
model.dOperation = string.Empty;
model.dPosition = string.Empty;
model.uIdiograph = this.uIdiograph.Text;
#endregion
#region Add
model.fCostFund = 0;
model.fCostIntegral = 0;
model.fCostStamps = 0;
model.fDelNoteScalar = 0;
model.fIntegral = 0;
model.fLastSignIP = string.Empty;
model.fLastSignTime = null;
model.fLeaveDays = 0;
model.fNote = string.Empty;
model.fSignInTimes = 0;
model.fSurplusCapital = 0;
model.fUsableStamps = 0;
#endregion
#endregion
if (databu.Create(ucModel) > 0)
{
List<YXShop.Model.UserCommon> dataId = databu.GetListByColumn("UserName", userName);
model.Uid = dataId[0].UID;
if (memeber.Create(model) > 0)
{
bp.PageRight("会员添加成功。<li><a href=\"MemberAdd2.aspx\" class=\"list_link\"><b><font color=\"red\">继续添加</font></b></a> ┊ <a href=\"MemberModify.aspx?ID=" + dataId[0].UID + "\" class=\"list_link\"><b><font color=\"red\">修改本条信息</font></b></a> ┊ <a href=\"MemberAllList.aspx\" class=\"list_link\"><b><font color=\"blue\">返回本栏目列表</font></b></a></li>", "MemberAllList.aspx");
}
else
{
bp.PageError("错误的参数,添加失败!", "javascript:history.back();");
}
}
else
{
bp.PageError("错误的参数,添加失败!", "javascript:history.back();");
}
}
}
/// <summary>
/// 更新参数配置
/// </summary>
/// <returns></returns>
private YXShop.Model.MemberInfo CreateUpModel()
{
YXShop.Model.MemberInfo model = new YXShop.Model.MemberInfo();
#region 上一个页面定义的参数 个数7
//model.uUserName =this.uUserName.Text;
//model.uUserPwd = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(this.uUserPwd.Text.Trim(), "MD5");
//model.uEMail = this.uUserEmail.Text;
//model.uQuestion = this.uFindQuestion.Text;
//model.uAnswer = this.uFindAnswer.Text;
YXShop.Model.UserCommon ucModel = new YXShop.Model.UserCommon();
#region 用户主表信息
ucModel.UserName = this.uUserName.Text.Trim();
ucModel.PassWord = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(this.uUserPwd.Text.Trim(), "MD5");
ucModel.UEmail = this.uUserEmail.Text;
ucModel.UQuestion = this.uFindQuestion.Text;
ucModel.USolution = this.uFindAnswer.Text;
#endregion
model.uGroupId =Convert.ToInt32(this.DropDownList1.SelectedValue);
model.uPrivacySettings = this.uUserState.Checked ? 1 : 0;
#region 文件上传
if (!userImgFU.HasFile)
{
YXShop.Common.alert.Show(this, "请选择图片路径!");
}
string fileUpPath = ConfigurationSettings.AppSettings["memberImgFile"].ToString();
string imgPre = ConfigurationSettings.AppSettings["imgFilePre"].ToString();
string ImgAddr = YXShop.DBUtility.UploadFile.UploadPicFile(userImgFU, fileUpPath, imgPre);
if (ImgAddr.StartsWith("error"))
{
YXShop.Common.alert.Show(this, ImgAddr.Replace("error:", ""));
}
#endregion
model.uPhotoAddr = ImgAddr;
model.uPhotoH = this.imgH.Text != "" ? Convert.ToInt32(this.imgH.Text.Trim()) : 0;
model.uPhotoW = this.imgW.Text != "" ? Convert.ToInt32(this.imgW.Text.Trim()) : 0;
model.fRegisterTime = DateTime.Now;
#endregion
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -