public ActionResult MessageDetail(int MessageID = 0, string MessageCode = "") { if (RedirectToProduction()) { return(Redirect(UrlProduction)); } RememberURL(); if (!CheckIsLogin()) { return(Redirect(res.Pageviews.PvMemberSignUp)); } GetStatusUser(); if (MessageID > 0) { Message.MessageService svMessage = new Message.MessageService(); var Message = svMessage.SelectData <view_Message>("*", "IsDelete = 0 AND MessageID =" + MessageID).First(); ViewBag.Message = Message; ViewBag.Title = Message.Subject; if (Message.ToCompID == LogonCompID || CheckIsAdmin(9)) { #region Get FromComp Detail if (Message.FromCompID > 0) { GetCompany((int)Message.FromCompID); } #endregion #region Get ToComp Detail if (Message.ToCompID > 0) { GetToCompany((int)Message.ToCompID); } #endregion } else { return(Redirect(res.Pageviews.PvAccessDenied)); } } ViewBag.EnumServiceType = new List <view_EnumData>(); return(View()); }
public ActionResult MsgTrade(FormCollection form) { MessageService svMessage = new Message.MessageService(); SelectList_PageSize(); SetPager(form); List <view_Message> Messages; int CompID = int.Parse(form["CompID"]); var SQLWhere = svMessage.CreateWhereAction(MessageStatus.Inbox, CompID); if (!string.IsNullOrEmpty(form["Period"])) { SQLWhere += SQLWhereDateTimeFromPeriod(form["Period"], "SendDate"); } Messages = svMessage.SelectData <view_Message>("* ", SQLWhere, " CreatedDate DESC ", (int)ViewBag.PageIndex, (int)ViewBag.PageSize); return(Json(new { Messages = Messages, PageIndex = (int)ViewBag.PageIndex, TotalRow = svMessage.TotalRow, TotalPage = svMessage.TotalPage, PageSize = (int)ViewBag.PageSize, }, JsonRequestBehavior.AllowGet)); }