Beispiel #1
0
 public int AddMessageByUser(int SendID, int ReceiverID, string Title, string Content)
 {
     Maticsoft.Model.Members.SiteMessage model = new Maticsoft.Model.Members.SiteMessage {
         Content = Content,
         Title = Title,
         ReceiverID = new int?(ReceiverID),
         SenderID = new int?(SendID),
         SendTime = new DateTime?(DateTime.Now),
         ReceiverIsRead = false,
         SenderIsDel = false,
         ReaderIsDel = false
     };
     return this.dal.Add(model);
 }
 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 ReplyMsg(int ReceiverID, string Title, string Content)
 {
     JsonObject obj2 = new JsonObject();
     Maticsoft.Model.Members.SiteMessage model = new Maticsoft.Model.Members.SiteMessage {
         Title = Title,
         Content = Content,
         SenderID = new int?(base.CurrentUser.UserID),
         ReaderIsDel = false,
         ReceiverIsRead = false,
         SenderIsDel = false,
         ReceiverID = new int?(ReceiverID),
         SendTime = new DateTime?(DateTime.Now)
     };
     if (this.bllSM.Add(model) > 0)
     {
         obj2.Accumulate("STATUS", "SUCC");
     }
     else
     {
         obj2.Accumulate("STATUS", "FAIL");
     }
     base.Response.Write(obj2.ToString());
 }
Beispiel #4
0
 private void SendMsg()
 {
     string str = "";
     bool flag = false;
     for (int i = 0; i < this.gridView.Rows.Count; i++)
     {
         CheckBox box = (CheckBox) this.gridView.Rows[i].FindControl(this.gridView.CheckBoxID);
         if ((box != null) && box.Checked)
         {
             flag = true;
             HiddenField field = (HiddenField) this.gridView.Rows[i].FindControl("HiddenField_UserId");
             if (field != null)
             {
                 str = str + field.Value + ",";
             }
         }
     }
     if (flag)
     {
         str = str.Substring(0, str.LastIndexOf(","));
     }
     Maticsoft.Model.Members.SiteMessage model = new Maticsoft.Model.Members.SiteMessage();
     Maticsoft.BLL.Members.SiteMessage message2 = new Maticsoft.BLL.Members.SiteMessage();
     model.Title = "系统管理员通知";
     model.Content = "您好,您的举报信息我们已经收到并处理,非常感谢您对我们工作的支持。";
     model.SenderID = new int?(base.CurrentUser.UserID);
     model.SendTime = new DateTime?(DateTime.Now);
     model.ReaderIsDel = false;
     model.ReceiverIsRead = false;
     model.SenderIsDel = false;
     foreach (string str2 in str.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
     {
         model.ReceiverID = new int?(int.Parse(str2));
         message2.Add(model);
     }
 }
 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());
     }
 }
Beispiel #6
0
 public List<Maticsoft.Model.Members.SiteMessage> DataTableToList(DataTable dt)
 {
     List<Maticsoft.Model.Members.SiteMessage> list = new List<Maticsoft.Model.Members.SiteMessage>();
     int count = dt.Rows.Count;
     if (count > 0)
     {
         for (int i = 0; i < count; i++)
         {
             Maticsoft.Model.Members.SiteMessage item = new Maticsoft.Model.Members.SiteMessage();
             if ((dt.Rows[i]["ID"] != null) && (dt.Rows[i]["ID"].ToString() != ""))
             {
                 item.ID = int.Parse(dt.Rows[i]["ID"].ToString());
             }
             if ((dt.Rows[i]["SenderID"] != null) && (dt.Rows[i]["SenderID"].ToString() != ""))
             {
                 item.SenderID = new int?(int.Parse(dt.Rows[i]["SenderID"].ToString()));
             }
             if ((dt.Rows[i]["ReceiverID"] != null) && (dt.Rows[i]["ReceiverID"].ToString() != ""))
             {
                 item.ReceiverID = new int?(int.Parse(dt.Rows[i]["ReceiverID"].ToString()));
             }
             if ((dt.Rows[i]["Title"] != null) && (dt.Rows[i]["Title"].ToString() != ""))
             {
                 item.Title = dt.Rows[i]["Title"].ToString();
             }
             if ((dt.Rows[i]["Content"] != null) && (dt.Rows[i]["Content"].ToString() != ""))
             {
                 item.Content = dt.Rows[i]["Content"].ToString();
             }
             if ((dt.Rows[i]["MsgType"] != null) && (dt.Rows[i]["MsgType"].ToString() != ""))
             {
                 item.MsgType = dt.Rows[i]["MsgType"].ToString();
             }
             if ((dt.Rows[i]["SendTime"] != null) && (dt.Rows[i]["SendTime"].ToString() != ""))
             {
                 item.SendTime = new DateTime?(DateTime.Parse(dt.Rows[i]["SendTime"].ToString()));
             }
             if ((dt.Rows[i]["ReadTime"] != null) && (dt.Rows[i]["ReadTime"].ToString() != ""))
             {
                 item.ReadTime = new DateTime?(DateTime.Parse(dt.Rows[i]["ReadTime"].ToString()));
             }
             if ((dt.Rows[i]["ReceiverIsRead"] != null) && (dt.Rows[i]["ReceiverIsRead"].ToString() != ""))
             {
                 if ((dt.Rows[i]["ReceiverIsRead"].ToString() == "1") || (dt.Rows[i]["ReceiverIsRead"].ToString().ToLower() == "true"))
                 {
                     item.ReceiverIsRead = true;
                 }
                 else
                 {
                     item.ReceiverIsRead = false;
                 }
             }
             if ((dt.Rows[i]["SenderIsDel"] != null) && (dt.Rows[i]["SenderIsDel"].ToString() != ""))
             {
                 if ((dt.Rows[i]["SenderIsDel"].ToString() == "1") || (dt.Rows[i]["SenderIsDel"].ToString().ToLower() == "true"))
                 {
                     item.SenderIsDel = true;
                 }
                 else
                 {
                     item.SenderIsDel = false;
                 }
             }
             if ((dt.Rows[i]["ReaderIsDel"] != null) && (dt.Rows[i]["ReaderIsDel"].ToString() != ""))
             {
                 if ((dt.Rows[i]["ReaderIsDel"].ToString() == "1") || (dt.Rows[i]["ReaderIsDel"].ToString().ToLower() == "true"))
                 {
                     item.ReaderIsDel = true;
                 }
                 else
                 {
                     item.ReaderIsDel = false;
                 }
             }
             if ((dt.Rows[i]["Ext1"] != null) && (dt.Rows[i]["Ext1"].ToString() != ""))
             {
                 item.Ext1 = dt.Rows[i]["Ext1"].ToString();
             }
             if ((dt.Rows[i]["Ext2"] != null) && (dt.Rows[i]["Ext2"].ToString() != ""))
             {
                 item.Ext2 = dt.Rows[i]["Ext2"].ToString();
             }
             if ((dt.Columns.Contains("SenderUserName") && (dt.Rows[i]["SenderUserName"] != null)) && (dt.Rows[i]["SenderUserName"].ToString() != ""))
             {
                 item.SenderUserName = dt.Rows[i]["SenderUserName"].ToString();
             }
             if ((dt.Columns.Contains("ReceiverUserName") && (dt.Rows[i]["ReceiverUserName"] != null)) && (dt.Rows[i]["ReceiverUserName"].ToString() != ""))
             {
                 item.ReceiverUserName = dt.Rows[i]["ReceiverUserName"].ToString();
             }
             list.Add(item);
         }
     }
     return list;
 }