Ejemplo n.º 1
0
 public static string saveTicket(SaveTicketsVM model)
 {
     try
     {
         string json = JsonConvert.SerializeObject(model, Newtonsoft.Json.Formatting.None,
                                                   new JsonSerializerSettings
         {
             NullValueHandling = NullValueHandling.Ignore
         });
         var response = ApiRequest("/maximo/oslc/os/tprime", Method.POST, json, 0, null);
         //var response = ApiRequest("/maximo/oslc/os/prime", Method.POST, json, 0, null);
         if (response.StatusCode == System.Net.HttpStatusCode.Created)
         {
             return("success");
         }
         else
         {
             return(response.Content);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 2
0
        public JsonResult UpdateTicket(int id, SaveTicketsVM model, string viewName)
        {
            var checkCookie = PreventiveMaintenanceManager.getCookie("LtpaToken2", "LtpaToken2");

            checkCookieExistence(checkCookie);
            model.changeby   = User.Identity.GetClaimValue(CustomClaims.UserName).Value;
            model.changedate = DateTime.UtcNow.ToString();
            var response = PreventiveMaintenanceManager.UpdateTicket(id, model, viewName);

            return(Json(response));
        }
Ejemplo n.º 3
0
        public JsonResult SaveTicket(SaveTicketsVM model)
        {
            model.sitestatus = "D-Prime";
            var checkCookie = PreventiveMaintenanceManager.getCookie("LtpaToken2", "LtpaToken2");

            checkCookieExistence(checkCookie);
            model.createdby = User.Identity.GetClaimValue(CustomClaims.UserName).Value;
            //model.createdate = DateTime.Now;
            var response = PreventiveMaintenanceManager.saveTicket(model);

            return(Json(new { response = response }));
        }
Ejemplo n.º 4
0
 public static string UpdateTicket(int id, SaveTicketsVM model, string viewName)
 {
     try
     {
         var jsonResolver = new PropertyRenameAndIgnoreSerializerContractResolver();
         if (viewName == "ViewTicketForApproval")
         {
             jsonResolver.IgnoreProperty(typeof(SaveTicketsVM), "spi:ttstatus");
             jsonResolver.IgnoreProperty(typeof(SaveTicketsVM), "spi:sitestatus");
         }
         jsonResolver.IgnoreProperty(typeof(SaveTicketsVM), "spi:sitecode");
         jsonResolver.IgnoreProperty(typeof(SaveTicketsVM), "spi:wapdafaults");
         jsonResolver.IgnoreProperty(typeof(SaveTicketsVM), "spi:issue");
         jsonResolver.IgnoreProperty(typeof(SaveTicketsVM), "spi:approver");
         jsonResolver.IgnoreProperty(typeof(SaveTicketsVM), "spi:category");
         jsonResolver.IgnoreProperty(typeof(SaveTicketsVM), "spi:approverstatustime");
         jsonResolver.IgnoreProperty(typeof(SaveTicketsVM), "spi:createdate");
         jsonResolver.IgnoreProperty(typeof(SaveTicketsVM), "spi:createby");
         jsonResolver.IgnoreProperty(typeof(SaveTicketsVM), "spi:stage");
         jsonResolver.IgnoreProperty(typeof(SaveTicketsVM), "spi:issuestarttime");
         if (viewName == "ViewTicketForApproval")
         {
             if (model.approvalstatus == "Approved")
             {
                 jsonResolver.IgnoreProperty(typeof(SaveTicketsVM), "spi:rejectioncomments");
             }
         }
         if (viewName == "ViewTicketForCloseReopenLogistics")
         {
             if (model.approver != model.assignedto)
             {
                 jsonResolver.IgnoreProperty(typeof(SaveTicketsVM), "spi:issueclosetime");
                 jsonResolver.IgnoreProperty(typeof(SaveTicketsVM), "spi:actiontaken");
             }
             jsonResolver.IgnoreProperty(typeof(SaveTicketsVM), "spi:approvalstatus");
             jsonResolver.IgnoreProperty(typeof(SaveTicketsVM), "spi:sitestatus");
             jsonResolver.IgnoreProperty(typeof(SaveTicketsVM), "spi:statusdate");
         }
         if (viewName == "ViewTicketForResolution")
         {
             jsonResolver.IgnoreProperty(typeof(SaveTicketsVM), "spi:approvalstatus");
             jsonResolver.IgnoreProperty(typeof(SaveTicketsVM), "spi:rejectioncomments");
         }
         if (viewName == "ViewTicketForCloseReopenOAN")
         {
             jsonResolver.IgnoreProperty(typeof(SaveTicketsVM), "spi:approvalstatus");
             jsonResolver.IgnoreProperty(typeof(SaveTicketsVM), "spi:sitestatus");
         }
         var serializerSettings = new JsonSerializerSettings();
         serializerSettings.ContractResolver = jsonResolver;
         var json = JsonConvert.SerializeObject(model, Newtonsoft.Json.Formatting.None,
                                                new JsonSerializerSettings
         {
             NullValueHandling = NullValueHandling.Ignore,
             ContractResolver  = jsonResolver
         });
         var response = ApiRequest("/maximo/oslc/os/tprime/", Method.POST, json, id, "UPDATE");
         if (response.StatusCode == System.Net.HttpStatusCode.NoContent)
         {
             return("success");
         }
         else
         {
             return(response.Content);
         }
         //return "success";
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }