예제 #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 Maticsoft.Model.SNS.UserAlbumsType DataRowToModel(DataRow row)
 {
     Maticsoft.Model.SNS.UserAlbumsType type = new Maticsoft.Model.SNS.UserAlbumsType();
     if (row != null)
     {
         if ((row["AlbumsID"] != null) && (row["AlbumsID"].ToString() != ""))
         {
             type.AlbumsID = int.Parse(row["AlbumsID"].ToString());
         }
         if ((row["TypeID"] != null) && (row["TypeID"].ToString() != ""))
         {
             type.TypeID = int.Parse(row["TypeID"].ToString());
         }
         if ((row["AlbumsUserID"] != null) && (row["AlbumsUserID"].ToString() != ""))
         {
             type.AlbumsUserID = new int?(int.Parse(row["AlbumsUserID"].ToString()));
         }
     }
     return type;
 }
예제 #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 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");
 }