public ActionResult UpdateTickets(BlUserTickets Objblusertickets)
        {
            if (Session["ID_Agent"] == "" || Session["ID_Agent"] == "null")
            {
                Session["ID_Agent"] = "0";
            }
            Objblusertickets.UserCode      = Convert.ToInt64(Session["ID_Users"]);
            Objblusertickets.FK_Company    = Convert.ToInt64(Session["ID_Company"]);
            Objblusertickets.AgentCode     = Convert.ToInt64(Session["ID_Agent"]);
            Objblusertickets.XmlAttachment = attname;
            try
            {
                Objblusertickets.UserIPAddress = Request.ServerVariables["REMOTE_ADDR"];
            }
            catch (Exception ex)
            {
                Objblusertickets.UserIPAddress = ":01";
            }

            long statusCode = 0;

            if (Objblusertickets.MasterID == 0)
            {
                statusCode = Objblusertickets.InsertData();
            }
            else
            {
                statusCode = Objblusertickets.UpdateData();
            }

            Objblusertickets = null;
            attname          = "";
            return(Json(new { statusCode = "" + statusCode + "" }, JsonRequestBehavior.AllowGet));
        }
        public JsonResult SelectAllTickets(string PageIndex = "1", string Status = "0", string SearchItem = "")
        {
            try
            {
                int           statusCode    = 1;
                DataTable     dtbl          = new DataTable();
                BlUserTickets blusertickets = new BlUserTickets();
                blusertickets.UserCode   = Convert.ToInt64(Session["ID_Users"]);
                blusertickets.FK_Company = Convert.ToInt64(Session["ID_Company"]);

                blusertickets.TickNo      = SearchItem;
                blusertickets.TickSubject = SearchItem;
                blusertickets.ProdName    = SearchItem;


                blusertickets.TickStatus = Convert.ToInt16(Status);
                blusertickets.PageIndex  = Convert.ToInt32(PageIndex);
                dtbl = blusertickets.SelectAllData();
                return(Json(Converttojson(dtbl), JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                ///
                return(Json(ex));
            }
        }
        public JsonResult AutoGenTktNo()
        {
            try
            {
                DataTable     dt            = new DataTable();
                BlUserTickets blUserTickets = new BlUserTickets();
                blUserTickets.UserCode   = Convert.ToInt64(Session["ID_Agent"]);
                blUserTickets.FK_Company = Convert.ToInt64(Session["ID_Company"]);

                dt = blUserTickets.AutoGenTktNo();
                return(Json(Converttojson(dt), JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                return(Json(ex));
            }
        }
 public JsonResult GetTicketDetails(Int64 FK_Tickets)
 {
     try
     {
         int           statusCode    = 1;
         DataTable     dtbl          = new DataTable();
         BlUserTickets blusertickets = new BlUserTickets();
         blusertickets.UserCode   = Convert.ToInt64(Session["ID_Users"]);
         blusertickets.FK_Company = Convert.ToInt64(Session["ID_Company"]);
         blusertickets.MasterID   = Convert.ToInt64(FK_Tickets);
         dtbl = blusertickets.SelectGetTicketDetails();
         return(Json(Converttojson(dtbl), JsonRequestBehavior.AllowGet));
     }
     catch (Exception ex)
     {
         ///
         return(Json(ex));
     }
 }