Example #1
0
        public ActionResult Post(bool IsNew, Spartan_WorkFlow_StatusModel varSpartan_WorkFlow_Status)
        {
            try
            {
                //if (ModelState.IsValid)
                //{
                if (!_tokenManager.GenerateToken())
                {
                    return(Json(null, JsonRequestBehavior.AllowGet));
                }
                _ISpartan_WorkFlow_StatusApiConsumer.SetAuthHeader(_tokenManager.Token);



                var result = "";
                var Spartan_WorkFlow_StatusInfo = new Spartan_WorkFlow_Status
                {
                    StatusId      = varSpartan_WorkFlow_Status.StatusId
                    , Description = varSpartan_WorkFlow_Status.Description
                };

                result = !IsNew?
                         _ISpartan_WorkFlow_StatusApiConsumer.Update(Spartan_WorkFlow_StatusInfo, null, null).Resource.ToString() :
                             _ISpartan_WorkFlow_StatusApiConsumer.Insert(Spartan_WorkFlow_StatusInfo, null, null).Resource.ToString();

                Session["KeyValueInserted"] = result;
                return(Json(result, JsonRequestBehavior.AllowGet));
                //}
                //return Json(false, JsonRequestBehavior.AllowGet);
            }
            catch (ServiceException ex)
            {
                return(Json(false, JsonRequestBehavior.AllowGet));
            }
        }
Example #2
0
        public ActionResult Create(short Id = 0, int consult = 0)
        {
            var permission = PermissionHelper.GetRoleObjectPermission(SessionHelper.Role, 123);

            ViewBag.Permission = permission;
            var varSpartan_WorkFlow_Status = new Spartan_WorkFlow_StatusModel();

            ViewBag.ObjectId  = "123";
            ViewBag.Operation = "New";

            ViewBag.IsNew = true;



            if ((Id.GetType() == typeof(string) && Id.ToString() != "") || ((Id.GetType() == typeof(int) || Id.GetType() == typeof(Int16) || Id.GetType() == typeof(Int32) || Id.GetType() == typeof(Int64) || Id.GetType() == typeof(short)) && Id.ToString() != "0"))
            {
                ViewBag.IsNew     = false;
                ViewBag.Operation = "Update";
                if (!_tokenManager.GenerateToken())
                {
                    return(Json(null, JsonRequestBehavior.AllowGet));
                }
                _ISpartan_WorkFlow_StatusApiConsumer.SetAuthHeader(_tokenManager.Token);
                var Spartan_WorkFlow_StatusData = _ISpartan_WorkFlow_StatusApiConsumer.GetByKeyComplete(Id).Resource.Spartan_WorkFlow_Statuss[0];
                if (Spartan_WorkFlow_StatusData == null)
                {
                    return(HttpNotFound());
                }

                varSpartan_WorkFlow_Status = new Spartan_WorkFlow_StatusModel
                {
                    StatusId      = (short)Spartan_WorkFlow_StatusData.StatusId
                    , Description = Spartan_WorkFlow_StatusData.Description
                };
            }
            if (!_tokenManager.GenerateToken())
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }



            ViewBag.Consult = consult == 1;
            if (consult == 1)
            {
                ViewBag.Operation = "Consult";
            }
            return(View(varSpartan_WorkFlow_Status));
        }
Example #3
0
        public ActionResult AddSpartan_WorkFlow_Status(int rowIndex = 0, int functionMode = 0, string id = "0")
        {
            ViewBag.currentRowIndex = rowIndex;
            ViewBag.functionMode    = functionMode;
            ViewBag.Consult         = false;
            var permission = PermissionHelper.GetRoleObjectPermission(SessionHelper.Role, 123);

            ViewBag.Permission = permission;
            if (!_tokenManager.GenerateToken())
            {
                return(null);
            }
            _ISpartan_WorkFlow_StatusApiConsumer.SetAuthHeader(_tokenManager.Token);
            Spartan_WorkFlow_StatusModel varSpartan_WorkFlow_Status = new Spartan_WorkFlow_StatusModel();


            if (id.ToString() != "0")
            {
                var Spartan_WorkFlow_StatussData = _ISpartan_WorkFlow_StatusApiConsumer.ListaSelAll(0, 1000, "StatusId=" + id, "").Resource.Spartan_WorkFlow_Statuss;

                if (Spartan_WorkFlow_StatussData != null && Spartan_WorkFlow_StatussData.Count > 0)
                {
                    var Spartan_WorkFlow_StatusData = Spartan_WorkFlow_StatussData.First();
                    varSpartan_WorkFlow_Status = new Spartan_WorkFlow_StatusModel
                    {
                        StatusId      = Spartan_WorkFlow_StatusData.StatusId
                        , Description = Spartan_WorkFlow_StatusData.Description
                    };
                }
            }
            if (!_tokenManager.GenerateToken())
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }



            return(PartialView("AddSpartan_WorkFlow_Status", varSpartan_WorkFlow_Status));
        }