/// <summary>
 /// 编辑和插入用户扩展信息
 /// </summary>
 /// <returns></returns>
 public bool Insert()
 {
     Model.Id = ROYcms.Common.Request.GetFormInt("Id");
     if (Model.Id > 0)
     {
         Model = BLL.GetModel(Model.Id);
     }
     Model.UserId          = ROYcms.Common.Request.GetFormInt("UserId");
     Model.AccountBalance  = ROYcms.Common.Request.GetFormInt("AccountBalance");
     Model.AvilableBalance = ROYcms.Common.Request.GetFormInt("AvilableBalance");
     Model.ConsumedAmount  = ROYcms.Common.Request.GetFormInt("ConsumedAmount");
     Model.Money           = ROYcms.Common.Request.GetFormInt("Money");
     Model.GradeID         = ROYcms.Common.Request.GetFormInt("GradeID");
     Model.State           = ROYcms.Common.Request.GetFormInt("State");
     Model.RealName        = ROYcms.Common.Request.GetFormString("RealName");
     Model.Qq          = ROYcms.Common.Request.GetFormInt("Qq");
     Model.Mobil       = ROYcms.Common.Request.GetFormString("Mobil");
     Model.Tel         = ROYcms.Common.Request.GetFormString("Tel");
     Model.Address     = ROYcms.Common.Request.GetFormString("Address");
     Model.Postcode    = ROYcms.Common.Request.GetFormString("Postcode");
     Model.Website     = ROYcms.Common.Request.GetFormString("Website");
     Model.IDcardNum   = ROYcms.Common.Request.GetFormString("IDcardNum");
     Model.AccountType = ROYcms.Common.Request.GetFormInt("AccountType");
     Model.SiteID      = ROYcms.Common.Request.GetFormInt("SiteID");
     if (Model.Id > 0)
     {
         return(BLL.Add(Model) > 0);
     }
     else
     {
         return(BLL.Update(Model));
     }
 }
        /// <summary>
        /// 设置等级
        /// </summary>
        /// <param name="id"></param>
        /// <param name="GradeID"></param>
        /// <returns></returns>
        public bool setGrade(int id, int GradeID)
        {
            Model         = Bll.GetModel_(id);
            Model.GradeID = GradeID;

            return(Bll.Update(Model));
        }
Beispiel #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request["id"] != null)
     {
         Model  = BLL.GetModel(Convert.ToInt32(Request["id"]));
         Model1 = BLL1.GetModel(Convert.ToInt32(Request["id"]));
     }
 }
Beispiel #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int PRE = 0;

            Model.Id = ROYcms.Common.Request.GetFormInt("Id");
            if (Model.Id > 0)//编辑
            {
                Model = BLL.GetModel(Model.Id);
            }

            Model.UserId          = ROYcms.Common.Request.GetFormInt("UserId");
            Model.AccountBalance  = ROYcms.Common.Request.GetFormInt("AccountBalance");
            Model.AvilableBalance = ROYcms.Common.Request.GetFormInt("AvilableBalance");
            Model.ConsumedAmount  = ROYcms.Common.Request.GetFormInt("ConsumedAmount");
            Model.Money           = ROYcms.Common.Request.GetFormInt("Money");
            Model.GradeID         = ROYcms.Common.Request.GetFormInt("GradeID");
            Model.State           = ROYcms.Common.Request.GetFormInt("State");
            Model.RealName        = ROYcms.Common.Request.GetFormString("RealName");
            Model.Qq          = ROYcms.Common.Request.GetFormInt("Qq");
            Model.Mobil       = ROYcms.Common.Request.GetFormString("Mobil");
            Model.Tel         = ROYcms.Common.Request.GetFormString("Tel");
            Model.Address     = ROYcms.Common.Request.GetFormString("Address");
            Model.Postcode    = ROYcms.Common.Request.GetFormString("Postcode");
            Model.Website     = ROYcms.Common.Request.GetFormString("Website");
            Model.IDcardNum   = ROYcms.Common.Request.GetFormString("IDcardNum");
            Model.AccountType = ROYcms.Common.Request.GetFormInt("AccountType");
            Model.SiteID      = ROYcms.Common.Request.GetFormInt("SiteID");

            if (Model.Id == 0)//添加
            {
                PRE = this.BLL.Add(this.Model);
            }
            else //编辑
            {
                PRE = this.BLL.Update(this.Model) == true ? 1 : 0;
            }

            Response.ContentType = "text/plain";
            Response.Write(PRE);
        }
        /// <summary>
        /// 添加用户扩展信息 初始化信息
        /// </summary>
        /// <returns></returns>
        public bool adduserinfor(int UserId)
        {
            ROYcms.Sys.BLL.ROYcms_UserInfo UserInfoBLL = new ROYcms.Sys.BLL.ROYcms_UserInfo();

            ROYcms.Sys.Model.ROYcms_UserInfo UserInfoModel = new ROYcms.Sys.Model.ROYcms_UserInfo();
            UserInfoModel.UserId          = UserId;
            UserInfoModel.AccountBalance  = 0;
            UserInfoModel.AvilableBalance = 0;
            UserInfoModel.ConsumedAmount  = 0;
            UserInfoModel.Money           = 0;
            UserInfoModel.GradeID         = 1;
            UserInfoModel.State           = 1;
            UserInfoModel.RealName        = "";
            UserInfoModel.Qq          = 0;
            UserInfoModel.Mobil       = "";
            UserInfoModel.Tel         = "";
            UserInfoModel.Address     = "";
            UserInfoModel.Postcode    = "";
            UserInfoModel.Website     = "";
            UserInfoModel.IDcardNum   = "";
            UserInfoModel.AccountType = 0;
            UserInfoModel.SiteID      = 0;
            return(UserInfoBLL.Add(UserInfoModel) > 0);
        }
Beispiel #6
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void Page_Load(object sender, EventArgs e)
 {
     Model = BLL.GetModel(Convert.ToInt32(ROYcms.Common.Session.Get("user_id")));
     Bind();
 }
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(ROYcms.Sys.Model.ROYcms_UserInfo model)
        {
            StringBuilder strSql  = new StringBuilder();
            StringBuilder strSql1 = new StringBuilder();
            StringBuilder strSql2 = new StringBuilder();

            strSql1.Append("UserId,");
            strSql2.Append("" + model.UserId + ",");


            strSql1.Append("AccountBalance,");
            strSql2.Append("" + model.AccountBalance + ",");


            strSql1.Append("AvilableBalance,");
            strSql2.Append("" + model.AvilableBalance + ",");


            strSql1.Append("ConsumedAmount,");
            strSql2.Append("" + model.ConsumedAmount + ",");


            strSql1.Append("Money,");
            strSql2.Append("" + model.Money + ",");


            strSql1.Append("GradeID,");
            strSql2.Append("" + model.GradeID + ",");


            strSql1.Append("State,");
            strSql2.Append("" + model.State + ",");

            if (model.RealName != null)
            {
                strSql1.Append("RealName,");
                strSql2.Append("'" + model.RealName + "',");
            }
            if (model.Qq != null)
            {
                strSql1.Append("Qq,");
                strSql2.Append("" + model.Qq + ",");
            }
            if (model.Mobil != null)
            {
                strSql1.Append("Mobil,");
                strSql2.Append("'" + model.Mobil + "',");
            }
            if (model.Tel != null)
            {
                strSql1.Append("Tel,");
                strSql2.Append("'" + model.Tel + "',");
            }
            if (model.Address != null)
            {
                strSql1.Append("Address,");
                strSql2.Append("'" + model.Address + "',");
            }
            if (model.Postcode != null)
            {
                strSql1.Append("Postcode,");
                strSql2.Append("'" + model.Postcode + "',");
            }
            if (model.Website != null)
            {
                strSql1.Append("Website,");
                strSql2.Append("'" + model.Website + "',");
            }
            if (model.IDcardNum != null)
            {
                strSql1.Append("IDcardNum,");
                strSql2.Append("'" + model.IDcardNum + "',");
            }
            if (model.AccountType != null)
            {
                strSql1.Append("AccountType,");
                strSql2.Append("" + model.AccountType + ",");
            }

            strSql1.Append("SiteID,");
            strSql2.Append("" + model.SiteID + ",");

            strSql.Append("insert into ROYcms_UserInfo(");
            strSql.Append(strSql1.ToString().Remove(strSql1.Length - 1));
            strSql.Append(")");
            strSql.Append(" values (");
            strSql.Append(strSql2.ToString().Remove(strSql2.Length - 1));
            strSql.Append(")");
            strSql.Append(";select @@IDENTITY");
            object obj = DbHelperSQL.GetSingle(strSql.ToString());

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public ROYcms.Sys.Model.ROYcms_UserInfo GetModel(int Id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1  ");
            strSql.Append(" Id,UserId,AccountBalance,AvilableBalance,ConsumedAmount,Money,GradeID,State,RealName,Qq,Mobil,Tel,Address,Postcode,Website,IDcardNum,AccountType,SiteID ");
            strSql.Append(" from ROYcms_UserInfo ");
            strSql.Append(" where Id=" + Id + "");
            ROYcms.Sys.Model.ROYcms_UserInfo model = new ROYcms.Sys.Model.ROYcms_UserInfo();
            DataSet ds = DbHelperSQL.Query(strSql.ToString());

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["Id"] != null && ds.Tables[0].Rows[0]["Id"].ToString() != "")
                {
                    model.Id = int.Parse(ds.Tables[0].Rows[0]["Id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["UserId"] != null && ds.Tables[0].Rows[0]["UserId"].ToString() != "")
                {
                    model.UserId = int.Parse(ds.Tables[0].Rows[0]["UserId"].ToString());
                }
                if (ds.Tables[0].Rows[0]["AccountBalance"] != null && ds.Tables[0].Rows[0]["AccountBalance"].ToString() != "")
                {
                    model.AccountBalance = int.Parse(ds.Tables[0].Rows[0]["AccountBalance"].ToString());
                }
                if (ds.Tables[0].Rows[0]["AvilableBalance"] != null && ds.Tables[0].Rows[0]["AvilableBalance"].ToString() != "")
                {
                    model.AvilableBalance = int.Parse(ds.Tables[0].Rows[0]["AvilableBalance"].ToString());
                }
                if (ds.Tables[0].Rows[0]["ConsumedAmount"] != null && ds.Tables[0].Rows[0]["ConsumedAmount"].ToString() != "")
                {
                    model.ConsumedAmount = int.Parse(ds.Tables[0].Rows[0]["ConsumedAmount"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Money"] != null && ds.Tables[0].Rows[0]["Money"].ToString() != "")
                {
                    model.Money = int.Parse(ds.Tables[0].Rows[0]["Money"].ToString());
                }
                if (ds.Tables[0].Rows[0]["GradeID"] != null && ds.Tables[0].Rows[0]["GradeID"].ToString() != "")
                {
                    model.GradeID = int.Parse(ds.Tables[0].Rows[0]["GradeID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["State"] != null && ds.Tables[0].Rows[0]["State"].ToString() != "")
                {
                    model.State = int.Parse(ds.Tables[0].Rows[0]["State"].ToString());
                }
                if (ds.Tables[0].Rows[0]["RealName"] != null && ds.Tables[0].Rows[0]["RealName"].ToString() != "")
                {
                    model.RealName = ds.Tables[0].Rows[0]["RealName"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Qq"] != null && ds.Tables[0].Rows[0]["Qq"].ToString() != "")
                {
                    model.Qq = int.Parse(ds.Tables[0].Rows[0]["Qq"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Mobil"] != null && ds.Tables[0].Rows[0]["Mobil"].ToString() != "")
                {
                    model.Mobil = ds.Tables[0].Rows[0]["Mobil"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Tel"] != null && ds.Tables[0].Rows[0]["Tel"].ToString() != "")
                {
                    model.Tel = ds.Tables[0].Rows[0]["Tel"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Address"] != null && ds.Tables[0].Rows[0]["Address"].ToString() != "")
                {
                    model.Address = ds.Tables[0].Rows[0]["Address"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Postcode"] != null && ds.Tables[0].Rows[0]["Postcode"].ToString() != "")
                {
                    model.Postcode = ds.Tables[0].Rows[0]["Postcode"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Website"] != null && ds.Tables[0].Rows[0]["Website"].ToString() != "")
                {
                    model.Website = ds.Tables[0].Rows[0]["Website"].ToString();
                }
                if (ds.Tables[0].Rows[0]["IDcardNum"] != null && ds.Tables[0].Rows[0]["IDcardNum"].ToString() != "")
                {
                    model.IDcardNum = ds.Tables[0].Rows[0]["IDcardNum"].ToString();
                }
                if (ds.Tables[0].Rows[0]["AccountType"] != null && ds.Tables[0].Rows[0]["AccountType"].ToString() != "")
                {
                    model.AccountType = int.Parse(ds.Tables[0].Rows[0]["AccountType"].ToString());
                }
                if (ds.Tables[0].Rows[0]["SiteID"] != null && ds.Tables[0].Rows[0]["SiteID"].ToString() != "")
                {
                    model.SiteID = int.Parse(ds.Tables[0].Rows[0]["SiteID"].ToString());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(ROYcms.Sys.Model.ROYcms_UserInfo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update ROYcms_UserInfo set ");

            strSql.Append("UserId=" + model.UserId + ",");


            strSql.Append("AccountBalance=" + model.AccountBalance + ",");


            strSql.Append("AvilableBalance=" + model.AvilableBalance + ",");


            strSql.Append("ConsumedAmount=" + model.ConsumedAmount + ",");


            strSql.Append("Money=" + model.Money + ",");


            strSql.Append("GradeID=" + model.GradeID + ",");


            strSql.Append("State=" + model.State + ",");

            if (model.RealName != null)
            {
                strSql.Append("RealName='" + model.RealName + "',");
            }
            else
            {
                strSql.Append("RealName= null ,");
            }
            if (model.Qq != null)
            {
                strSql.Append("Qq=" + model.Qq + ",");
            }
            else
            {
                strSql.Append("Qq= null ,");
            }
            if (model.Mobil != null)
            {
                strSql.Append("Mobil='" + model.Mobil + "',");
            }
            else
            {
                strSql.Append("Mobil= null ,");
            }
            if (model.Tel != null)
            {
                strSql.Append("Tel='" + model.Tel + "',");
            }
            else
            {
                strSql.Append("Tel= null ,");
            }
            if (model.Address != null)
            {
                strSql.Append("Address='" + model.Address + "',");
            }
            else
            {
                strSql.Append("Address= null ,");
            }
            if (model.Postcode != null)
            {
                strSql.Append("Postcode='" + model.Postcode + "',");
            }
            else
            {
                strSql.Append("Postcode= null ,");
            }
            if (model.Website != null)
            {
                strSql.Append("Website='" + model.Website + "',");
            }
            else
            {
                strSql.Append("Website= null ,");
            }
            if (model.IDcardNum != null)
            {
                strSql.Append("IDcardNum='" + model.IDcardNum + "',");
            }
            else
            {
                strSql.Append("IDcardNum= null ,");
            }
            if (model.AccountType != null)
            {
                strSql.Append("AccountType=" + model.AccountType + ",");
            }
            else
            {
                strSql.Append("AccountType= null ,");
            }

            strSql.Append("SiteID=" + model.SiteID + ",");

            int n = strSql.ToString().LastIndexOf(",");

            strSql.Remove(n, 1);
            strSql.Append(" where Id=" + model.Id + "");
            int rowsAffected = DbHelperSQL.ExecuteSql(strSql.ToString());

            if (rowsAffected > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }