public ActionResult DeleteRouteOfficerLocal(int id)
        {
            string msg   = "";
            var    rv    = new AppRouteSession();
            var    model = _repo.GetRouteOfficer(id);

            if (model == null)
            {
                msg = "Bad Request";
                return(Json(new { RespCode = 0, RespMessage = msg }, JsonRequestBehavior.AllowGet));
            }
            var obj = new ApprovalRouteOffObj()
            {
                APPROVER_ID = model.APPROVER_ID,
                MENUID      = model.MENUID,
                PRIORITY    = model.PRIORITY,
                USERID      = User.Identity.Name,
                DB_ITBID    = model.DB_ITBID,
                PID         = model.PID,
                EVENTTYPE   = eventDelete,
            };
            OutPutObj rst;

            rst = rv.PostRouteOfficer(obj, 2);
            if (rst != null && rst.RespCode != 0)
            {
                msg = rst.RespMessage; // "Revenue Code Already exist. Duplicate Record is not allowed.";
                return(Json(new { RespCode = 1, RespMessage = msg }, JsonRequestBehavior.AllowGet));
            }
            //SessionHelper.GetRvHead(Session).UpdateItem(obj);
            // rv.PostRevenueHead(obj, 2);
            var w    = rv.GetRouteOfficer(User.Identity.Name); // GetRvHeadLines().ToList();
            var html = PartialView("_ViewRouteOfficer", w).RenderToString();

            msg = "Record Updated to List";
            return(Json(new { data_html = html, RespCode = 0, RespMessage = msg }, JsonRequestBehavior.AllowGet));
        }
        public ActionResult AddRouteOfficer(ApprovalRouteOffObj model, string m)
        {
            var    rv  = new AppRouteSession();
            string msg = "";

            try
            {
                //var lst = GetRvHeadLines().ToList();
                if (string.IsNullOrEmpty(model.PID) && model.DB_ITBID.GetValueOrDefault() <= 0)
                {
                    var obj = new ApprovalRouteOffObj()
                    {
                        APPROVER_ID = model.APPROVER_ID,
                        MENUID      = model.MENUID,
                        PRIORITY    = model.PRIORITY,
                        PID         = model.PID,
                        EVENTTYPE   = eventInsert,
                        USERID      = User.Identity.Name
                    };
                    //SessionHelper.GetRvHead(Session).AddItem(obj);
                    var rst = rv.PostRouteOfficer(obj, 1);
                    if (rst != null && rst.RespCode != 0)
                    {
                        msg = rst.RespMessage; // "Revenue Code Already exist. Duplicate Record is not allowed.";
                        return(Json(new { RespCode = 1, RespMessage = msg }, JsonRequestBehavior.AllowGet));
                    }
                    var w    = rv.GetRouteOfficer(User.Identity.Name); // GetRvHeadLines().ToList();
                    var html = PartialView("_ViewRouteOfficer", w).RenderToString();
                    msg = "Record Added to List";
                    return(Json(new { data_html = html, RespCode = 0, RespMessage = msg }, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    var obj = new ApprovalRouteOffObj()
                    {
                        APPROVER_ID = model.APPROVER_ID,
                        MENUID      = model.MENUID,
                        PRIORITY    = model.PRIORITY,
                        USERID      = User.Identity.Name,
                        DB_ITBID    = model.DB_ITBID,
                        PID         = model.PID,
                        EVENTTYPE   = model.DB_ITBID > 0 ? eventEdit : eventInsert,
                    };
                    OutPutObj rst;
                    rst = rv.PostRouteOfficer(obj, 2);
                    if (rst != null && rst.RespCode != 0)
                    {
                        msg = rst.RespMessage; // "Revenue Code Already exist. Duplicate Record is not allowed.";
                        return(Json(new { RespCode = 1, RespMessage = msg }, JsonRequestBehavior.AllowGet));
                    }
                    //SessionHelper.GetRvHead(Session).UpdateItem(obj);
                    // rv.PostRevenueHead(obj, 2);
                    var w    = rv.GetRouteOfficer(User.Identity.Name); // GetRvHeadLines().ToList();
                    var html = PartialView("_ViewRouteOfficer", w).RenderToString();
                    msg = "Record Updated to List";
                    return(Json(new { data_html = html, RespCode = 0, RespMessage = msg }, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception ex)
            {
                msg = ex.Message;
                return(Json(new { RespCode = 1, RespMessage = msg }, JsonRequestBehavior.AllowGet));
            }
        }