コード例 #1
0
ファイル: AddUser.aspx.cs プロジェクト: dmhai/ColoPay
        public void btnSave_Click(object sender, System.EventArgs e)
        {
            User   newUser = new User();
            string 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(txtPassword.Text);
            newUser.NickName = newUser.UserName;    //昵称和用户名相同 SNS模块使用
            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        = radbtnlistUserType.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)
            {
                //ERROR
                YSWL.Common.MessageBox.ShowSuccessTip(this, Resources.Site.TooltipUserExist);
                return;
            }
            UsersExp bllUsersExp = new UsersExp();

            bllUsersExp.Add(new UsersExpModel
            {
                UserID         = userid,
                LastAccessTime = DateTime.Now,
                LastLoginTime  = DateTime.Now,
                LastPostTime   = DateTime.Now
            });
            LogHelp.AddUserLog(CurrentUser.UserName, CurrentUser.UserType, string.Format("新增用户:【{0}】", txtUserName.Text), this);
            Response.Redirect("RoleAssignment.aspx?UserID=" + userid);
        }
コード例 #2
0
 public ActionResult Register(RegisterModel model)
 {
     ((dynamic) base.ViewBag).Title = "注册";
     if (Maticsoft.BLL.SysManage.ConfigSystem.GetBoolValueByCache("System_Close_Register"))
     {
         return base.RedirectToAction("TurnOff", "Error");
     }
     if (base.ModelState.IsValid)
     {
         int num = new User { UserName = model.Email, NickName = model.NickName, Password = AccountsPrincipal.EncryptPassword(model.Password), Email = model.Email, Activity = true, UserType = "UU", Style = 1, User_dateCreate = DateTime.Now, User_cLang = "zh-CN" }.Create();
         if (num != -100)
         {
             UsersExp exp = new UsersExp {
                 UserID = num,
                 BirthdayVisible = 0,
                 BirthdayIndexVisible = false,
                 Gravatar = string.Format("/{0}/User/Gravatar/{1}", MvcApplication.UploadFolder, num),
                 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))
             {
                 this.userManage.Delete(num);
                 this.userExpManage.DeleteUsersExp(num);
                 base.ModelState.AddModelError("Message", "注册失败!");
                 return base.View(model);
             }
             FormsAuthentication.SetAuthCookie(model.Email, false);
             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 = model.NickName;
             albums.CreatedUserID = num;
             albums2.AddEx(albums, 1);
             string valueByCache = Maticsoft.BLL.SysManage.ConfigSystem.GetValueByCache("DefaultGravatar");
             valueByCache = string.IsNullOrEmpty(valueByCache) ? "/Upload/User/Gravatar/Default.jpg" : valueByCache;
             string str2 = Maticsoft.BLL.SysManage.ConfigSystem.GetValueByCache("TargetGravatarFile");
             str2 = string.IsNullOrEmpty(str2) ? "/Upload/User/Gravatar/" : str2;
             string str3 = base.ControllerContext.HttpContext.Server.MapPath("/");
             if (File.Exists(str3 + valueByCache))
             {
                 File.Copy(str3 + valueByCache, string.Concat(new object[] { str3, str2, num, ".jpg" }), true);
             }
             ship.GiveUserFellow(num);
             return this.Redirect("/UserCenter/Personal");
         }
         base.ModelState.AddModelError("Message", ErrorCodeToString(MembershipCreateStatus.DuplicateUserName));
     }
     return base.View(model);
 }
コード例 #3
0
 public ActionResult User(int? page)
 {
     ((dynamic) base.ViewBag).Title = "用户搜索";
     string inputString = string.IsNullOrWhiteSpace(base.Request.Params["keyword"]) ? "" : base.Server.UrlDecode(base.Request.Params["keyword"]);
     inputString = InjectionFilter.Filter(inputString);
     Maticsoft.BLL.SNS.UserShip ship = new Maticsoft.BLL.SNS.UserShip();
     UsersExp exp = new UsersExp();
     page = new int?((page.HasValue && (page.Value > 1)) ? page.Value : 1);
     int pageSize = 10;
     int startIndex = (page.Value > 1) ? (((page.Value - 1) * pageSize) + 1) : 0;
     int endIndex = page.Value * pageSize;
     int userCountByKeyWord = exp.GetUserCountByKeyWord(inputString);
     PagedList<UsersExpModel> model = null;
     List<UsersExpModel> items = exp.GetUserListByKeyWord(inputString, "", startIndex, endIndex);
     if (base.currentUser != null)
     {
         Action<UsersExpModel> action = null;
         List<Maticsoft.Model.SNS.UserShip> shipList = ship.GetModelList("ActiveUserID = " + base.currentUser.UserID);
         if ((shipList != null) && (shipList.Count > 0))
         {
             if (action == null)
             {
                 action = delegate (UsersExpModel item) {
                     item.IsFellow = this.UserIsFellow(item.UserID, shipList);
                 };
             }
             items.ForEach(action);
         }
     }
     if ((items != null) && (items.Count > 0))
     {
         int? nullable = page;
         model = new PagedList<UsersExpModel>(items, nullable.HasValue ? nullable.GetValueOrDefault() : 1, pageSize, userCountByKeyWord);
     }
     if (base.Request.IsAjaxRequest())
     {
         return this.PartialView(base.CurrentThemeViewPath + "/Search/UserList.cshtml", model);
     }
     return base.View(base.CurrentThemeViewPath + "/Search/User.cshtml", model);
 }
コード例 #4
0
ファイル: Photos.cs プロジェクト: huaminglee/myyyyshop
 public TargetDetail GetPhotoAssistionInfo(int pid, int type = -1)
 {
     TargetDetail detail = new TargetDetail();
     UsersExp exp = new UsersExp();
     Maticsoft.BLL.SNS.UserAlbums albums = new Maticsoft.BLL.SNS.UserAlbums();
     Maticsoft.BLL.SNS.UserAlbumDetail detail2 = new Maticsoft.BLL.SNS.UserAlbumDetail();
     detail.Photo = this.GetModel(pid);
     detail.UserModel = exp.GetUsersExpModel(detail.Userid);
     detail.UserAlums = albums.GetUserAlbum(0, detail.TargetId, detail.Userid);
     if (detail.UserAlums != null)
     {
         detail.CovorImageList = detail2.GetThumbImageByAlbum(detail.UserAlums.AlbumID, type);
     }
     return detail;
 }
コード例 #5
0
 public PartialViewResult ProfileLeft(int? uid)
 {
     Maticsoft.BLL.SNS.UserShip ship = new Maticsoft.BLL.SNS.UserShip();
     UsersExp exp = new UsersExp();
     UsersExpModel usersExpModel = new UsersExpModel();
     Maticsoft.BLL.SNS.Groups groups = new Maticsoft.BLL.SNS.Groups();
     int userid = uid.HasValue ? uid.Value : ((base.currentUser != null) ? base.currentUser.UserID : 0);
     List<Maticsoft.Model.SNS.UserShip> list = ship.GetToListByFansPage(userid, "", 0, 9);
     List<Maticsoft.Model.SNS.Groups> userJoinGroup = groups.GetUserJoinGroup(userid, 9);
     List<Maticsoft.Model.SNS.Groups> modelList = groups.GetModelList("CreatedUserId=" + userid);
     usersExpModel = exp.GetUsersExpModel(userid);
     ((dynamic) base.ViewBag).FansCount = (usersExpModel != null) ? usersExpModel.FansCount : 0;
     ((dynamic) base.ViewBag).IsCurrentUser = !uid.HasValue && (base.currentUser != null);
     ((dynamic) base.ViewBag).UserId = userid;
     Maticsoft.ViewModel.SNS.ProfileLeft model = new Maticsoft.ViewModel.SNS.ProfileLeft {
         joingroupList = userJoinGroup,
         shipList = list,
         creategroupList = modelList
     };
     return this.PartialView("_ProfileLeft", model);
 }
コード例 #6
0
 public ActionResult StarDPI(int? UserId)
 {
     if (UserId.HasValue)
     {
         UsersExpModel usersExpModelByCache = new UsersExp().GetUsersExpModelByCache(UserId.Value);
         if ((usersExpModelByCache != null) && usersExpModelByCache.IsUserDPI)
         {
             ((dynamic) base.ViewBag).IsUserDPI = true;
         }
         else
         {
             ((dynamic) base.ViewBag).IsUserDPI = false;
         }
     }
     else
     {
         ((dynamic) base.ViewBag).IsUserDPI = false;
     }
     return base.View("_StarDPI");
 }
コード例 #7
0
 public ActionResult AjaxUserInfo(int? UserID, string NickName)
 {
     Maticsoft.BLL.Members.Users users = new Maticsoft.BLL.Members.Users();
     UsersExp exp = new UsersExp();
     UsersExpModel usersModel = new UsersExpModel();
     if (!string.IsNullOrEmpty(NickName))
     {
         int userIdByNickName = users.GetUserIdByNickName(NickName);
         if (userIdByNickName <= 0)
         {
             return base.View("_AjaxUserInfo", usersModel);
         }
         UserID = new int?(userIdByNickName);
     }
     if (UserID.HasValue)
     {
         usersModel = exp.GetUsersModel(UserID.Value);
         string regionNameByRID = new Maticsoft.BLL.Ms.Regions().GetRegionNameByRID(Globals.SafeInt(usersModel.Address, 0));
         if (regionNameByRID.Contains("北京北京"))
         {
             regionNameByRID = regionNameByRID.Replace("北京北京", "北京");
         }
         else if (regionNameByRID.Contains("上海上海"))
         {
             regionNameByRID = regionNameByRID.Replace("上海上海", "上海");
         }
         else if (regionNameByRID.Contains("重庆重庆"))
         {
             regionNameByRID = regionNameByRID.Replace("重庆重庆", "重庆");
         }
         else if (regionNameByRID.Contains("天津天津"))
         {
             regionNameByRID = regionNameByRID.Replace("天津天津", "天津");
         }
         usersModel.Address = string.IsNullOrEmpty(usersModel.Address) ? "暂未设置" : regionNameByRID;
     }
     Maticsoft.BLL.SNS.UserShip ship = new Maticsoft.BLL.SNS.UserShip();
     if (base.currentUser != null)
     {
         if (base.currentUser.UserID == UserID.Value)
         {
             ((dynamic) base.ViewBag).IsSelf = true;
         }
         else if (ship.Exists(base.currentUser.UserID, UserID.Value))
         {
             ((dynamic) base.ViewBag).IsFellow = true;
         }
     }
     return base.View("_AjaxUserInfo", usersModel);
 }
コード例 #8
0
 public UsersExpModel GetUserModel(int UserID)
 {
     UsersExp exp = new UsersExp();
     UsersExpModel model = new UsersExpModel();
     return exp.GetUsersModel(UserID);
 }
コード例 #9
0
 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();
 }
コード例 #10
0
ファイル: Step.cs プロジェクト: huaminglee/myyyyshop
 private bool CreateUser(out string errorMsg)
 {
     try
     {
         Maticsoft.Model.Members.Users users;
         errorMsg = "";
         users = new Maticsoft.Model.Members.Users {
             Activity = true,
             DepartmentID = "",
             EmployeeID = -1,
             Email = this.txtEmail.Text.Trim(),
             UserName = users.NickName = this.txtUserName.Text.Trim(),
             Password = AccountsPrincipal.EncryptPassword(this.txtPassword.Text),
             UserType = "AA",
             Style = 1,
             User_dateCreate = new DateTime?(DateTime.Now)
         };
         if (!this.AddUser(users))
         {
             errorMsg = "创建管理员帐号失败";
             return false;
         }
         UsersExp model = new UsersExp {
             UserID = 1,
             BirthdayVisible = 0,
             BirthdayIndexVisible = false,
             Gravatar = "/Upload/User/Gravatar/1",
             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 (!this.AddUserExp(model))
         {
             errorMsg = "创建管理员帐号扩展数据添加失败";
             return false;
         }
         if (!this.AddUserRoles(1, 1))
         {
             errorMsg = "创建管理员角色数据失败";
             return false;
         }
         return true;
     }
     catch (Exception exception)
     {
         errorMsg = exception.Message;
         return false;
     }
 }
コード例 #11
0
ファイル: Add.cs プロジェクト: huaminglee/myyyyshop
 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 supplierId = 0;
                 try
                 {
                     Maticsoft.Model.Shop.Supplier.SupplierInfo model = new Maticsoft.Model.Shop.Supplier.SupplierInfo {
                         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.Rank = Globals.SafeInt(this.dropEnteRank.SelectedValue, 0);
                     model.CategoryId = 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 = Globals.SafeInt(this.radlStatus.SelectedValue, 0);
                     model.CreatedDate = DateTime.Now;
                     model.CreatedUserId = 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);
                     supplierId = this.bll.Add(model);
                     if (supplierId > 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 = supplierId.ToString();
                         user.Activity = true;
                         user.UserType = "SP";
                         user.Style = 1;
                         user.User_dateCreate = DateTime.Now;
                         user.User_iCreator = base.CurrentUser.UserID;
                         user.User_dateValid = DateTime.Now;
                         user.User_cLang = "zh-CN";
                         user.UserID = user.Create();
                         if (user.UserID == -100)
                         {
                             this.bll.Delete(supplierId);
                             MessageBox.ShowServerBusyTip(this, Site.TooltipUserExist);
                         }
                         else
                         {
                             model.UserId = user.UserID;
                             this.bll.Update(model);
                             int intValueByCache = ConfigSystem.GetIntValueByCache("DefaultSuppRoleID");
                             if (intValueByCache > 0)
                             {
                                 user.AddToRole(intValueByCache);
                             }
                             UsersExp exp = new UsersExp {
                                 UserID = user.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.Delete();
                                 exp.DeleteUsersExp(user.UserID);
                                 this.bll.Delete(supplierId);
                                 MessageBox.ShowFailTip(this, "添加失败!");
                             }
                         }
                     }
                     else
                     {
                         this.bll.Delete(supplierId);
                         MessageBox.ShowFailTip(this, "添加失败!");
                     }
                 }
                 catch (Exception exception)
                 {
                     this.bll.Delete(supplierId);
                     throw exception;
                 }
             }
         }
     }
 }
コード例 #12
0
ファイル: StarRank.cs プロジェクト: huaminglee/myyyyshop
 public List<Maticsoft.ViewModel.SNS.StarRank> HotStarList(int top = 4)
 {
     List<Maticsoft.ViewModel.SNS.StarRank> list = new List<Maticsoft.ViewModel.SNS.StarRank>();
     DataSet set = this.dal.GetList(top, " IsRecommend='true'", " Sequence");
     List<Maticsoft.Model.SNS.StarRank> list2 = this.DataTableToList(set.Tables[0]);
     UsersExp exp = new UsersExp();
     foreach (Maticsoft.Model.SNS.StarRank rank2 in list2)
     {
         Maticsoft.ViewModel.SNS.StarRank item = new Maticsoft.ViewModel.SNS.StarRank(rank2);
         UsersExpModel usersExpModel = exp.GetUsersExpModel(rank2.UserId);
         if (usersExpModel != null)
         {
             item.FansCount = usersExpModel.FansCount.Value;
             item.FavouritesCount = usersExpModel.FavoritedCount.Value;
             item.ProductsCount = usersExpModel.ProductsCount.Value;
             item.Singature = usersExpModel.Singature;
             item.IsFellow = usersExpModel.IsFellow;
         }
         list.Add(item);
     }
     return list;
 }
コード例 #13
0
ファイル: StarRank.cs プロジェクト: huaminglee/myyyyshop
 public List<Maticsoft.ViewModel.SNS.StarRank> GetStarRankList(int StarType, int top = 10)
 {
     List<Maticsoft.ViewModel.SNS.StarRank> list = new List<Maticsoft.ViewModel.SNS.StarRank>();
     DataSet set = new DataSet();
     if (StarType == 0)
     {
         set = this.dal.GetList(top, " RankType=0 and  Status=1", " Sequence");
     }
     else
     {
         set = this.dal.GetList(top, "  RankType=0 and  Status=1 and TypeID=" + StarType, " Sequence");
     }
     List<Maticsoft.Model.SNS.StarRank> list2 = this.DataTableToList(set.Tables[0]);
     UsersExp exp = new UsersExp();
     foreach (Maticsoft.Model.SNS.StarRank rank2 in list2)
     {
         Maticsoft.ViewModel.SNS.StarRank item = new Maticsoft.ViewModel.SNS.StarRank(rank2);
         UsersExpModel usersExpModel = exp.GetUsersExpModel(rank2.UserId);
         if (usersExpModel != null)
         {
             item.FansCount = usersExpModel.FansCount.Value;
             item.FavouritesCount = usersExpModel.FavoritedCount.Value;
             item.ProductsCount = usersExpModel.ProductsCount.Value;
             item.Singature = usersExpModel.Singature;
             item.IsFellow = usersExpModel.IsFellow;
         }
         list.Add(item);
     }
     return list;
 }