public JsonResult RMSGSendMessage(int MessageID, String Subject, String Message)
        {
            FormsAuthenticationTicket ticket = null;

            try
            {
                HttpCookie authCookie = System.Web.HttpContext.Current.Request.Cookies[FormsAuthentication.FormsCookieName];

                ticket = FormsAuthentication.Decrypt(authCookie.Value);

                _UserMessageBusinessLogic = new UserMessageBusinessLogic();
                List <object> returnMessageList = _UserMessageBusinessLogic.RMSGSendMessage(ticket.Name, MessageID, Subject, Message);

                return(Json(returnMessageList));
            }
            catch (Exception ex)
            {
                currentFile = this.ControllerContext.RouteData.Values["controller"].ToString(); // System.Diagnostics.StackTrace(true).GetFrame(0).GetFileName();
                StackTrace st = new StackTrace();
                StackFrame sf = st.GetFrame(0);
                methodName = sf.GetMethod().Name;
                ErrorLogHelper.UpdatingErrorLog(currentFile + "-" + methodName, ticket == null ? "N/A" : ticket.Name, ex);
                return(Json(1));
            }
        }
        public JsonResult GetMessageCount()
        {
            FormsAuthenticationTicket ticket = null;

            try
            {
                HttpCookie authCookie = System.Web.HttpContext.Current.Request.Cookies[FormsAuthentication.FormsCookieName];

                if (authCookie != null)
                {
                    ticket = FormsAuthentication.Decrypt(authCookie.Value);

                    _UserMessageBusinessLogic = new UserMessageBusinessLogic();

                    int result = _UserMessageBusinessLogic.GetMessageCount(ticket.Name);

                    return(Json(result));
                }
                else
                {
                    this.HttpContext.Session["ErrorMsg"] = "LoginErr";
                    return(null);
                }
            }
            catch (Exception ex)
            {
                currentFile = this.ControllerContext.RouteData.Values["controller"].ToString(); // System.Diagnostics.StackTrace(true).GetFrame(0).GetFileName();
                StackTrace st = new StackTrace();
                StackFrame sf = st.GetFrame(0);
                methodName = sf.GetMethod().Name;
                ErrorLogHelper.UpdatingErrorLog(currentFile + "-" + methodName, ticket == null ? "N/A" : ticket.Name, ex);
                return(Json(null));
            }
        }
        public int SMGSendMessage(List <string> UserList, string Subject, string Message)
        {
            FormsAuthenticationTicket ticket = null;

            try
            {
                HttpCookie authCookie = System.Web.HttpContext.Current.Request.Cookies[FormsAuthentication.FormsCookieName];

                ticket = FormsAuthentication.Decrypt(authCookie.Value);
                List <int> UList = new List <int>();
                foreach (string i in UserList)
                {
                    UList.Add(int.Parse(i));
                }

                _UserMessageBusinessLogic = new UserMessageBusinessLogic();

                int result = _UserMessageBusinessLogic.SMGSendMessage(UList, Subject, Message, ticket.Name);

                return(result);
            }
            catch (Exception ex)
            {
                currentFile = this.ControllerContext.RouteData.Values["controller"].ToString(); // System.Diagnostics.StackTrace(true).GetFrame(0).GetFileName();
                StackTrace st = new StackTrace();
                StackFrame sf = st.GetFrame(0);
                methodName = sf.GetMethod().Name;
                ErrorLogHelper.UpdatingErrorLog(currentFile + "-" + methodName, ticket == null ? "N/A" : ticket.Name, ex);
                return(1);
            }
        }