Example #1
0
        public ActionResult Display(string ticketId, string message)
        {
            string permissions = "";
            int    stat        = 0;

            if (HasPermission("[ticket]", ref permissions, ref stat))
            {
                return(RedirectToAction("AccessDeny"));
            }
            ViewBag.permissions = permissions;
            ViewBag.stat        = stat;
            ViewBag.Title       = "مشاهده تیکت";
            try
            {
                Ticket tk = new Ticket();
                tk.Id         = long.Parse(ticketId);
                tk            = tk.GetOne();
                tk.Status     = 2;
                tk.StatusDate = DateTime.Now;
                tk.Update();

                TicketContent tkc = new TicketContent();
                tkc.Content      = message;
                tkc.UserId       = int.Parse(Session["user_id"].ToString());
                tkc.RegisterDate = DateTime.Now;
                tkc.TicketId     = tk.Id;
                tkc.Add();

                return(RedirectToAction("Index", "Ticket"));
            }
            catch (Exception ex)
            {
                ErrorLog log = new ErrorLog();
                log.Description = ex.Message;
                if (ex.InnerException != null)
                {
                    log.Description += ";" + ex.Message;
                }
                log.ErrorDate = DateTime.Now;
                log.Add();
            }
            Dictionary <string, string> parameter = new Dictionary <string, string>();

            parameter.Add("TicketId", ticketId);
            List <TicketContent> model = new TicketContent().GetAll(parameter);

            ViewBag.Id = ticketId;
            return(View(model));
        }
Example #2
0
        public ActionResult New(string subject, string message, string periority)
        {
            ViewBag.Title = "ارسال تیکت جدید";
            Ticket tk = new Ticket();

            try
            {
                tk.CreateDate = DateTime.Now;
                tk.CustomerId = long.Parse(Session["customer_id"].ToString());
                tk.Priority   = int.Parse(periority);
                tk.Status     = 1;
                tk.StatusDate = DateTime.Now;
                tk.Subject    = subject;
                tk.Add();

                TicketContent tkc = new TicketContent();
                tkc.Content      = message;
                tkc.CustomerId   = long.Parse(Session["customer_id"].ToString());
                tkc.RegisterDate = DateTime.Now;
                tkc.TicketId     = tk.Id;
                tkc.Add();

                return(RedirectToAction("Index", "Ticket"));
            }
            catch (Exception ex)
            {
                ErrorLog log = new ErrorLog();
                log.Description = ex.Message;
                if (ex.InnerException != null)
                {
                    log.Description += ";" + ex.Message;
                }
                log.ErrorDate = DateTime.Now;
                log.Add();
            }
            return(View(tk));
        }