protected string EmailSuffix(string sUserID) { int userID = Globals.SafeInt(Globals.UrlDecode(sUserID), 0); Maticsoft.Model.Members.Users model = new Maticsoft.BLL.Members.Users().GetModel(userID); if (model != null) { return model.Email; } return ""; }
protected string GetUserName(int userId) { if (userId > 0) { Maticsoft.Model.Members.Users model = new Maticsoft.BLL.Members.Users().GetModel(userId); if (model != null) { return model.UserName; } } return ""; }
public string GetUser(object obj, object ReceiverID) { if (obj != null) { string description = this.UserType.GetDescription(obj.ToString()); if (description != null) { return description; } } else if (PageValidate.IsNumber(ReceiverID.ToString())) { Maticsoft.Model.Members.Users model = new Maticsoft.BLL.Members.Users().GetModel(Convert.ToInt32(ReceiverID)); if (model != null) { return model.UserName; } } return ""; }
public void SendMsg(FormCollection collection) { JsonObject obj2 = new JsonObject(); string str = InjectionFilter.Filter(collection["NickName"]); string str2 = InjectionFilter.Filter(collection["Content"]); string str3 = InjectionFilter.Filter(collection["Content"]); if (string.IsNullOrWhiteSpace(str)) { obj2.Accumulate("STATUS", "NICKNAMENULL"); } else if (string.IsNullOrWhiteSpace(str2)) { obj2.Accumulate("STATUS", "TITLENULL"); } else if (string.IsNullOrWhiteSpace(str3)) { obj2.Accumulate("STATUS", "CONTENTNULL"); } else { Maticsoft.BLL.Members.Users users = new Maticsoft.BLL.Members.Users(); if (users.ExistsNickName(str)) { int userIdByNickName = users.GetUserIdByNickName(str); Maticsoft.Model.Members.SiteMessage model = new Maticsoft.Model.Members.SiteMessage { Title = str2, Content = str3, SenderID = new int?(base.CurrentUser.UserID), ReaderIsDel = false, ReceiverIsRead = false, SenderIsDel = false, ReceiverID = new int?(userIdByNickName), SendTime = new DateTime?(DateTime.Now) }; if (this.bllSM.Add(model) > 0) { obj2.Accumulate("STATUS", "SUCC"); } else { obj2.Accumulate("STATUS", "FAIL"); } } else { obj2.Accumulate("STATUS", "NICKNAMENOTEXISTS"); } } base.Response.Write(obj2.ToString()); }
public void CheckNickName(FormCollection collection) { JsonObject obj2 = new JsonObject(); if ((base.HttpContext.User.Identity.IsAuthenticated && (base.CurrentUser != null)) && (base.CurrentUser.UserType != "AA")) { string str = collection["NickName"]; if (!string.IsNullOrWhiteSpace(str)) { Maticsoft.BLL.Members.Users users = new Maticsoft.BLL.Members.Users(); if (users.ExistsNickName(base.CurrentUser.UserID, str)) { obj2.Accumulate("STATUS", "EXISTS"); } else { obj2.Accumulate("STATUS", "OK"); } } else { obj2.Accumulate("STATUS", "NOTNULL"); } base.Response.Write(obj2.ToString()); } else { obj2.Accumulate("STATUS", "NOTNULL"); base.Response.Write(obj2.ToString()); } }
protected void Page_Load(object sender, EventArgs e) { if (!this.Page.IsPostBack) { int defaultUserId = new Maticsoft.BLL.Members.Users().GetDefaultUserId(); this.txtUserId.Text = defaultUserId.ToString(); this.txtUserId2.Text = defaultUserId.ToString(); List<AlbumIndex> listByUserId = this.albumBll.GetListByUserId(defaultUserId, -1); this.ddlAlbumList.DataSource = listByUserId; this.ddlAlbumList.DataTextField = "AlbumName"; this.ddlAlbumList.DataValueField = "AlbumID"; this.ddlAlbumList.DataBind(); this.ddlAlbumList.Items.Insert(0, new ListItem("--请选择--", "")); this.ddlAlbumList2.DataSource = listByUserId; this.ddlAlbumList2.DataTextField = "AlbumName"; this.ddlAlbumList2.DataValueField = "AlbumID"; this.ddlAlbumList2.DataBind(); this.ddlAlbumList2.Items.Insert(0, new ListItem("--请选择--", "")); } }
protected void btnImportExcel_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(this.txtUserId2.Text) || !PageValidate.IsNumber(this.txtUserId2.Text)) { MessageBox.ShowFailTip(this, "请输入正确的用户ID"); } else { int userID = Globals.SafeInt(this.txtUserId2.Text, 0); Maticsoft.BLL.Members.Users users = new Maticsoft.BLL.Members.Users(); if (users.GetModel(userID) == null) { MessageBox.ShowFailTip(this, "该用户ID不存在"); } else { int albumid = Globals.SafeInt(this.ddlAlbumList2.SelectedValue, 0); if (albumid == 0) { MessageBox.ShowFailTip(this, "请选择需要导入数据的专辑"); } else { int categoryId = Globals.SafeInt(this.SNSCategoryDropList.SelectedValue, 0); string fileName = this.uploadExcel.PostedFile.FileName; string errorMsg = "出现异常,请检查您的数据格式"; int count = 0; if (!this.uploadExcel.HasFile) { MessageBox.ShowSuccessTip(this, "请上传文件"); } else { if (!Directory.Exists(HttpContext.Current.Server.MapPath(this.UploadPath))) { Directory.CreateDirectory(HttpContext.Current.Server.MapPath(this.UploadPath)); } this.uploadExcel.PostedFile.SaveAs(base.Server.MapPath(this.UploadPath) + fileName); if (this.ExcelImport(this.UploadPath, fileName, userID, albumid, categoryId, out errorMsg, ref count)) { MessageBox.ShowSuccessTip(this, "成功插入" + count + "条数据"); } else { MessageBox.ShowSuccessTip(this, "插入失败,信息:" + errorMsg + "提示:检查您填写数据的数据格式"); } } } } } }
protected void btnImport_Click(object sender, EventArgs e) { Func<TaobaokeItem, bool> func = null; Predicate<TaobaokeItem> match = null; string[] arryId; int cid = Globals.SafeInt(this.TaoBaoCate.SelectedValue, 0); if (string.IsNullOrWhiteSpace(this.txtUserId.Text) || !PageValidate.IsNumber(this.txtUserId.Text)) { MessageBox.ShowFailTip(this, "请输入正确的用户ID"); } else { int userID = Globals.SafeInt(this.txtUserId.Text, 0); Maticsoft.Model.Members.Users model = new Maticsoft.BLL.Members.Users().GetModel(userID); if (model == null) { MessageBox.ShowFailTip(this, "该用户ID不存在"); } else { string selIDlist = this.GetSelIDlist(); if (selIDlist.Trim().Length == 0) { MessageBox.ShowFailTip(this, "选择您要导入的商品"); } else { int albumId = Globals.SafeInt(this.ddlAlbumList.SelectedValue, 0); if (albumId == 0) { MessageBox.ShowFailTip(this, "请选择需要导入数据的专辑"); } else { arryId = selIDlist.Split(new char[] { ',' }); bool reRepeat = this.chkRepeat.Checked; if (this.Session["ProductList"] != null) { int currentPageIndex = this.AspNetPager1.CurrentPageIndex; int pageSize = this.AspNetPager1.PageSize; List<TaobaokeItem> source = this.Session["ProductList"] as List<TaobaokeItem>; if (func == null) { func = c => arryId.Contains<string>(c.NumIid.ToString()); } int num6 = this.bll.ImportData(model.UserID, albumId, cid, source.Where<TaobaokeItem>(func).ToList<TaobaokeItem>(), reRepeat); if (match == null) { match = c => arryId.Contains<string>(c.NumIid.ToString()); } source.RemoveAll(match); this.AspNetPager1.RecordCount = source.Count; if (((currentPageIndex - 1) * pageSize) >= source.Count) { this.AspNetPager1.CurrentPageIndex = currentPageIndex - 1; this.DataListProduct.DataSource = source.Skip<TaobaokeItem>(((currentPageIndex - 2) * pageSize)).Take<TaobaokeItem>(pageSize); } else { this.DataListProduct.DataSource = source.Skip<TaobaokeItem>(((currentPageIndex - 1) * pageSize)).Take<TaobaokeItem>(pageSize); } this.DataListProduct.DataBind(); this.Session["ProductList"] = source; MessageBox.ShowSuccessTip(this, "成功导入【" + num6 + "】条数据"); } } } } } }
public void GiveUserFellow(int UserId, int Top) { Maticsoft.BLL.Members.Users users = new Maticsoft.BLL.Members.Users(); List<Maticsoft.Model.Members.Users> list = new List<Maticsoft.Model.Members.Users>(); foreach (Maticsoft.Model.Members.Users users2 in users.DataTableToList(users.GetList(Top, "UserType='UU' and UserID<>" + UserId + " ", "newid()").Tables[0])) { this.AddAttention(users2.UserID, UserId); } }
public void GiveUserFellow(int UserId) { string valueByCache = Maticsoft.BLL.SysManage.ConfigSystem.GetValueByCache("SNS_FansList"); Maticsoft.BLL.Members.Users users = new Maticsoft.BLL.Members.Users(); if (!string.IsNullOrEmpty(valueByCache)) { foreach (string str2 in valueByCache.Split(new char[] { ',' })) { int userID = Globals.SafeInt(str2, 0); if (users.Exists(userID)) { this.AddAttention(userID, UserId); } } } }
public void ExistsNickName(FormCollection collection) { if (!base.HttpContext.User.Identity.IsAuthenticated || (base.CurrentUser == null)) { this.RedirectToAction(((dynamic) base.ViewBag).BasePath + "Account/Login"); } else { JsonObject obj2 = new JsonObject(); string str = collection["NickName"]; if (!string.IsNullOrWhiteSpace(str)) { Maticsoft.BLL.Members.Users users = new Maticsoft.BLL.Members.Users(); if (users.ExistsNickName(str)) { obj2.Accumulate("STATUS", "EXISTS"); } else { obj2.Accumulate("STATUS", "NOTEXISTS"); } } else { obj2.Accumulate("STATUS", "NOTNULL"); } base.Response.Write(obj2.ToString()); } }
public void SendMsg(FormCollection collection) { ((dynamic) base.ViewBag).Title = "发信息"; if (!base.HttpContext.User.Identity.IsAuthenticated || (base.CurrentUser == null)) { this.RedirectToAction(((dynamic) base.ViewBag).BasePath + "Account/Login"); } else { JsonObject obj2 = new JsonObject(); string str = collection["NickName"]; string str2 = collection["Title"]; string str3 = collection["Content"]; if (string.IsNullOrWhiteSpace(str)) { obj2.Accumulate("STATUS", "NICKNAMENULL"); } else if (string.IsNullOrWhiteSpace(str2)) { obj2.Accumulate("STATUS", "TITLENULL"); } else if (string.IsNullOrWhiteSpace(str3)) { obj2.Accumulate("STATUS", "CONTENTNULL"); } else { Maticsoft.BLL.Members.Users users = new Maticsoft.BLL.Members.Users(); if (users.ExistsNickName(str)) { int userIdByNickName = users.GetUserIdByNickName(str); Maticsoft.Model.Members.SiteMessage model = new Maticsoft.Model.Members.SiteMessage { Title = str2, Content = str3, SenderID = new int?(base.CurrentUser.UserID), ReaderIsDel = false, ReceiverIsRead = false, SenderIsDel = false, ReceiverID = new int?(userIdByNickName), SendTime = new DateTime?(DateTime.Now) }; if (this.bllSM.Add(model) > 0) { obj2.Accumulate("STATUS", "SUCC"); } else { obj2.Accumulate("STATUS", "FAIL"); } } else { obj2.Accumulate("STATUS", "NICKNAMENOTEXISTS"); } } base.Response.Write(obj2.ToString()); } }
public PartialViewResult UserInfo(int uid = -1, string nickname = "") { int num; Maticsoft.BLL.Members.Users users = new Maticsoft.BLL.Members.Users(); UsersExpModel userModel = new UsersExpModel(); Maticsoft.BLL.Ms.Regions regions = new Maticsoft.BLL.Ms.Regions(); Maticsoft.BLL.SNS.Star star = new Maticsoft.BLL.SNS.Star(); if (!string.IsNullOrEmpty(nickname) && ((num = users.GetUserIdByNickName(nickname)) > 0)) { uid = num; } ((dynamic) base.ViewBag).IsPost = uid == -1; ((dynamic) base.ViewBag).IsCurrentUser = false; uid = (uid > -1) ? uid : base.currentUser.UserID; if ((base.currentUser != null) && (uid == base.currentUser.UserID)) { ((dynamic) base.ViewBag).IsCurrentUser = true; } userModel = this.GetUserModel(uid); string regionNameByRID = regions.GetRegionNameByRID(Globals.SafeInt(userModel.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("天津天津", "天津"); } userModel.Address = string.IsNullOrEmpty(userModel.Address) ? "暂未设置" : regionNameByRID; ((dynamic) base.ViewBag).IsStar = star.IsStar(uid); ((dynamic) base.ViewBag).Level = new Maticsoft.BLL.SNS.GradeConfig().GetUserLevel(userModel.Points); return this.PartialView("_UserInfo", userModel); }
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); }
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(); }
protected void GridViewEx1_RowDeleting(object sender, GridViewDeleteEventArgs e) { int enterpriseID = (int) this.gridView.DataKeys[e.RowIndex].Value; this.bll.Delete(enterpriseID); Maticsoft.Model.Members.Users userIdByDepartmentID = new Maticsoft.BLL.Members.Users().GetUserIdByDepartmentID(enterpriseID.ToString()); if (userIdByDepartmentID != null) { this.bllUsers.DeleteByDepartmentID(enterpriseID); new UsersExp().DeleteUsersExp(userIdByDepartmentID.UserID); } this.gridView.OnBind(); }