Beispiel #1
0
        public HttpResponseMessage GetFirstActiveTurn()
        {
            ATISMobileWebApi WebAPi = new ATISMobileWebApi();

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

                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 InstanceTurns           = new R2CoreTransportationAndLoadNotificationInstanceTurnsManager();
                var InstanceSequentialTurns = new R2CoreTransportationAndLoadNotificationInstanceSequentialTurnsManager();
                var NSSTurn = InstanceTurns.GetFirstActiveTurn(InstanceSequentialTurns.GetNSSSequentialTurn(Convert.ToInt64(SequentialTurns.SequentialTurnZobi)));

                HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK);
                response.Content = new StringContent(JsonConvert.SerializeObject(NSSTurn.OtaghdarTurnNumber), Encoding.UTF8, "application/json");
                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)); }
        }
        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)); }
        }
 private void AuthorizationLoadAllocationIdWithSoftwareUser(R2CoreStandardSoftwareUserStructure YourNSSSoftwareUser, Int64 YourLoadAllocationId)
 {
     try
     {
         var InstanceLoadAllocation = new R2CoreTransportationAndLoadNotificationInstanceLoadAllocationManager();
         var InstanceTurn           = new R2CoreTransportationAndLoadNotificationInstanceTurnsManager();
         if (InstanceTurn.GetNSSTurn(YourNSSSoftwareUser).nEnterExitId != InstanceLoadAllocation.GetNSSLoadAllocation(YourLoadAllocationId).TurnId)
         {
             throw new LoadAllocationIdNotPairWithDriverException();
         }
     }
     catch (Exception ex)
     { throw ex; }
 }
Beispiel #4
0
        public HttpResponseMessage GetTurns()
        {
            ATISMobileWebApi WebAPi = new ATISMobileWebApi();

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

                var NSSSoftwareuser         = WebAPi.GetNSSSoftwareUser(Request);
                var InstanceTurns           = new R2CoreTransportationAndLoadNotificationInstanceTurnsManager();
                var InstanceSequentialTurns = new R2CoreTransportationAndLoadNotificationInstanceSequentialTurnsManager();
                var Lst = InstanceTurns.GetTurns(NSSSoftwareuser);
                List <Models.Turns> _Turns = new List <Models.Turns>();
                for (int Loopx = 0; Loopx <= Lst.Count - 1; Loopx++)
                {
                    var Item = new Models.Turns();
                    Item.TurnId = Lst[Loopx].nEnterExitId.ToString();
                    var OtaghdarTurnNumber     = Lst[Loopx].OtaghdarTurnNumber.Trim().Split('-')[0];
                    var TurnDistanceToValidity = Lst[Loopx].OtaghdarTurnNumber.Trim().Split('-')[1];
                    Item.OtaghdarTurnNumber = "شماره نوبت : " + OtaghdarTurnNumber + " فاصله شما تا اعتبار : " + TurnDistanceToValidity;
                    if (Loopx == 0)
                    {
                        var NSSSeqTurn = InstanceSequentialTurns.GetNSSSequentialTurn(Lst[Loopx]);
                        Item.OtaghdarTurnNumber += "\r\n" + "شماره اعتبار : " + InstanceTurns.GetFirstActiveTurn(NSSSeqTurn).OtaghdarTurnNumber;
                    }
                    Item.TurnDateTime    = "زمان: " + Lst[Loopx].EnterDate.Trim() + " - " + Lst[Loopx].EnterTime.Trim();
                    Item.TurnStatusTitle = "وضعیت نوبت: " + Lst[Loopx].TurnStatusTitle.Trim();
                    Item.LPPString       = "ناوگان: " + Lst[Loopx].LicensePlatePString.Trim();
                    Item.TruckDriver     = "راننده: " + Lst[Loopx].TruckDriver.Trim();
                    _Turns.Add(Item);
                }

                HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK);
                response.Content = new StringContent(JsonConvert.SerializeObject(_Turns), Encoding.UTF8, "application/json");
                return(response);
            }
            catch (UserNotExistByApiKeyException ex)
            { return(WebAPi.CreateSuccessContentMessage(string.Empty)); }
            catch (Exception ex)
            { return(WebAPi.CreateErrorContentMessage(ex)); }
        }
Beispiel #5
0
        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); }
        }