public Maticsoft.Model.SNS.Report DataRowToModel(DataRow row) { Maticsoft.Model.SNS.Report report = new Maticsoft.Model.SNS.Report(); if (row != null) { if ((row["ID"] != null) && (row["ID"].ToString() != "")) { report.ID = int.Parse(row["ID"].ToString()); } if ((row["ReportTypeID"] != null) && (row["ReportTypeID"].ToString() != "")) { report.ReportTypeID = int.Parse(row["ReportTypeID"].ToString()); } if ((row["TargetType"] != null) && (row["TargetType"].ToString() != "")) { report.TargetType = int.Parse(row["TargetType"].ToString()); } if ((row["TargetID"] != null) && (row["TargetID"].ToString() != "")) { report.TargetID = int.Parse(row["TargetID"].ToString()); } if ((row["CreatedUserID"] != null) && (row["CreatedUserID"].ToString() != "")) { report.CreatedUserID = int.Parse(row["CreatedUserID"].ToString()); } if (row["CreatedNickName"] != null) { report.CreatedNickName = row["CreatedNickName"].ToString(); } if (row["Description"] != null) { report.Description = row["Description"].ToString(); } if ((row["CreatedDate"] != null) && (row["CreatedDate"].ToString() != "")) { report.CreatedDate = DateTime.Parse(row["CreatedDate"].ToString()); } if ((row["Status"] != null) && (row["Status"].ToString() != "")) { report.Status = new int?(int.Parse(row["Status"].ToString())); } } return report; }
public ActionResult AjaxAddReport(FormCollection Fm) { string str = InjectionFilter.Filter(Fm["Description"]); int num = Globals.SafeInt(Fm["Type"], 0); int postID = Globals.SafeInt(Fm["TargetId"], 0); Maticsoft.BLL.SNS.Report report = new Maticsoft.BLL.SNS.Report(); Maticsoft.Model.SNS.Report model = new Maticsoft.Model.SNS.Report(); base.PostsModel = base.PostsBll.GetModel(postID); if (base.PostsModel != null) { model.Description = str; model.CreatedDate = DateTime.Now; model.CreatedNickName = base.currentUser.NickName; model.CreatedUserID = base.currentUser.UserID; model.ReportTypeID = num; model.TargetID = postID; if (base.PostsModel.TargetId > 0) { model.TargetID = base.PostsModel.TargetId; } model.Status = 0; model.TargetType = base.PostsModel.Type.Value; if (report.Add(model) > 0) { return base.Content("Ok"); } } return base.Content("No"); }