Beispiel #1
0
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     this.btnSubmit.Enabled = false;
     User useModel = new User();
     string UserName = this.txtUserName.Value;
     string Email = this.txtMail.Value;
     string pwd = this.txtConfirm.Value;
     useModel.UserName = UserName;
     useModel.TrueName = UserName;
     useModel.Password = AccountsPrincipal.EncryptPassword(pwd);
     useModel.Email = Email;
     useModel.Activity = true;
     useModel.UserType = "UU";
     useModel.User_dateCreate = DateTime.Now;
     int userid = useModel.Create();
     if (userid > 0)
     {
         useModel.UserID = userid;
         FormsAuthentication.SetAuthCookie(UserName, false);
         Session["UserInfo"] = useModel;
         Session["Regsuccess"] = true;
         //查询用户购买的所有的章节ID,存储在Session里面。
         BLL.Tao.OrderItemHistory OrderItemHistoryBLL = new BLL.Tao.OrderItemHistory();
         Session["ModuleIDList"] = OrderItemHistoryBLL.GetIDList(userid);
         Response.Redirect("NRegsuccess.aspx");
     }
     else
     {
         Common.MessageBox.ShowFailTip(this, "系统忙,请稍后再试");
         return;
     }
 }
Beispiel #2
0
 public void btnSave_Click(object sender, EventArgs e)
 {
     User user = new User();
     string msg = "";
     if (user.HasUserByUserName(this.txtUserName.Text))
     {
         msg = msg + Site.TooltipUserExist;
     }
     if (msg != "")
     {
         MessageBox.ShowSuccessTip(this, msg);
     }
     else
     {
         user.UserName = this.txtUserName.Text;
         user.Password = AccountsPrincipal.EncryptPassword(this.txtPassword.Text);
         user.NickName = user.UserName;
         user.TrueName = this.txtTrueName.Text;
         user.Sex = "1";
         user.Phone = this.txtPhone.Text.Trim();
         user.Email = this.txtEmail.Text;
         user.EmployeeID = 0;
         user.Activity = true;
         user.UserType = this.radbtnlistUserType.SelectedValue;
         user.Style = 1;
         user.User_dateCreate = DateTime.Now;
         user.User_iCreator = base.CurrentUser.UserID;
         user.User_dateValid = DateTime.Now;
         user.User_cLang = "zh-CN";
         int num = user.Create();
         if (num == -100)
         {
             MessageBox.ShowSuccessTip(this, Site.TooltipUserExist);
         }
         else
         {
             UsersExp exp = new UsersExp();
             UsersExpModel model = new UsersExpModel {
                 UserID = num,
                 LastAccessTime = new DateTime?(DateTime.Now),
                 LastLoginTime = DateTime.Now,
                 LastPostTime = new DateTime?(DateTime.Now)
             };
             exp.AddUsersExp(model);
             LogHelp.AddUserLog(base.CurrentUser.UserName, base.CurrentUser.UserType, string.Format("添加用户:【{0}】", this.txtUserName.Text), this);
             base.Response.Redirect("RoleAssignment.aspx?UserID=" + num);
         }
     }
 }
Beispiel #3
0
        public void btnSave_Click(object sender, System.EventArgs e)
        {
            User newUser = new User();
            string strErr = "";
            if (newUser.HasUser(txtUserName.Text))
            {
                strErr += Resources.Site.TooltipUserExist;
            }
            if (strErr != "")
            {
                Maticsoft.Common.MessageBox.Show(this, strErr);
                return;
            }
            newUser.UserName = txtUserName.Text;
            newUser.Password = AccountsPrincipal.EncryptPassword(txtPassword.Text);
            newUser.TrueName = txtTrueName.Text;
            newUser.Sex = "1";
            //if (RadioButton1.Checked)
            //    newUser.Sex = "1";//男
            //else
            //    newUser.Sex = "0";//女
            newUser.Phone = txtPhone.Text.Trim();
            newUser.Email = txtEmail.Text;
            newUser.EmployeeID = 0;
            //newUser.DepartmentID=this.Dropdepart.SelectedValue;
            newUser.Activity = true;
            newUser.UserType = dropUserType.SelectedValue;
            newUser.Style = 1;
            newUser.User_dateCreate = DateTime.Now;
            newUser.User_iCreator = CurrentUser.UserID;
            newUser.User_dateValid = DateTime.Now;
            newUser.User_cLang = "zh-CN";

            int userid = newUser.Create();
            if (userid == -100)
            {
                this.lblMsg.Text = Resources.Site.TooltipUserExist;
                this.lblMsg.Visible = true;
            }
            else
            {
                Response.Redirect("RoleAssignment.aspx?UserID=" + userid);
            }
        }
Beispiel #4
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";
            if (this.txtIntroduction.Text.Trim().Length == 0)
            {
                strErr += "企业介绍不能为空!\\n";
            }
            if (!PageValidate.IsDateTime(txtEstablishedDate.Text))
            {
                strErr += "成立时间格式错误!\\n";
            }
            if (string.IsNullOrEmpty(hfRegionID.Value))
            {
                strErr += "请选择省/市!\\n";
            }
            User newUser = new User();
            if (newUser.HasUser(this.txtUserName.Text))
            {
                strErr += Resources.Site.TooltipUserExist;
            }
            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int EnterpriseID = 0;
            try
            {
                Maticsoft.Model.Tao.Enterprise model = new Maticsoft.Model.Tao.Enterprise();
                model.Name = this.txtName.Text;
                model.Introduction = this.txtIntroduction.Text;
                model.RegisteredCapital = 0;//this.txtRegisteredCapital.Text;
                model.TelPhone = this.txtTelPhone.Text;
                model.CellPhone = this.txtCellPhone.Text;
                model.ContactMail = this.txtContactMail.Text;
                model.RegionID = Convert.ToInt32(this.hfRegionID.Value);
                model.Address = this.txtAddress.Text;
                model.Remark = this.txtRemark.Text;
                model.Contact = this.txtContact.Text;
                model.UserName = this.txtUserName.Text;
                model.EstablishedDate = Convert.ToDateTime(this.txtEstablishedDate.Text);
                model.EstablishedCity = 0;// this.txtEstablishedCity.Text;
                model.LOGO = UploadImage(FileUploadLogo, 2);
                model.Fax = this.txtFax.Text;
                model.PostCode = this.txtPostCode.Text;
                model.HomePage = this.txtHomePage.Text;
                model.ArtiPerson = this.txtArtiPerson.Text;
                model.EnteRank = 0;// this.txtEnteRank.Text;
                model.EnteClassID = 0;// this.txtEnteClassID.Text;
                model.CompanyType = int.Parse(this.ddlCompanyType.Text);
                model.BusinessLicense = UploadImage(FileUploadBusinessLicense, 2);
                model.TaxNumber = this.txtTaxNumber.Text;
                model.AccountBank = this.txtAccountBank.Text;
                model.AccountInfo = this.txtAccountInfo.Text;
                model.ServicePhone = this.txtServicePhone.Text;
                model.QQ = this.txtQQ.Text;
                model.MSN = this.txtMSN.Text;
                model.Status = Convert.ToInt32(this.ddlStatus.SelectedValue);
                model.CreatedDate = System.DateTime.Now;
                model.CreatedUserID = CurrentUser.UserID;
                model.UpdatedDate = System.DateTime.Now;
                model.UpdatedUserID = CurrentUser.UserID;
                model.AgentID = 0;

                EnterpriseID = bll.Add(model);

                newUser.UserName = txtUserName.Text;
                newUser.Password = AccountsPrincipal.EncryptPassword("111111");
                newUser.TrueName = "";
                newUser.Sex = "1";
                newUser.Phone = this.txtCellPhone.Text;
                newUser.Email = this.txtContactMail.Text;
                newUser.EmployeeID = 0;
                newUser.DepartmentID = EnterpriseID.ToString();
                newUser.Activity = true;
                newUser.UserType = "UU";
                newUser.Style = 1;
                newUser.User_dateCreate = System.DateTime.Now;
                newUser.User_iCreator = CurrentUser.UserID;
                newUser.User_dateValid = DateTime.Now;
                newUser.User_cLang = "zh-CN";

                int userid = newUser.Create();
                if (userid == -100)
                {
                    Maticsoft.Common.MessageBox.Show(this, Resources.Site.TooltipUserExist);
                }
                else
                {
                    Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "List.aspx");
                }
            }
            catch (Exception ex)
            {
                //若创建用户失败则删除创建的企业编号。
                bll.Delete(EnterpriseID);
                throw ex;
            }
            finally
            {
            }
        }
 private ActionResult CallbackUserInfo(MediaType mediaType, AccessGrant accessGrant, string userIdOAuth, string nickNameOAuth, string emailOAuth)
 {
     if (base.CurrentUser != null)
     {
         Maticsoft.BLL.Members.UserBind bind = new Maticsoft.BLL.Members.UserBind();
         Maticsoft.Model.Members.UserBind bind2 = new Maticsoft.Model.Members.UserBind {
             MediaID = (int) mediaType,
             MediaNickName = nickNameOAuth,
             MediaUserID = userIdOAuth.ToString(),
             TokenAccess = accessGrant.AccessToken,
             UserId = (base.CurrentUser.UserType == "AA") ? -1 : base.CurrentUser.UserID,
             TokenAccess = accessGrant.AccessToken,
             TokenExpireTime = accessGrant.ExpireTime,
             Comment = true,
             iHome = true,
             GroupTopic = true
         };
         if (!bind.AddEx(bind2))
         {
             return this.Redirect("/");
         }
         if (base.currentUser.UserType == "AA")
         {
             return this.Redirect("/Admin/Accounts/UserBind.aspx");
         }
         return this.RedirectToUserBind();
     }
     string userName = string.Format("{0}_{1}", mediaType.ToString(), userIdOAuth);
     string password = userName + this.SinaSercet;
     Maticsoft.BLL.Members.Users users = new Maticsoft.BLL.Members.Users();
     User user = new User();
     if (user.HasUserByUserName(userName))
     {
         User user2 = new User(userName);
         FormsAuthentication.SetAuthCookie(userName, false);
         base.Session[Globals.SESSIONKEY_USER] = user2;
         base.Session["Style"] = user2.Style;
         new Maticsoft.BLL.Members.PointsDetail().AddPoints("Login", user2.UserID, "登录操作", "");
         if (base.Session["returnPage"] != null)
         {
             string url = base.Session["returnPage"].ToString();
             base.Session["returnPage"] = null;
             return this.Redirect(url);
         }
         return this.RedirectToHome();
     }
     User user3 = new User();
     string nickName = nickNameOAuth;
     while (user3.HasUserByNickName(nickName))
     {
         nickName = nickNameOAuth + "_" + Globals.GenRandomCodeFor6();
     }
     user.UserName = userName;
     user.Email = emailOAuth;
     user.Password = AccountsPrincipal.EncryptPassword(password);
     user.Activity = true;
     user.UserType = "UU";
     user.NickName = nickName;
     user.Style = 1;
     user.User_dateCreate = DateTime.Now;
     user.User_cLang = "zh-CN";
     int num = user.Create();
     if (num <= 0)
     {
         return this.Redirect("/");
     }
     UsersExp model = new UsersExp {
         UserID = num,
         Email = emailOAuth,
         Gravatar = string.Format("/{0}/User/Gravatar/{1}", Maticsoft.Components.MvcApplication.UploadFolder, num),
         BirthdayVisible = 0,
         BirthdayIndexVisible = false,
         ConstellationVisible = 0,
         ConstellationIndexVisible = false,
         NativePlaceVisible = 0,
         NativePlaceIndexVisible = false,
         RegionId = 0,
         AddressVisible = 0,
         AddressIndexVisible = false,
         BodilyFormVisible = 0,
         BodilyFormIndexVisible = false,
         BloodTypeVisible = 0,
         BloodTypeIndexVisible = false,
         MarriagedVisible = 0,
         MarriagedIndexVisible = false,
         PersonalStatusVisible = 0,
         PersonalStatusIndexVisible = false,
         LastAccessIP = "",
         LastAccessTime = new DateTime?(DateTime.Now),
         LastLoginTime = DateTime.Now,
         LastPostTime = new DateTime?(DateTime.Now)
     };
     if (!model.AddUsersExp(model))
     {
         users.Delete(num);
         new UsersExp().DeleteUsersExp(num);
         return this.Redirect("/");
     }
     User user4 = new User(userName);
     FormsAuthentication.SetAuthCookie(userName, false);
     base.Session[Globals.SESSIONKEY_USER] = user4;
     base.Session["Style"] = user4.Style;
     if (Maticsoft.BLL.SysManage.ConfigSystem.GetValueByCache("SNS_Register_IsBind") == "1")
     {
         Maticsoft.BLL.Members.UserBind bind3 = new Maticsoft.BLL.Members.UserBind();
         Maticsoft.Model.Members.UserBind bind4 = new Maticsoft.Model.Members.UserBind {
             MediaID = (int) mediaType,
             MediaNickName = nickNameOAuth,
             MediaUserID = userIdOAuth,
             TokenAccess = accessGrant.AccessToken,
             TokenExpireTime = accessGrant.ExpireTime,
             UserId = num,
             TokenAccess = accessGrant.AccessToken,
             TokenExpireTime = accessGrant.ExpireTime,
             Comment = true,
             iHome = true,
             GroupTopic = true
         };
         if (!bind3.AddEx(bind4))
         {
             return this.Redirect("/");
         }
     }
     string valueByCache = Maticsoft.BLL.SysManage.ConfigSystem.GetValueByCache("DefaultGravatar");
     valueByCache = string.IsNullOrEmpty(valueByCache) ? "/Upload/User/Gravatar/Default.jpg" : valueByCache;
     string str7 = Maticsoft.BLL.SysManage.ConfigSystem.GetValueByCache("TargetGravatarFile");
     str7 = string.IsNullOrEmpty(str7) ? "/Upload/User/Gravatar/" : str7;
     string str8 = base.ControllerContext.HttpContext.Server.MapPath("/");
     if (File.Exists(str8 + valueByCache))
     {
         File.Copy(str8 + valueByCache, string.Concat(new object[] { str8, str7, user4.UserID, ".jpg" }), true);
     }
     new Maticsoft.BLL.Members.PointsDetail().AddPoints("Register", num, "注册成功", "");
     Maticsoft.Model.SNS.UserAlbums albums = new Maticsoft.Model.SNS.UserAlbums();
     Maticsoft.BLL.SNS.UserAlbums albums2 = new Maticsoft.BLL.SNS.UserAlbums();
     Maticsoft.BLL.SNS.UserShip ship = new Maticsoft.BLL.SNS.UserShip();
     albums.AlbumName = "默认专辑";
     albums.CreatedDate = DateTime.Now;
     albums.CreatedNickName = user4.NickName;
     albums.CreatedUserID = user4.UserID;
     albums2.AddEx(albums, 1);
     ship.GiveUserFellow(user4.UserID);
     return this.RedirectToHome();
 }
Beispiel #6
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     string userName = this.txtUserName.Text.Trim();
     string password = this.txtPassword.Text.Trim();
     if (userName.Length == 0)
     {
         MessageBox.ShowServerBusyTip(this, "用户名不能为空!");
     }
     else
     {
         User user = new User();
         if (user.HasUserByUserName(userName))
         {
             MessageBox.ShowServerBusyTip(this, Site.TooltipUserExist);
         }
         else if (password.Length == 0)
         {
             MessageBox.ShowServerBusyTip(this, "密码不能为空!");
         }
         else if (password.Length > 0x10)
         {
             MessageBox.ShowServerBusyTip(this, "密码不能超过16个字符!");
         }
         else
         {
             string name = this.txtName.Text.Trim();
             if (name.Length == 0)
             {
                 MessageBox.ShowServerBusyTip(this, "企业名称不能为空!");
             }
             else if (name.Length > 100)
             {
                 MessageBox.ShowServerBusyTip(this, "企业名称请控制在1~100字符!");
             }
             else if (this.bll.Exists(name))
             {
                 MessageBox.ShowServerBusyTip(this, "该企业名称已经被注册,请更换企业名称再操作!");
             }
             else
             {
                 int enterpriseID = 0;
                 try
                 {
                     Maticsoft.Model.Ms.Enterprise model = new Maticsoft.Model.Ms.Enterprise {
                         Name = name,
                         Introduction = this.txtIntroduction.Text,
                         RegisteredCapital = new int?(Globals.SafeInt(this.txtRegisteredCapital.Text, 0)),
                         TelPhone = this.txtTelPhone.Text,
                         CellPhone = this.txtCellPhone.Text,
                         ContactMail = this.txtContactMail.Text,
                         RegionID = new int?(this.RegionID.Region_iID),
                         Address = this.txtAddress.Text,
                         Remark = this.txtRemark.Text,
                         Contact = this.txtContact.Text,
                         UserName = this.txtUserName.Text
                     };
                     string text = this.txtEstablishedDate.Text;
                     if (PageValidate.IsDateTime(text))
                     {
                         model.EstablishedDate = new DateTime?(Globals.SafeDateTime(text, DateTime.Now));
                     }
                     else
                     {
                         model.EstablishedDate = null;
                     }
                     model.EstablishedCity = new int?(this.RegionEstablishedCity.Region_iID);
                     model.LOGO = this.txtLOGO.Text;
                     model.Fax = this.txtFax.Text;
                     model.PostCode = this.txtPostCode.Text;
                     model.HomePage = this.txtHomePage.Text;
                     model.ArtiPerson = this.txtArtiPerson.Text;
                     model.EnteRank = new int?(Globals.SafeInt(this.dropEnteRank.SelectedValue, 0));
                     model.EnteClassID = new int?(Globals.SafeInt(this.dropEnteClassID.SelectedValue, 0));
                     model.CompanyType = new int?(Globals.SafeInt(this.dropCompanyType.SelectedValue, 0));
                     model.BusinessLicense = this.txtBusinessLicense.Text;
                     model.TaxNumber = this.txtTaxNumber.Text;
                     model.AccountBank = this.txtAccountBank.Text;
                     model.AccountInfo = this.txtAccountInfo.Text;
                     model.ServicePhone = this.txtServicePhone.Text;
                     model.QQ = this.txtQQ.Text;
                     model.MSN = this.txtMSN.Text;
                     model.Status = new int?(Globals.SafeInt(this.radlStatus.SelectedValue, 0));
                     model.CreatedDate = new DateTime?(DateTime.Now);
                     model.CreatedUserID = new int?(base.CurrentUser.UserID);
                     model.UpdatedDate = new DateTime?(DateTime.Now);
                     model.UpdatedUserID = new int?(base.CurrentUser.UserID);
                     model.Balance = Globals.SafeDecimal(this.txtBalance.Text, (decimal) 0M);
                     model.AgentID = Globals.SafeInt(this.txtAgentID.Text, 0);
                     enterpriseID = this.bll.Add(model);
                     if (enterpriseID > 0)
                     {
                         user.UserName = userName;
                         user.NickName = this.txtName.Text;
                         user.Password = AccountsPrincipal.EncryptPassword(password);
                         user.TrueName = "";
                         user.Sex = "1";
                         user.Phone = this.txtCellPhone.Text;
                         user.Email = this.txtContactMail.Text;
                         user.EmployeeID = 0;
                         user.DepartmentID = enterpriseID.ToString();
                         user.Activity = true;
                         user.UserType = "EE";
                         user.Style = 1;
                         user.User_dateCreate = DateTime.Now;
                         user.User_iCreator = base.CurrentUser.UserID;
                         user.User_dateValid = DateTime.Now;
                         user.User_cLang = "zh-CN";
                         int userID = user.Create();
                         if (userID == -100)
                         {
                             this.bll.Delete(enterpriseID);
                             MessageBox.ShowServerBusyTip(this, Site.TooltipUserExist);
                         }
                         else
                         {
                             UsersExp exp = new UsersExp {
                                 UserID = userID,
                                 BirthdayVisible = 0,
                                 BirthdayIndexVisible = false,
                                 ConstellationVisible = 0,
                                 ConstellationIndexVisible = false,
                                 NativePlaceVisible = 0,
                                 NativePlaceIndexVisible = false,
                                 RegionId = 0,
                                 AddressVisible = 0,
                                 AddressIndexVisible = false,
                                 BodilyFormVisible = 0,
                                 BodilyFormIndexVisible = false,
                                 BloodTypeVisible = 0,
                                 BloodTypeIndexVisible = false,
                                 MarriagedVisible = 0,
                                 MarriagedIndexVisible = false,
                                 PersonalStatusVisible = 0,
                                 PersonalStatusIndexVisible = false,
                                 LastAccessIP = "",
                                 LastAccessTime = new DateTime?(DateTime.Now),
                                 LastLoginTime = DateTime.Now,
                                 LastPostTime = new DateTime?(DateTime.Now)
                             };
                             if (exp.AddUsersExp(exp))
                             {
                                 MessageBox.ShowSuccessTip(this, "添加成功!", "List.aspx");
                             }
                             else
                             {
                                 user.UserID = userID;
                                 user.Delete();
                                 exp.DeleteUsersExp(userID);
                                 this.bll.Delete(enterpriseID);
                                 MessageBox.ShowFailTip(this, "添加失败!");
                             }
                         }
                     }
                     else
                     {
                         this.bll.Delete(enterpriseID);
                         MessageBox.ShowFailTip(this, "添加失败!");
                     }
                 }
                 catch (Exception exception)
                 {
                     this.bll.Delete(enterpriseID);
                     throw exception;
                 }
             }
         }
     }
 }