public ActionResult AjaxGbook(FormCollection Fm) { string str = InjectionFilter.Filter(Fm["Title"]); string str2 = InjectionFilter.Filter(Fm["Content"]); string str3 = InjectionFilter.Filter(Fm["Email"]); if ((string.IsNullOrWhiteSpace(str) || string.IsNullOrWhiteSpace(str2)) || string.IsNullOrWhiteSpace(str3)) { return base.Content("false"); } Maticsoft.BLL.Members.Guestbook guestbook = new Maticsoft.BLL.Members.Guestbook(); Maticsoft.Model.Members.Guestbook model = new Maticsoft.Model.Members.Guestbook { CreatedDate = DateTime.Now, CreatorEmail = str3, Description = str2, Title = str, Status = 0, ToUserID = -1, ParentID = 0, CreateNickName = str3 }; if (guestbook.Add(model) <= 0) { return base.Content("false"); } return base.Content("true"); }
public Maticsoft.Model.Members.Guestbook DataRowToModel(DataRow row) { Maticsoft.Model.Members.Guestbook guestbook = new Maticsoft.Model.Members.Guestbook(); if (row != null) { if ((row["ID"] != null) && (row["ID"].ToString() != "")) { guestbook.ID = int.Parse(row["ID"].ToString()); } if ((row["CreateUserID"] != null) && (row["CreateUserID"].ToString() != "")) { guestbook.CreateUserID = new int?(int.Parse(row["CreateUserID"].ToString())); } if ((row["CreateNickName"] != null) && (row["CreateNickName"].ToString() != "")) { guestbook.CreateNickName = row["CreateNickName"].ToString(); } if ((row["ToUserID"] != null) && (row["ToUserID"].ToString() != "")) { guestbook.ToUserID = new int?(int.Parse(row["ToUserID"].ToString())); } if ((row["ToNickName"] != null) && (row["ToNickName"].ToString() != "")) { guestbook.ToNickName = row["ToNickName"].ToString(); } if ((row["CreatorUserIP"] != null) && (row["CreatorUserIP"].ToString() != "")) { guestbook.CreatorUserIP = row["CreatorUserIP"].ToString(); } if ((row["Title"] != null) && (row["Title"].ToString() != "")) { guestbook.Title = row["Title"].ToString(); } if ((row["Description"] != null) && (row["Description"].ToString() != "")) { guestbook.Description = row["Description"].ToString(); } if ((row["CreatedDate"] != null) && (row["CreatedDate"].ToString() != "")) { guestbook.CreatedDate = DateTime.Parse(row["CreatedDate"].ToString()); } if ((row["CreatorEmail"] != null) && (row["CreatorEmail"].ToString() != "")) { guestbook.CreatorEmail = row["CreatorEmail"].ToString(); } if ((row["CreatorRegion"] != null) && (row["CreatorRegion"].ToString() != "")) { guestbook.CreatorRegion = row["CreatorRegion"].ToString(); } if ((row["CreatorCompany"] != null) && (row["CreatorCompany"].ToString() != "")) { guestbook.CreatorCompany = row["CreatorCompany"].ToString(); } if ((row["CreatorPageSite"] != null) && (row["CreatorPageSite"].ToString() != "")) { guestbook.CreatorPageSite = row["CreatorPageSite"].ToString(); } if ((row["CreatorPhone"] != null) && (row["CreatorPhone"].ToString() != "")) { guestbook.CreatorPhone = row["CreatorPhone"].ToString(); } if ((row["CreatorQQ"] != null) && (row["CreatorQQ"].ToString() != "")) { guestbook.CreatorQQ = row["CreatorQQ"].ToString(); } if ((row["CreatorMsn"] != null) && (row["CreatorMsn"].ToString() != "")) { guestbook.CreatorMsn = row["CreatorMsn"].ToString(); } if ((row["CreatorSex"] != null) && (row["CreatorSex"].ToString() != "")) { if ((row["CreatorSex"].ToString() == "1") || (row["CreatorSex"].ToString().ToLower() == "true")) { guestbook.CreatorSex = true; } else { guestbook.CreatorSex = false; } } if ((row["HandlerNickName"] != null) && (row["HandlerNickName"].ToString() != "")) { guestbook.HandlerNickName = row["HandlerNickName"].ToString(); } if ((row["HandlerUserID"] != null) && (row["HandlerUserID"].ToString() != "")) { guestbook.HandlerUserID = new int?(int.Parse(row["HandlerUserID"].ToString())); } if ((row["HandlerDate"] != null) && (row["HandlerDate"].ToString() != "")) { guestbook.HandlerDate = new DateTime?(DateTime.Parse(row["HandlerDate"].ToString())); } if ((row["Privacy"] != null) && (row["Privacy"].ToString() != "")) { guestbook.Privacy = new int?(int.Parse(row["Privacy"].ToString())); } if ((row["ReplyCount"] != null) && (row["ReplyCount"].ToString() != "")) { guestbook.ReplyCount = int.Parse(row["ReplyCount"].ToString()); } if ((row["ReplyDescription"] != null) && (row["ReplyDescription"].ToString() != "")) { guestbook.ReplyDescription = row["ReplyDescription"].ToString(); } if ((row["ParentID"] != null) && (row["ParentID"].ToString() != "")) { guestbook.ParentID = new int?(int.Parse(row["ParentID"].ToString())); } if ((row["Status"] != null) && (row["Status"].ToString() != "")) { guestbook.Status = new int?(int.Parse(row["Status"].ToString())); } } return guestbook; }