public HttpResponseMessage GetTruck()
        {
            ATISMobileWebApi WebAPi = new ATISMobileWebApi();

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

                var NSSSoftwareuser = WebAPi.GetNSSSoftwareUser(Request);
                var InstanceTrucks  = new R2CoreTransportationAndLoadNotificationInstanceTrucksManager();
                var Truck           = InstanceTrucks.GetNSSTruck(NSSSoftwareuser);
                var Item            = new Models.Truck();
                Item.TruckId     = "کد ناوگان: " + Truck.NSSCar.nIdCar;
                Item.LPString    = "ناوگان: " + Truck.NSSCar.GetCarPelakSerialComposit();
                Item.LoaderTitle = "بارگیر: " + Truck.NSSCar.snCarType;
                Item.SmartCardNo = "هوشمند: " + Truck.SmartCardNo;
                Item.AnnouncementHallSubGroups = "گروه های مجاز بار : " + string.Join(",", InstanceTrucks.GetAnnouncementHallSubGroupsTitle(Truck));
                HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK);
                response.Content = new StringContent(JsonConvert.SerializeObject(Item), Encoding.UTF8, "application/json");
                return(response);
            }
            catch (AnnouncementHallSubGroupNotFoundException ex)
            { return(WebAPi.CreateSuccessContentMessage(string.Empty)); }
            catch (AnnouncementHallSubGroupRelationTruckNotExistException ex)
            { return(WebAPi.CreateSuccessContentMessage(string.Empty)); }
            catch (GetNSSException ex)
            { return(WebAPi.CreateSuccessContentMessage(string.Empty)); }
            catch (TruckNotFoundException ex)
            { return(WebAPi.CreateSuccessContentMessage(string.Empty)); }
            catch (UserNotExistByMobileNumberException ex)
            { return(WebAPi.CreateSuccessContentMessage(string.Empty)); }
            catch (Exception ex)
            { return(WebAPi.CreateErrorContentMessage(ex)); }
        }
Exemplo n.º 2
0
        public HttpResponseMessage GetMobileProcesses()
        {
            ATISMobileWebApi WebAPi = new ATISMobileWebApi();

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

                var NSSSoftwareuser = WebAPi.GetNSSSoftwareUser(Request);
                R2CoreInstanceMobileProcessesManager InstanceMobileProcesses = new R2CoreInstanceMobileProcessesManager();
                List <MobileProcess> _MobileProcesses = new List <MobileProcess>();
                var Lst = InstanceMobileProcesses.GetMobileProcesses(NSSSoftwareuser);
                for (int Loopx = 0; Loopx <= Lst.Count - 1; Loopx++)
                {
                    var Item = new MobileProcess();
                    Item.PId              = Lst[Loopx].PId;
                    Item.PName            = Lst[Loopx].PName;
                    Item.PTitle           = Lst[Loopx].PTitle;
                    Item.TargetMobilePage = Lst[Loopx].TargetMobilePageDelegate;
                    Item.Description      = Lst[Loopx].Description;
                    Item.PForeColor       = Lst[Loopx].PForeColor;
                    Item.PBackColor       = Lst[Loopx].PBackColor;
                    _MobileProcesses.Add(Item);
                }
                HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK);
                response.Content = new StringContent(JsonConvert.SerializeObject(_MobileProcesses), Encoding.UTF8, "application/json");
                return(response);
            }
            catch (SoftwareUserHasNotAnyMobileProcessPermissionException ex)
            { return(WebAPi.CreateSuccessContentMessage(string.Empty)); }
            catch (UserNotExistByMobileNumberException ex)
            { return(WebAPi.CreateSuccessContentMessage(string.Empty)); }
            catch (WebApiClientSoftwareUserAPIKeyExpiredException ex)
            { return(WebAPi.CreateAPIKeyExpirationContentMessage(ex.Message)); }
            catch (Exception ex)
            { return(WebAPi.CreateErrorContentMessage(ex)); }
        }
Exemplo n.º 3
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)); }
        }
        public HttpResponseMessage GetLoadCapacitorLoads()
        {
            ATISMobileWebApi WebAPi = new ATISMobileWebApi();

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

                var   Content    = JsonConvert.DeserializeObject <string>(Request.Content.ReadAsStringAsync().Result);
                var   AHId       = Content.Split(';')[2];
                var   AHSGId     = Content.Split(';')[3];
                var   ProvinceId = Content.Split(';')[4];
                var   ListType   = Content.Split(';')[5];
                var   InstanceLoadCapacitorLoad = new R2CoreTransportationAndLoadNotificationInstanceLoadCapacitorLoadManager();
                Int64 ListTypeConv = Convert.ToInt64(ListType) == (long)LoadCapacitorLoadsListType.NotSedimented ? Convert.ToInt64(AnnouncementHallAnnounceTimeTypes.AllOfLoadsWithoutSedimentedLoads) : Convert.ToInt64(AnnouncementHallAnnounceTimeTypes.SedimentedLoads);
                var   Lst          = InstanceLoadCapacitorLoad.GetLoadCapacitorLoadsfromSubscriptionDB(Convert.ToInt64(AHId), Convert.ToInt64(AHSGId), ListTypeConv, false, true, R2CoreTransportationAndLoadNotificationLoadCapacitorLoadOrderingOptions.TargetProvince, Int64.MinValue, Convert.ToInt64(ProvinceId));
                List <Models.LoadCapacitorLoad> _Loads = new List <Models.LoadCapacitorLoad>();
                for (int Loopx = 0; Loopx <= Lst.Count - 1; Loopx++)
                {
                    var Item = new Models.LoadCapacitorLoad();
                    Item.LoadnEstelamId = "کد مرجع : " + Lst[Loopx].nEstelamId;
                    Item.LoadCapacitorLoadTitleTargetCityTotalAmount = Lst[Loopx].GoodTitle.Trim() + " - " + Lst[Loopx].LoadTargetTitle.Trim() + "   تعداد : " + Lst[Loopx].nCarNum.ToString().Trim();
                    Item.TransportCompanyTarrifPrice = Lst[Loopx].TransportCompanyTitle.Trim() + " تلفن: " + Lst[Loopx].TransportCompanyTel.Trim() + "\n نرخ پایه : " + R2CoreMClassPublicProcedures.R2MakeCamaYourDigit(Convert.ToUInt64(Lst[Loopx].StrPriceSug));
                    Item.Description = Lst[Loopx].StrDescription.Trim() + " " + Lst[Loopx].StrBarName.Trim() + " " + Lst[Loopx].StrAddress.Trim();
                    _Loads.Add(Item);
                }
                HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK);
                response.Content = new StringContent(JsonConvert.SerializeObject(_Loads), Encoding.UTF8, "application/json");
                return(response);
            }
            catch (UserNotExistByMobileNumberException ex)
            { return(WebAPi.CreateSuccessContentMessage(string.Empty)); }
            catch (Exception ex)
            { return(WebAPi.CreateErrorContentMessage(ex)); }
        }