Esempio n. 1
0
 public ActionResult AJaxCreateTopic(FormCollection fm)
 {
     string str = InjectionFilter.Filter((fm["Title"] != null) ? fm["Title"].ToString() : "");
     string str2 = (fm["Des"] != null) ? fm["Des"].ToString() : "";
     long pid = Globals.SafeLong(fm["Pid"], (long) 0L);
     string imageUrl = "";
     if (pid == 0L)
     {
         imageUrl = (fm["ImageUrl"] != null) ? fm["ImageUrl"].ToString() : "";
     }
     int num2 = Globals.SafeInt(fm["GroupId"], 0);
     if (!string.IsNullOrEmpty(str) && !string.IsNullOrEmpty(str2))
     {
         Maticsoft.BLL.SNS.GroupTopics topics = new Maticsoft.BLL.SNS.GroupTopics();
         Maticsoft.Model.SNS.GroupTopics tModel = new Maticsoft.Model.SNS.GroupTopics {
             Title = str,
             Description = str2
         };
         string savePath = "/Upload/SNS/Images/Group/" + DateTime.Now.ToString("yyyyMMdd") + "/";
         string saveThumbsPath = "/Upload/SNS/Images/GroupThumbs/" + DateTime.Now.ToString("yyyyMMdd") + "/";
         tModel.ImageUrl = Maticsoft.BLL.SNS.Photos.MoveImage(imageUrl, savePath, saveThumbsPath);
         tModel.GroupID = num2;
         tModel.GroupName = "";
         tModel.CreatedDate = DateTime.Now;
         tModel.CreatedUserID = base.currentUser.UserID;
         tModel.CreatedNickName = base.currentUser.NickName;
         if ((tModel.TopicID = topics.AddEx(tModel, pid)) > 0)
         {
             return base.Content(tModel.TopicID.ToString());
         }
         if (tModel.TopicID == -2)
         {
             FormsAuthentication.SignOut();
             base.Session.Remove(Globals.SESSIONKEY_USER);
             base.Session.Clear();
             base.Session.Abandon();
         }
     }
     return base.Content("No");
 }
Esempio n. 2
0
 public ActionResult AjaxTopicOperation(FormCollection fm)
 {
     int topicID = Globals.SafeInt(fm["TopicId"], 0);
     int recommand = Globals.SafeInt(fm["Type"], 0);
     Maticsoft.BLL.SNS.GroupTopics topics = new Maticsoft.BLL.SNS.GroupTopics();
     Maticsoft.Model.SNS.GroupTopics model = new Maticsoft.Model.SNS.GroupTopics();
     model = topics.GetModel(topicID);
     if (recommand < 2)
     {
         if (topics.UpdateRecommand(topicID, recommand))
         {
             return base.Content("Ok");
         }
         return base.Content("No");
     }
     if (recommand != 2)
     {
         return null;
     }
     model.IsRecomend = 0;
     if (topics.DeleteEx(topicID))
     {
         return base.Content("Ok");
     }
     return base.Content("No");
 }
Esempio n. 3
0
 public Maticsoft.Model.SNS.GroupTopics DataRowToModel(DataRow row)
 {
     Maticsoft.Model.SNS.GroupTopics topics = new Maticsoft.Model.SNS.GroupTopics();
     if (row != null)
     {
         if ((row["TopicID"] != null) && (row["TopicID"].ToString() != ""))
         {
             topics.TopicID = int.Parse(row["TopicID"].ToString());
         }
         if ((row["CreatedUserID"] != null) && (row["CreatedUserID"].ToString() != ""))
         {
             topics.CreatedUserID = int.Parse(row["CreatedUserID"].ToString());
         }
         if (row["CreatedNickName"] != null)
         {
             topics.CreatedNickName = row["CreatedNickName"].ToString();
         }
         if ((row["GroupID"] != null) && (row["GroupID"].ToString() != ""))
         {
             topics.GroupID = int.Parse(row["GroupID"].ToString());
         }
         if (row["GroupName"] != null)
         {
             topics.GroupName = row["GroupName"].ToString();
         }
         if (row["Title"] != null)
         {
             topics.Title = row["Title"].ToString();
         }
         if (row["Description"] != null)
         {
             topics.Description = row["Description"].ToString();
         }
         if ((row["IsRecomend"] != null) && (row["IsRecomend"].ToString() != ""))
         {
             topics.IsRecomend = int.Parse(row["IsRecomend"].ToString());
         }
         if ((row["Sequence"] != null) && (row["Sequence"].ToString() != ""))
         {
             topics.Sequence = int.Parse(row["Sequence"].ToString());
         }
         if ((row["ReplyCount"] != null) && (row["ReplyCount"].ToString() != ""))
         {
             topics.ReplyCount = int.Parse(row["ReplyCount"].ToString());
         }
         if ((row["PvCount"] != null) && (row["PvCount"].ToString() != ""))
         {
             topics.PvCount = int.Parse(row["PvCount"].ToString());
         }
         if ((row["DingCount"] != null) && (row["DingCount"].ToString() != ""))
         {
             topics.DingCount = int.Parse(row["DingCount"].ToString());
         }
         if ((row["Status"] != null) && (row["Status"].ToString() != ""))
         {
             topics.Status = int.Parse(row["Status"].ToString());
         }
         if ((row["IsTop"] != null) && (row["IsTop"].ToString() != ""))
         {
             topics.IsTop = int.Parse(row["IsTop"].ToString());
         }
         if ((row["IsActive"] != null) && (row["IsActive"].ToString() != ""))
         {
             if ((row["IsActive"].ToString() == "1") || (row["IsActive"].ToString().ToLower() == "true"))
             {
                 topics.IsActive = true;
             }
             else
             {
                 topics.IsActive = false;
             }
         }
         if ((row["IsAdminRecommend"] != null) && (row["IsAdminRecommend"].ToString() != ""))
         {
             if ((row["IsAdminRecommend"].ToString() == "1") || (row["IsAdminRecommend"].ToString().ToLower() == "true"))
             {
                 topics.IsAdminRecommend = true;
             }
             else
             {
                 topics.IsAdminRecommend = false;
             }
         }
         if ((row["ChannelSequence"] != null) && (row["ChannelSequence"].ToString() != ""))
         {
             topics.ChannelSequence = new int?(int.Parse(row["ChannelSequence"].ToString()));
         }
         if ((row["HasReferUsers"] != null) && (row["HasReferUsers"].ToString() != ""))
         {
             if ((row["HasReferUsers"].ToString() == "1") || (row["HasReferUsers"].ToString().ToLower() == "true"))
             {
                 topics.HasReferUsers = true;
             }
             else
             {
                 topics.HasReferUsers = false;
             }
         }
         if (row["PostExUrl"] != null)
         {
             topics.PostExUrl = row["PostExUrl"].ToString();
         }
         if (row["ImageUrl"] != null)
         {
             topics.ImageUrl = row["ImageUrl"].ToString();
         }
         if (row["VideoUrl"] != null)
         {
             topics.VideoUrl = row["VideoUrl"].ToString();
         }
         if (row["AudioUrl"] != null)
         {
             topics.AudioUrl = row["AudioUrl"].ToString();
         }
         if (row["ProductName"] != null)
         {
             topics.ProductName = row["ProductName"].ToString();
         }
         if ((row["Price"] != null) && (row["Price"].ToString() != ""))
         {
             topics.Price = new decimal?(decimal.Parse(row["Price"].ToString()));
         }
         if (row["ProductLinkUrl"] != null)
         {
             topics.ProductLinkUrl = row["ProductLinkUrl"].ToString();
         }
         if ((row["Type"] != null) && (row["Type"].ToString() != ""))
         {
             topics.Type = int.Parse(row["Type"].ToString());
         }
         if ((row["TargetID"] != null) && (row["TargetID"].ToString() != ""))
         {
             topics.TargetID = new int?(int.Parse(row["TargetID"].ToString()));
         }
         if ((row["FavCount"] != null) && (row["FavCount"].ToString() != ""))
         {
             topics.FavCount = int.Parse(row["FavCount"].ToString());
         }
         if ((row["CreatedDate"] != null) && (row["CreatedDate"].ToString() != ""))
         {
             topics.CreatedDate = DateTime.Parse(row["CreatedDate"].ToString());
         }
         if ((row["LastReplyUserId"] != null) && (row["LastReplyUserId"].ToString() != ""))
         {
             topics.LastReplyUserId = new int?(int.Parse(row["LastReplyUserId"].ToString()));
         }
         if (row["LastReplyNickName"] != null)
         {
             topics.LastReplyNickName = row["LastReplyNickName"].ToString();
         }
         if ((row["LastPostTime"] != null) && (row["LastPostTime"].ToString() != ""))
         {
             topics.LastPostTime = new DateTime?(DateTime.Parse(row["LastPostTime"].ToString()));
         }
         if (row["Tags"] != null)
         {
             topics.Tags = row["Tags"].ToString();
         }
     }
     return topics;
 }