Пример #1
0
 public ActionResult AjaxAddAlbum(FormCollection Fm)
 {
     if (base.currentUser == null)
     {
         return base.Content("NoLogin");
     }
     if (base.CurrentUser.UserType == "AA")
     {
         return base.Content("AA");
     }
     string str = Fm["AlbumName"];
     int typeId = Globals.SafeInt(Fm["Type"], 0);
     Maticsoft.BLL.SNS.UserAlbums albums = new Maticsoft.BLL.SNS.UserAlbums();
     Maticsoft.Model.SNS.UserAlbums model = new Maticsoft.Model.SNS.UserAlbums {
         AlbumName = str,
         CreatedDate = DateTime.Now,
         CreatedNickName = base.currentUser.NickName,
         CreatedUserID = base.currentUser.UserID
     };
     if ((model.AlbumID = albums.AddEx(model, typeId)) > 0)
     {
         Maticsoft.BLL.SNS.UserAlbumsType type = new Maticsoft.BLL.SNS.UserAlbumsType();
         Maticsoft.Model.SNS.UserAlbumsType type2 = new Maticsoft.Model.SNS.UserAlbumsType {
             AlbumsID = model.AlbumID,
             AlbumsUserID = new int?(model.CreatedUserID),
             TypeID = typeId
         };
         if (type.Add(type2))
         {
             return base.Content(model.AlbumID.ToString());
         }
     }
     return base.Content("No");
 }
Пример #2
0
 public AlbumIndex(UserAlbums ua)
 {
     base.AlbumID = ua.AlbumID;
     base.AlbumName = ua.AlbumName;
     base.ChannelSequence = ua.ChannelSequence;
     base.CoverPhotoUrl = ua.CoverPhotoUrl;
     base.CoverTargetID = ua.CoverTargetID;
     base.CoverTargetType = ua.CoverTargetType;
     base.CreatedDate = ua.CreatedDate;
     base.CreatedNickName = ua.CreatedNickName;
     base.CreatedUserID = ua.CreatedUserID;
     base.Description = ua.Description;
     base.FavouriteCount = ua.FavouriteCount;
     base.IsRecommend = ua.IsRecommend;
     base.LastUpdatedDate = ua.LastUpdatedDate;
     base.PhotoCount = ua.PhotoCount;
     base.Privacy = ua.Privacy;
     base.PVCount = ua.PVCount;
     base.Sequence = ua.Sequence;
     base.Status = ua.Status;
     base.Tags = ua.Tags;
 }
Пример #3
0
 public ActionResult Create(FormCollection collection)
 {
     ((dynamic) base.ViewBag).Title = "创建新专辑";
     try
     {
         if (!base.HttpContext.User.Identity.IsAuthenticated)
         {
             return base.RedirectToAction("Login", "Account");
         }
         if (base.currentUser.UserType == "AA")
         {
             return base.View();
         }
         Maticsoft.Model.SNS.UserAlbums model = new Maticsoft.Model.SNS.UserAlbums {
             AlbumName = collection["AlbumName"],
             Description = collection["Description"],
             CreatedNickName = base.CurrentUser.NickName,
             CreatedUserID = base.CurrentUser.UserID
         };
         int typeId = Globals.SafeInt(collection["TypeRadio"], 0);
         int num2 = new Maticsoft.BLL.SNS.UserAlbums().AddEx(model, typeId);
         if (num2 > 0)
         {
             Maticsoft.BLL.SNS.UserAlbumsType type = new Maticsoft.BLL.SNS.UserAlbumsType();
             Maticsoft.Model.SNS.UserAlbumsType type2 = new Maticsoft.Model.SNS.UserAlbumsType {
                 AlbumsID = num2,
                 AlbumsUserID = new int?(model.CreatedUserID),
                 TypeID = typeId
             };
             type.Add(type2);
         }
         return base.RedirectToAction("Albums", "Profile");
     }
     catch
     {
         return base.View();
     }
 }
Пример #4
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);
 }
Пример #5
0
 public ActionResult AlbumEdit(FormCollection fm)
 {
     ((dynamic) base.ViewBag).Title = "编辑专辑";
     Maticsoft.Model.SNS.UserAlbums model = new Maticsoft.Model.SNS.UserAlbums();
     Maticsoft.BLL.SNS.UserAlbums albums2 = new Maticsoft.BLL.SNS.UserAlbums();
     model.AlbumName = fm["AlbumName"];
     model.Description = fm["Description"];
     model.AlbumID = Globals.SafeInt(fm["AlbumID"], 0);
     if (!albums2.UpdateEx(model))
     {
         return base.RedirectToAction("AlbumEdit", new { AlbumId = model.AlbumID });
     }
     int num = Globals.SafeInt(fm["TypeId"], 0);
     Maticsoft.BLL.SNS.UserAlbumsType type = new Maticsoft.BLL.SNS.UserAlbumsType();
     Maticsoft.Model.SNS.UserAlbumsType modelByUserId = type.GetModelByUserId(model.AlbumID, base.currentUser.UserID);
     if (modelByUserId == null)
     {
         modelByUserId = new Maticsoft.Model.SNS.UserAlbumsType {
             TypeID = num,
             AlbumsID = model.AlbumID,
             AlbumsUserID = new int?(base.currentUser.UserID)
         };
         type.AddEx(modelByUserId);
     }
     else
     {
         modelByUserId.TypeID = num;
         type.UpdateType(modelByUserId);
     }
     return base.RedirectToAction("Albums");
 }
Пример #6
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();
 }
Пример #7
0
 public Maticsoft.Model.SNS.UserAlbums DataRowToModel(DataRow row)
 {
     Maticsoft.Model.SNS.UserAlbums albums = new Maticsoft.Model.SNS.UserAlbums();
     if (row != null)
     {
         if ((row["AlbumID"] != null) && (row["AlbumID"].ToString() != ""))
         {
             albums.AlbumID = int.Parse(row["AlbumID"].ToString());
         }
         if ((row["AlbumName"] != null) && (row["AlbumName"].ToString() != ""))
         {
             albums.AlbumName = row["AlbumName"].ToString();
         }
         if ((row["Description"] != null) && (row["Description"].ToString() != ""))
         {
             albums.Description = row["Description"].ToString();
         }
         if ((row["CoverTargetID"] != null) && (row["CoverTargetID"].ToString() != ""))
         {
             albums.CoverTargetID = new int?(int.Parse(row["CoverTargetID"].ToString()));
         }
         if ((row["CoverPhotoUrl"] != null) && (row["CoverPhotoUrl"].ToString() != ""))
         {
             albums.CoverPhotoUrl = row["CoverPhotoUrl"].ToString();
         }
         if ((row["CoverTargetType"] != null) && (row["CoverTargetType"].ToString() != ""))
         {
             albums.CoverTargetType = new int?(int.Parse(row["CoverTargetType"].ToString()));
         }
         if ((row["Status"] != null) && (row["Status"].ToString() != ""))
         {
             albums.Status = int.Parse(row["Status"].ToString());
         }
         if ((row["CreatedUserID"] != null) && (row["CreatedUserID"].ToString() != ""))
         {
             albums.CreatedUserID = int.Parse(row["CreatedUserID"].ToString());
         }
         if ((row["CreatedNickName"] != null) && (row["CreatedNickName"].ToString() != ""))
         {
             albums.CreatedNickName = row["CreatedNickName"].ToString();
         }
         if ((row["PhotoCount"] != null) && (row["PhotoCount"].ToString() != ""))
         {
             albums.PhotoCount = int.Parse(row["PhotoCount"].ToString());
         }
         if ((row["PVCount"] != null) && (row["PVCount"].ToString() != ""))
         {
             albums.PVCount = int.Parse(row["PVCount"].ToString());
         }
         if ((row["FavouriteCount"] != null) && (row["FavouriteCount"].ToString() != ""))
         {
             albums.FavouriteCount = int.Parse(row["FavouriteCount"].ToString());
         }
         if ((row["CreatedDate"] != null) && (row["CreatedDate"].ToString() != ""))
         {
             albums.CreatedDate = DateTime.Parse(row["CreatedDate"].ToString());
         }
         if ((row["CommentsCount"] != null) && (row["CommentsCount"].ToString() != ""))
         {
             albums.CommentsCount = new int?(int.Parse(row["CommentsCount"].ToString()));
         }
         if ((row["IsRecommend"] != null) && (row["IsRecommend"].ToString() != ""))
         {
             albums.IsRecommend = int.Parse(row["IsRecommend"].ToString());
         }
         if ((row["ChannelSequence"] != null) && (row["ChannelSequence"].ToString() != ""))
         {
             albums.ChannelSequence = int.Parse(row["ChannelSequence"].ToString());
         }
         if ((row["Privacy"] != null) && (row["Privacy"].ToString() != ""))
         {
             albums.Privacy = int.Parse(row["Privacy"].ToString());
         }
         if ((row["Sequence"] != null) && (row["Sequence"].ToString() != ""))
         {
             albums.Sequence = int.Parse(row["Sequence"].ToString());
         }
         if ((row["LastUpdatedDate"] != null) && (row["LastUpdatedDate"].ToString() != ""))
         {
             albums.LastUpdatedDate = new DateTime?(DateTime.Parse(row["LastUpdatedDate"].ToString()));
         }
         if ((row["Tags"] != null) && (row["Tags"].ToString() != ""))
         {
             albums.Tags = row["Tags"].ToString();
         }
     }
     return albums;
 }