public HttpResponseMessage TurnsCancellation() { ATISMobileWebApi WebAPi = new ATISMobileWebApi(); try { //تایید اعتبار کلاینت WebAPi.AuthenticateClientApikeyNoncePersonalNonceWith2Parameter(Request, ATISMobileWebApiLogTypes.WebApiClientTurnsCancellation); var NSSSoftwareuser = WebAPi.GetNSSSoftwareUser(Request); var InstanceConfiguration = new R2CoreInstanceConfigurationManager(); var InstanceSoftwareusers = new R2CoreInstanseSoftwareUsersManager(); var InstanceSequentialTrun = new R2CoreTransportationAndLoadNotificationInstanceSequentialTurnsManager(); 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 TopSequentialTurnNumber = Content.Split(';')[2]; var YearShamsi = Content.Split(';')[3]; var InstanceCarTruckNobat = new PayanehClassLibraryMClassCarTruckNobatManager(); InstanceCarTruckNobat.TurnsCancellation(TopSequentialTurnNumber, InstanceSequentialTrun.GetNSSSequentialTurn(2), YearShamsi, NSSSoftwareuser); HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK); return(response); } catch (UserNotExistByApiKeyException 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)); } }
private void BtnLoadAllocation_Click(object sender, EventArgs e) { R2CoreTransportationAndLoadNotificationStandardTurnStructure NSSTurn = null; var InstanceCarTruckNobat = new PayanehClassLibraryMClassCarTruckNobatManager(); var InstanceLogin = new ATISWebMClassLoginManager(); try { BtnLoadAllocation.Enabled = false; var InstanceTransportCompanies = new R2CoreTransportationAndLoadNotificationInstanceTransportCompaniesManager(); var NSSTruck = WcSmartCardsInquiry.WcGetNSSTruck; var NSSTruckDriver = WcSmartCardsInquiry.WcGetNSSTruckDriver; var NSSTransportCompany = InstanceTransportCompanies.GetNSSTransportCompnay(InstanceLogin.GetNSSCurrentUser()); var NSSLoadCapacitorLoad = WcViewerNSSLoadCapacitorLoad.WcGetNSSCurrent; //به دست آوردن نوبت موجود ناوگان و یا این که در صورت عدم وجود نوبت باید روابط موقت ایجاد گردد و نوبت صادر گردد //در این جا از کیف پول شرکت حمل و نقل استفاده شده است //سه رابطه ایجاد می گردد ناوگان-راننده و ناوگان-زیرگروه اعلام بار و ناوگان-کیف پول var InstanceTurns = new R2CoreTransportationAndLoadNotificationInstanceTurnsManager(); var TempTurnReport = string.Empty; try { NSSTurn = InstanceTurns.GetNSSTurn(NSSTruck); TempTurnReport = "ناوگان نوبت دارد.برای تخصیص بار از نوبت موجود استفاده شد "; PnlTurnStatus.BackColor = System.Drawing.Color.Green; } catch (TurnNotFoundException ex) { NSSTurn = InstanceTurns.GetNSSTurn(InstanceCarTruckNobat.GetTurnofKiosk(NSSTruck, NSSTruckDriver, NSSTransportCompany, NSSLoadCapacitorLoad, InstanceLogin.GetNSSCurrentUser())); TempTurnReport = "ناوگان نوبت ندارد.نوبت به صورت خودکار در سامانه صادر شد "; PnlTurnStatus.BackColor = System.Drawing.Color.Red; } //تخصیص بار - آزاد سازی بار به صورت خودکار توسط سرور انجام می گردد //مشاهده و چاپ مجوز از طریق قسمت مجوزهای صادر شده در بارهای رسوبی قابل مشاهده است var InstanceLoadAllocation = new R2CoreTransportationAndLoadNotificationInstanceLoadAllocationManager(); Int64 LAId = InstanceLoadAllocation.LoadAllocationRegistering(NSSLoadCapacitorLoad.nEstelamId, NSSTurn.nEnterExitId, InstanceLogin.GetNSSCurrentUser(), R2CoreTransportationAndLoadNotificationRequesters.WcLoadCapacitorLoadAllocationLoadPermissionIssue); LblTurnStatus.Text = TempTurnReport; Page.ClientScript.RegisterStartupScript(GetType(), "WcViewAlert", "WcViewAlert('2','تخصیص بار با موفقیت انجام شد');", true); } catch (Exception ex) when(ex is SoftwareUserMoneyWalletNotFoundException || ex is MoneyWalletCurrentChargeNotEnoughException || ex is TurnRegisterRequestTypeNotFoundException || ex is CarIsNotPresentInParkingException || ex is SequentialTurnIsNotActiveException || ex is TurnPrintingInfNotFoundException || ex is GetNobatExceptionCarTruckIsTankTreiler || ex is CarTruckTravelLengthNotOverYetException || ex is GetNobatExceptionCarTruckHasNobat || ex is GetNobatException || ex is GetNSSException || ex is TruckRelatedSequentialTurnNotFoundException || ex is TransportCompanyNotFoundException || ex is LoadCapacitorLoadNotFoundException || ex is DataEntryException || ex is AnnouncementHallSubGroupUnActiveException || ex is AnnouncementHallSubGroupRelationTruckNotExistException || ex is AnnouncementHallSubGroupNotFoundException || ex is LoadAllocationRegisteringReachedEndTimeException || ex is LoadAllocationMaximumAllowedNumberReachedException || ex is LoadCapacitorLoadAHSGIdViaTruckAHSGIdNotAllowedException || ex is LoadAllocationRegisteringFailedBecauseLoadCapacitorLoadIsNotReadyException || ex is LoadAllocationRegisteringFailedBecauseTurnIsNotReadyException || ex is LoadCapacitorLoadLoaderTypeViaSequentialTurnOfTurnNotAllowedException || ex is LoadAllocationNotAllowedBecuaseAHSGLoadAllocationIsUnactiveException || ex is LoadCapacitorLoadHandlingNotAllowedBecuaseLoadStatusException || ex is RegisteredLoadAllocationIsRepetitiousException || ex is RequesterHasNotPermissionforLoadAllocationRegisteringException || ex is LoadAllocationNotAllowedBecauseCarHasBlackListException || ex is TimingNotReachedException || ex is TurnNotFoundException || ex is TruckNotFoundException || ex is TurnHandlingNotAllowedBecuaseTurnStatusException || ex is UnableAllocatingTommorowLoadException || ex is RequesterNotAllowTurnIssueBySeqTException || ex is RequesterNotAllowTurnIssueByLastLoadPermissionedException || ex is LoadCapacitorLoadNotFoundException) { Page.ClientScript.RegisterStartupScript(GetType(), "WcViewAlert", "WcViewAlert('1','" + ex.Message.Replace("\r\n", " ") + "');", true); } catch (PleaseReloginException ex) { Response.Redirect("/LoginManagement/Wflogin.aspx"); } catch (Exception ex) { Page.ClientScript.RegisterStartupScript(GetType(), "WcViewAlert", "WcViewAlert('1','" + MethodBase.GetCurrentMethod().ReflectedType.FullName + "." + MethodBase.GetCurrentMethod().Name + "." + ex.Message + "');", true); } }