Пример #1
0
 private void BtnLoadEditing_Click(object sender, EventArgs e)
 {
     try
     {
         var InstanceLogin = new ATISWebMClassLoginManager();
         var InstanceLoadCapacitorLoadManipulation = new R2CoreTransportationAndLoadNotificationInstanceLoadCapacitorLoadManipulationManager();
         var InstanceLoadCapacitorLoad             = new R2CoreTransportationAndLoadNotificationInstanceLoadCapacitorLoadManager();
         R2CoreTransportationAndLoadNotificationStandardLoadCapacitorLoadStructure NSS = WcGetNSS(false);
         InstanceLoadCapacitorLoadManipulation.LoadCapacitorLoadEditing(NSS, InstanceLogin.GetNSSCurrentUser());
         WcViewInformation(InstanceLoadCapacitorLoad.GetNSSLoadCapacitorLoad(NSS.nEstelamId));
         WcInformationChangedEvent?.Invoke(this, new EventArgs());
         Page.ClientScript.RegisterStartupScript(GetType(), "WcViewAlert", "WcViewAlert('2','" + "ویرایش بار با موفقیت انجام شد" + "');", true);
     }
     catch (SqlInjectionException ex)
     { Page.ClientScript.RegisterStartupScript(GetType(), "WcViewAlert", "WcViewAlert('1','" + ex.Message + "');", true); }
     catch (PleaseReloginException ex)
     { Response.Redirect("/LoginManagement/Wflogin.aspx"); }
     catch (Exception ex) when(ex is LoadCapacitorLoadRegisteringNotAllowedforThisAnnouncementHallSubGroupException || ex is LoadCapacitorLoadNumberOverLimitException || ex is LoadCapacitorLoadnCarNumKolCanNotBeZeroException || ex is TransportCompanyISNotActiveException || ex is LoadCapacitorLoadRegisterTimePassedException || ex is LoadCapacitorLoadEditTimePassedException)
     {
         Page.ClientScript.RegisterStartupScript(GetType(), "WcViewAlert", "WcViewAlert('1','" + ex.Message + "');", true);
     }
     catch (Exception ex) when(ex is LoadCapacitorLoadHandlingNotAllowedBecuaseLoadStatusException || ex is LoadCapacitorLoadNotFoundException || ex is LoadCapacitorLoadEditingChangeAHIdNotAllowedException || ex is LoaderTypeRelationAnnouncementHallNotFoundException || ex is LoaderTypeRelationAnnouncementHallSubGroupNotFoundException)
     {
         Page.ClientScript.RegisterStartupScript(GetType(), "WcViewAlert", "WcViewAlert('1','" + ex.Message + "');", true);
     }
     catch (DataEntryException ex)
     { Page.ClientScript.RegisterStartupScript(GetType(), "WcViewAlert", "WcViewAlert('1','" + ex.Message + "');", true); }
     catch (Exception ex)
     { Page.ClientScript.RegisterStartupScript(GetType(), "WcViewAlert", "WcViewAlert('1','" + MethodBase.GetCurrentMethod().ReflectedType.FullName + "." + MethodBase.GetCurrentMethod().Name + " \\n " + ex.Message + "');", true); }
 }
        public HttpResponseMessage LoadAllocationAgent()
        {
            ATISMobileWebApi WebAPi = new ATISMobileWebApi();

            try
            {
                //تایید اعتبار کلاینت
                WebAPi.AuthenticateClientApikeyNoncePersonalNonceWith1Parameter(Request, ATISMobileWebApiLogTypes.WebApiClientLoadAllocationRegisteringRequest);

                var NSSSoftwareuser       = WebAPi.GetNSSSoftwareUser(Request);
                var InstanceConfiguration = new R2CoreInstanceConfigurationManager();
                var InstanceSoftwareusers = new R2CoreInstanseSoftwareUsersManager();
                var InstanceAES           = new AESAlgorithmsManager();
                var Content      = JsonConvert.DeserializeObject <string>(Request.Content.ReadAsStringAsync().Result);
                var MobileNumber = InstanceAES.Decrypt(Content.Split(';')[0], InstanceConfiguration.GetConfigString(R2CoreConfigurations.PublicSecurityConfiguration, 3));
                var nEstelamId   = Convert.ToInt64(Content.Split(';')[2]);
                var InstanceLoadCapacitorLoad = new R2CoreTransportationAndLoadNotificationInstanceLoadCapacitorLoadManager();
                var NSSLoadCapacitorLoad      = InstanceLoadCapacitorLoad.GetNSSLoadCapacitorLoad(InstanceLoadCapacitorLoad.GetNSSLoadCapacitorLoad(nEstelamId).nEstelamKey);

                Int64 myTurnId = Int64.MinValue;
                try
                {
                    var InstanceTurns = new R2CoreTransportationAndLoadNotificationInstanceTurnsManager();
                    myTurnId = InstanceTurns.GetNSSTurn(NSSSoftwareuser).nEnterExitId;
                }
                catch (Exception ex)
                { throw ex; }

                var   InstanceLoadAllocation = new R2CoreTransportationAndLoadNotificationInstanceLoadAllocationManager();
                Int64 LAId = InstanceLoadAllocation.LoadAllocationRegistering(NSSLoadCapacitorLoad.nEstelamId, myTurnId, NSSSoftwareuser, R2CoreTransportationAndLoadNotificationRequesters.ATISRestfullLoadAllocationRegisteringAgent);
                HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK);
                return(response);
            }
            catch (LoadAllocationNotAllowedBecauseCarHasBlackListException ex)
            { return(WebAPi.CreateErrorContentMessage(ex)); }
            catch (LoadAllocationRegisteringReachedEndTimeException ex)
            { return(WebAPi.CreateErrorContentMessage(ex)); }
            catch (RequesterHasNotPermissionforLoadAllocationRegisteringException ex)
            { return(WebAPi.CreateErrorContentMessage(ex)); }
            catch (LoadCapacitorLoadNotFoundException ex)
            { return(WebAPi.CreateErrorContentMessage(ex)); }
            catch (LoadAllocationNotAllowedBecuaseAHSGLoadAllocationIsUnactiveException ex)
            { return(WebAPi.CreateErrorContentMessage(ex)); }
            catch (TurnNotFoundException ex)
            { return(WebAPi.CreateErrorContentMessage(ex)); }
            catch (UserNotExistByApiKeyException ex)
            { return(WebAPi.CreateErrorContentMessage(ex)); }
            catch (TruckDriverNotFoundException ex)
            { return(WebAPi.CreateErrorContentMessage(ex)); }
            catch (UserLast5DigitNotMatchingException ex)
            { return(WebAPi.CreateErrorContentMessage(ex)); }
            catch (UserIdNotExistException ex)
            { return(WebAPi.CreateErrorContentMessage(ex)); }
            catch (Exception ex)
            { return(WebAPi.CreateErrorContentMessage(ex)); }
        }