⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 computermember.aspx.cs

📁 易想商城系统
💻 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 System.Collections.Generic;

namespace YXShop.Web.Admin.Consumer
{
    public partial class ComputerMember : System.Web.UI.Page
    {
        private static int userType = -1;
        private static int userID = -1;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
               if (YXShop.Common.WebUtility.isNumeric(Request.QueryString["UserID"]) && YXShop.Common.WebUtility.isNumeric(Request.QueryString["UserType"]))
               {
                   userType = Convert.ToInt32(Request.QueryString["UserType"]);
                   userID = Convert.ToInt32(Request.QueryString["UserID"]);
                   switch (userType) 
                   {
                       case 1:
                           Label5.Text = "单位会员";
                           break;
                       case 2:
                           Label5.Text = "店铺会员";
                           break;
                       default:
                           break;
                   }
                   BindComType(DropDownList1);
               }
               else 
               {
                   Response.Redirect("UserReg.aspx", true);
               }
            }
        }

        private void BindComType(DropDownList ddl) 
        {
            ddl.Items.Clear();
            YXShop.BLL.Pro_Categories proCate = new YXShop.BLL.Pro_Categories();
            List<YXShop.Model.Pro_Categories> list = proCate.GetListByColumn("ProC_FatherID", 0);
            ListItem lItem = null;
            foreach (YXShop.Model.Pro_Categories proCateModel in list) 
            {
                lItem = new ListItem();
                lItem.Value = proCateModel.ProC_ID.ToString();
                lItem.Text = proCateModel.ProC_CategroiesName;

                ddl.Items.Add(lItem);
            }
        }
        /// <summary>
        /// 保存会员信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Button1_Click(object sender, EventArgs e)
        {

            YXShop.BLL.ComMembers comBll = new YXShop.BLL.ComMembers();
            
            string userName = YXShop.Common.WebUtility.replaceStr(TextBox1.Text.Trim());
            string upInfo1 = "", upInfo2 = "";

            List<YXShop.Model.ComMembers> list = comBll.GetListByColumn("ComName", userName);
            if (list == null) 
            {
                Label3.Text = "程序运行时错误!";
                return;
            }
            if (list != null && list.Count > 0)
            {
                Label3.Text = "该单位已经存在!";
                return;
            }
            else
            {
                if (userID == -1 || userType == -1) 
                {
                    Response.Redirect("UserReg.aspx",true);
                }
                #region 上传图片
                string fileUpPath = ConfigurationSettings.AppSettings["memberImgFile"].ToString();//保存文件的路徑,保存在会员图片文件目录下
                string imgPre = ConfigurationSettings.AppSettings["imgFilePre"].ToString();
                
                if (FileUpload1.HasFile && FileUpload2.HasFile)
                {
                    upInfo1 = YXShop.DBUtility.UploadFile.UploadPicFile(FileUpload1, fileUpPath, imgPre);//上传工商执照
                    if (upInfo1.StartsWith("error"))
                    {
                        Label4.Text = upInfo1.Replace("error:", "");
                        return;
                    }
                    else
                    {
                        upInfo2 = YXShop.DBUtility.UploadFile.UploadPicFile(FileUpload2, fileUpPath, imgPre);//上传许可证号
                        if (upInfo2.StartsWith("error"))
                        {
                            Label4.Text = upInfo2.Replace("error:", "");
                            return;
                        }
                    }
                }
                #endregion
            }
            YXShop.Model.ComMembers comModel = new YXShop.Model.ComMembers();
            comModel.UID = userID;
            comModel.ComName = userName;
            comModel.CharterPic = upInfo1;
            comModel.ComType = Convert.ToInt32(DropDownList1.SelectedValue);
            comModel.AdmissionNumber = YXShop.Common.WebUtility.replaceStr(TextBox13.Text.Trim());
            comModel.CorporationPic = upInfo2;
            comModel.CertificateOrgan = YXShop.Common.WebUtility.replaceStr(TextBox10.Text.Trim());
            comModel.IDCard = TextBox11.Text;
            comModel.TaxNo = YXShop.Common.WebUtility.replaceStr(TextBox2.Text.Trim());
            comModel.ComAddress = TextBox3.Text.Trim();
            comModel.ComPost = TextBox4.Text.Trim();
            comModel.ComPrincipal = TextBox5.Text.Trim();
            comModel.ComTel = TextBox6.Text;
            comModel.ComFax = TextBox7.Text;
            comModel.ComEmail = TextBox8.Text;
            comModel.ComWebsite = TextBox9.Text;
            comModel.ComIntegral = 0;
            comModel.MoneyBalance = 0;
            comModel.ConsumeMoney = 0;
            comModel.Province = "0";

            try
            {
                comBll.Create(comModel);
            }
            catch { }
        }

        protected void Button2_Click(object sender, EventArgs e)
        {
            Response.Redirect("UserReg.aspx",true);
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -