Beispiel #1
0
        public static string GetSubmitStatusInv(string version, string data)
        {
            if (!SiteMaster.IsValid())
            {
                return(ApiResponse.JSONError(ResponseType.ErrorAuth));
            }

            var user    = HttpContext.Current.Session[SKeys.User] as User;
            var keyList = JsonConvert.DeserializeObject <List <string> >(data);
            var type    = IntegrationHandler.GetSubmitType(user, keyList);

            return(ApiResponse.JSONSuccess(type));
        }
Beispiel #2
0
 public static string GetSendList(string version, string data)
 {
     if (SiteMaster.VerifyRequest(HttpContext.Current.Session))
     {
         var user            = HttpContext.Current.Session[SKeys.User] as User;
         SubmitPreRequest sr = JsonConvert.DeserializeObject <SubmitPreRequest>(data);
         var pr = IntegrationHandler.GetSendRecord(user, sr);
         return(ApiResponse.JSONSuccess(pr));
     }
     else
     {
         return(ApiResponse.JSONError(ResponseType.ErrorAuth));
     }
 }
Beispiel #3
0
 public static string EditInvoices(string version, string data)
 {
     if (SiteMaster.VerifyRequest(HttpContext.Current.Session))
     {
         var user = HttpContext.Current.Session[SKeys.User] as User;
         List <IntHeadRecord> updateRecords = JsonConvert.DeserializeObject <List <IntHeadRecord> >(data);
         IntegrationHandler.EditInvoices(user, updateRecords);
         return(ApiResponse.JSONSuccess());
     }
     else
     {
         return(ApiResponse.JSONError(ResponseType.ErrorAuth));
     }
 }
Beispiel #4
0
 public static string GetInvoiceCount(string version, string data)
 {
     if (SiteMaster.VerifyRequest(HttpContext.Current.Session))
     {
         var        user   = HttpContext.Current.Session[SKeys.User] as User;
         FilterInfo filter = JsonConvert.DeserializeObject <FilterInfo>(data);
         var        recCt  = IntegrationHandler.GetRecordCount(user, filter);
         return(ApiResponse.JSONSuccess(recCt));
     }
     else
     {
         return(ApiResponse.JSONError(ResponseType.ErrorAuth));
     }
 }
Beispiel #5
0
 public static string GetPendingList(string version, string data)
 {
     if (SiteMaster.VerifyRequest(HttpContext.Current.Session))
     {
         var        user   = HttpContext.Current.Session[SKeys.User] as User;
         FilterInfo filter = JsonConvert.DeserializeObject <FilterInfo>(data);
         var        list   = IntegrationHandler.GetCurrentInvoices(user, filter);
         return(ApiResponse.JSONSuccess(new
         {
             TableState = CreateState(filter, list.Any(x => x.TransferType == "C")),
             TableData = list
         }));
     }
     else
     {
         return(ApiResponse.JSONError(ResponseType.ErrorAuth));
     }
 }
Beispiel #6
0
        public static string InitPendingList(string version, string data)
        {
            if (SiteMaster.VerifyRequest(HttpContext.Current.Session))
            {
                var user            = HttpContext.Current.Session[SKeys.User] as User;
                var opt             = IntegrationHandler.GetOptions(user);
                var initialFilter   = CreateFilter();
                var tData           = IntegrationHandler.GetCurrentInvoices(user, initialFilter);
                var hasConsolidated = tData.Any(x => x.TransferType == "C");

                TableState tState = CreateState(initialFilter, hasConsolidated);

                var cOpt = IntegrationHandler.GetCarrierOptions(user);
                return(ApiResponse.JSONSuccess(new
                {
                    TableState = tState,
                    TableData = tData,
                    Options = new
                    {
                        Date = DateTime.Now.ToString("MMM dd yyyy"),
                        Invoice = new
                        {
                            Enabled = opt.IsInvoiceEnabled
                        },
                        Packing = new
                        {
                            Enabled = opt.IsPackingEnabled,
                            IsPP = opt.IsPPEnabled,
                            IsMX = opt.IsMXEnabled,
                            IsDS = opt.IsDSEnabled,
                            Default = opt.BoxOption
                        },
                        Shipping = new
                        {
                            Carriers = cOpt
                        }
                    }
                }));
            }
            else
            {
                return(ApiResponse.JSONError(ResponseType.ErrorAuth));
            }
        }
Beispiel #7
0
 public static string SendRecords(string version, string data)
 {
     if (SiteMaster.VerifyRequest(HttpContext.Current.Session))
     {
         var user         = HttpContext.Current.Session[SKeys.User] as User;
         var mergeRequest = JsonConvert.DeserializeObject <SubmitRequest>(data);
         try
         {
             var uniqueKeys = IntegrationHandler.SendInvoices(user, mergeRequest);
             return(ApiResponse.JSONSuccess(uniqueKeys));
         }
         catch
         {
             return(ApiResponse.JSONError(ResponseType.ErrorITMInvoiceSendUnknown));
         }
     }
     else
     {
         return(ApiResponse.JSONError(ResponseType.ErrorAuth));
     }
 }
Beispiel #8
0
 public static string EditFilteredInvoices(string version, string data)
 {
     if (SiteMaster.VerifyRequest(HttpContext.Current.Session))
     {
         var user = HttpContext.Current.Session[SKeys.User] as User;
         var pack = JObject.Parse(data);
         if (pack["filter"] != null && pack["data"] != null)
         {
             FilterInfo    filter = JsonConvert.DeserializeObject <FilterInfo>(pack["filter"].ToString());
             IntHeadRecord ihr    = JsonConvert.DeserializeObject <IntHeadRecord>(pack["data"].ToString());
             IntegrationHandler.EditFilteredInvoices(user, filter, ihr);
             return(ApiResponse.JSONSuccess());
         }
         else
         {
             return(ApiResponse.JSONError(ResponseType.ErrorITMInvoiceSendUnknown));
         }
     }
     else
     {
         return(ApiResponse.JSONError(ResponseType.ErrorAuth));
     }
 }