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)); } }
public HttpResponseMessage GetProvinces() { ATISMobileWebApi WebAPi = new ATISMobileWebApi(); try { //تایید اعتبار کلاینت WebAPi.AuthenticateClientApikeyNonceWith3Parameter(Request, ATISMobileWebApiLogTypes.WebApiClientProvincesRequest); var NSSSoftwareuser = WebAPi.GetNSSSoftwareUser(Request); var Content = JsonConvert.DeserializeObject <string>(Request.Content.ReadAsStringAsync().Result); var AHId = Content.Split(';')[2]; var AHSGId = Content.Split(';')[3]; var LoadCapacitorLoadsListType = Content.Split(';')[4]; List <Models.Province> _Provinces = new List <Models.Province>(); var InstanceLoadCapacitorLoad = new R2CoreTransportationAndLoadNotificationInstanceLoadCapacitorLoadManager(); var Lst = InstanceLoadCapacitorLoad.GetProvincesWithNumberOfLoads(Convert.ToInt64(AHId), Convert.ToInt64(AHSGId), Convert.ToInt64(LoadCapacitorLoadsListType)); for (int Loopx = 0; Loopx <= Lst.Count - 1; Loopx++) { var Item = new Models.Province(); Item.ProvinceId = "کداستان: " + Lst[Loopx].Province.ProvinceId.ToString(); Item.ProvinceTitle = Lst[Loopx].Province.ProvinceTitle + " : تعداد بار " + Lst[Loopx].NumberOfLoads.ToString(); _Provinces.Add(Item); } HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK); response.Content = new StringContent(JsonConvert.SerializeObject(_Provinces), Encoding.UTF8, "application/json"); return(response); } catch (LoadTargetsforProvinceNotFoundException ex) { return(WebAPi.CreateErrorContentMessage(ex)); } catch (Exception ex) { return(WebAPi.CreateErrorContentMessage(ex)); } }
public HttpResponseMessage HaveNewerVersion() { ATISMobileWebApi WebAPi = new ATISMobileWebApi(); try { //تایید اعتبار کلاینت WebAPi.AuthenticateClient(Request, ATISMobileWebApiLogTypes.WebApiClientVersionControlRequest); string WebApiVersionNumber = File.ReadAllText(HttpContext.Current.Server.MapPath("~/App_Data/NewerVersionInfo.txt"), Encoding.UTF8).Split(';')[0].Split(':')[1].Trim(); string WebApiVersionName = File.ReadAllText(HttpContext.Current.Server.MapPath("~/App_Data/NewerVersionInfo.txt"), Encoding.UTF8).Split(';')[1].Split(':')[1].Trim(); Request.Headers.TryGetValues("VersionNumber", out IEnumerable <string> VersionNumber); Request.Headers.TryGetValues("VersionName", out IEnumerable <string> VersionName); HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK); if (VersionNumber.FirstOrDefault().Trim() != WebApiVersionNumber || VersionName.FirstOrDefault().Trim() != WebApiVersionName) { response.Content = new StringContent(JsonConvert.SerializeObject(Boolean.TrueString), Encoding.UTF8, "application/json"); } else { response.Content = new StringContent(JsonConvert.SerializeObject(Boolean.FalseString), Encoding.UTF8, "application/json"); } return(response); } catch (Exception ex) { return(WebAPi.CreateErrorContentMessage(ex)); } }
public HttpResponseMessage LoginSoftwareUser() { ATISMobileWebApi WebAPi = new ATISMobileWebApi(); try { //تایید اعتبار کلاینت WebAPi.AuthenticateClientVerificationCode(Request); var InstanceAES = new AESAlgorithmsManager(); var InstanceConfiguration = new R2CoreInstanceConfigurationManager(); var InstanceSoftwareusers = new R2CoreInstanseSoftwareUsersManager(); var InstanceSoftwareUser = new R2CoreInstanseSoftwareUsersManager(); var Content = JsonConvert.DeserializeObject<string>(Request.Content.ReadAsStringAsync().Result); var MobileNumber = Content.Split(';')[0]; var NSSSoftwareuser = InstanceSoftwareUser.GetNSSUser(new R2CoreSoftwareUserMobile(MobileNumber)); InstanceSoftwareusers.LoginSoftwareUser(NSSSoftwareuser.MobileNumber); HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK); var AMUStatus = InstanceAES.Encrypt(NSSSoftwareuser.MobileNumber, InstanceConfiguration.GetConfigString(R2CoreConfigurations.PublicSecurityConfiguration, 3)) + ";" + InstanceAES.Encrypt(NSSSoftwareuser.ApiKey, InstanceConfiguration.GetConfigString(R2CoreConfigurations.PublicSecurityConfiguration, 3)); response.Content = new StringContent(JsonConvert.SerializeObject(AMUStatus), Encoding.UTF8, "application/json"); return response; } catch (SoftwareUserNotMatchException ex) { return WebAPi.CreateErrorContentMessage(ex); } catch (Exception ex) { return WebAPi.CreateErrorContentMessage(ex); } }
public HttpResponseMessage GetPublicMessage() { ATISMobileWebApi WebAPi = new ATISMobileWebApi(); try { //تایید اعتبار کلاینت WebAPi.AuthenticateClient(Request, ATISMobileWebApiLogTypes.WebApiClientPublicMessageRequest); string[] AllConfig = R2CoreMClassConfigurationManagement.GetConfigString(R2CoreConfigurations.PublicMessagesforSoftWareUsers).Split(';'); string Message = R2CoreMClassConfigurationManagement.GetConfigString(R2CoreConfigurations.PublicMessagesforSoftWareUsers, 1); string ExpirationDate = R2CoreMClassConfigurationManagement.GetConfigString(R2CoreConfigurations.PublicMessagesforSoftWareUsers, 0); HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK); if (R2CoreMclassDateAndTimeManagement.GetPersianDaysDiffDate(_DateTime.GetCurrentDateShamsiFull(), ExpirationDate) >= 0) { response.Content = new StringContent(JsonConvert.SerializeObject(Message), Encoding.UTF8, "application/json"); } else { response.Content = new StringContent(JsonConvert.SerializeObject(string.Empty), Encoding.UTF8, "application/json"); } return(response); } catch (Exception ex) { return(WebAPi.CreateErrorContentMessage(ex)); } }
public HttpResponseMessage RegisterMobileNumber() { ATISMobileWebApi WebAPi = new ATISMobileWebApi(); try { //تایید اعتبار کلاینت WebAPi.AuthenticateClientRegisteringMobileNumber(Request); var InstanceSoftwareusers = new R2CoreInstanseSoftwareUsersManager(); var InstanceConfiguration = new R2CoreInstanceConfigurationManager(); var MobileNumber = JsonConvert.DeserializeObject<string>(Request.Content.ReadAsStringAsync().Result); var NSSSoftwareUser = InstanceSoftwareusers.RegisteringMobileNumber(MobileNumber); //کسر هزینه فعال سازی - از بابت اس ام اس var InstanceTerraficCards = new R2CoreTransportationAndLoadNotificationInstanceTerraficCardsManager(); var InstanceMoneyWallets = new R2CoreParkingSystemInstanceMoneyWalletManager(); var NSSTrafficCard = InstanceTerraficCards.GetNSSTerafficCard(NSSSoftwareUser); if (InstanceConfiguration.GetConfigBoolean(R2CoreConfigurations.DefaultConfigurationOfSoftwareUserSecurity, 10)) { if (!NSSTrafficCard.NoMoney) { InstanceMoneyWallets.ActMoneyWalletNextStatus(NSSTrafficCard, BagPayType.MinusMoney, InstanceConfiguration.GetConfigInt64(R2CoreConfigurations.DefaultConfigurationOfSoftwareUserSecurity, 11), R2CoreParkingSystemAccountings.RegisteringSoftwareUserSMSCost, InstanceSoftwareusers.GetNSSSystemUser()); } } HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK); response.Content = new StringContent(JsonConvert.SerializeObject(string.Empty), Encoding.UTF8, "application/json"); return response; } catch (SoftwareUserMoneyWalletNotFoundException ex) { return WebAPi.CreateErrorContentMessage(ex); } catch (MobileNumberIsInvalidException ex) { return WebAPi.CreateErrorContentMessage((new R2CoreMClassPredefinedMessagesManager()).GetNSS(R2CorePredefinedMessages.MobileNumberIsInvalid).MsgContent); } catch (MobileNumberNotFoundException ex) { return WebAPi.CreateErrorContentMessage((new R2CoreMClassPredefinedMessagesManager()).GetNSS(R2CorePredefinedMessages.MobileNumberNotFoundException).MsgContent); } catch (Exception ex) { return WebAPi.CreateErrorContentMessage(ex); } }
public HttpResponseMessage SendTruckChangeRequestMessage() { ATISMobileWebApi WebAPi = new ATISMobileWebApi(); try { //تایید اعتبار کلاینت WebAPi.AuthenticateClientApikeyNoncePersonalNonceWith3Parameter(Request, ATISMobileWebApiLogTypes.WebApiClientSendTruckChangeMessageRequest); 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 LPPelak = Content.Split(';')[2]; var LPSerial = Content.Split(';')[3]; var NewTruckLicensePlate = Content.Split(';')[4]; var InstanceCarTrucks = new PayanehClassLibraryMClassCarTrucksManager(); var InstanceTrucks = new R2CoreTransportationAndLoadNotificationInstanceTrucksManager(); InstanceCarTrucks.SendTruckChangeRequestMessage(InstanceTrucks.GetNSSTruckWithLicensePlate(new R2CoreTransportationAndLoadNotificationStandardTruckStructure(new R2StandardCarStructure(null, null, LPPelak, LPSerial, null), null)), NewTruckLicensePlate, 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)); } }
public HttpResponseMessage GetMoneyWalletReminderCharge() { ATISMobileWebApi WebAPi = new ATISMobileWebApi(); try { //تایید اعتبار کلاینت WebAPi.AuthenticateClientApikeyNonce(Request, ATISMobileWebApiLogTypes.WebApiClientMoneyWalletIDandReminderChargeRequest); var NSSSoftwareuser = WebAPi.GetNSSSoftwareUser(Request); var InstanceTerraficCards = new R2CoreTransportationAndLoadNotificationInstanceTerraficCardsManager(); var InstanceMoneyWallets = new R2CoreParkingSystemInstanceMoneyWalletManager(); var NSSTrafficCard = InstanceTerraficCards.GetNSSTerafficCard(NSSSoftwareuser); Int64 ReminderCharge = InstanceMoneyWallets.GetMoneyWalletCharge(NSSTrafficCard); HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK); response.Content = new StringContent(JsonConvert.SerializeObject(new MessageStruct { ErrorCode = false, Message1 = ReminderCharge.ToString(), Message2 = string.Empty, Message3 = string.Empty }), Encoding.UTF8, "application/json"); return(response); } catch (UserNotExistByApiKeyException ex) { return(WebAPi.CreateErrorContentMessage(ex)); } catch (Exception ex) { return(WebAPi.CreateErrorContentMessage(ex)); } }
public HttpResponseMessage RealTimeTurnRegisterRequest() { ATISMobileWebApi WebAPi = new ATISMobileWebApi(); try { //تایید اعتبار کلاینت WebAPi.AuthenticateClientApikeyNoncePersonalNonceWith2Parameter(Request, ATISMobileWebApiLogTypes.WebApiClientRealTimeTurnRegisterRequest); 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 LPPelak = Content.Split(';')[2]; var LPSerial = Content.Split(';')[3]; var InstanceTurnRegisterRequest = new PayanehClassLibraryMClassTurnRegisterRequestManager(); InstanceTurnRegisterRequest.RealTimeTurnRegisterRequestWithLicensePlate(LPPelak, LPSerial, NSSSoftwareuser, R2CoreTransportationAndLoadNotificationRequesters.ATISRestfullTurnControllerRealTimeTurnRegisterRequest, TurnType.Permanent); 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)); } }
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)); } }
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 ConfirmAMUStatus() { ATISMobileWebApi WebAPi = new ATISMobileWebApi(); try { //تایید اعتبار کلاینت WebAPi.AuthenticateClient(Request, ATISMobileWebApiLogTypes.WebApiClientConfirmAMUStatusRequest); string AMUStatus = JsonConvert.DeserializeObject <string>(Request.Content.ReadAsStringAsync().Result); bool Confirmed = false; if (String.IsNullOrEmpty(AMUStatus)) { Confirmed = false; } else { if (AMUStatus.Split(';').Length != 2) { Confirmed = false; } else { Confirmed = true; } } HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK); response.Content = new StringContent(JsonConvert.SerializeObject(Confirmed), Encoding.UTF8, "application/json"); return(response); } catch (Exception ex) { return(WebAPi.CreateErrorContentMessage(ex)); } }
public HttpResponseMessage GetPersonalNonce() { ATISMobileWebApi WebAPi = new ATISMobileWebApi(); try { //تایید اعتبار کلاینت WebAPi.AuthenticateClientGetPersonalNonce(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 NSSSoftwareuser = WebAPi.GetNSSSoftwareUser(Request); var PersonalNonce = InstanceSoftwareusers.GetPersonalNonceforSoftwareUser(NSSSoftwareuser); InvalidateCaptcha(Request); HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK); response.Content = new StringContent(JsonConvert.SerializeObject(PersonalNonce), Encoding.UTF8, "application/json"); return response; } catch (Exception ex) { InvalidateCaptcha(Request); return WebAPi.CreateErrorContentMessage(ex); } }
public HttpResponseMessage ClearanceLoadsReport() { ATISMobileWebApi WebAPi = new ATISMobileWebApi(); try { //تایید اعتبار کلاینت WebAPi.AuthenticateClientApikeyNonceWith1Parameter(Request, ATISMobileWebApiLogTypes.WebApiClientRequestAnnouncedLoadsReportClearanceLoadsReport); var NSSSoftwareuser = WebAPi.GetNSSSoftwareUser(Request); var Content = JsonConvert.DeserializeObject <string>(Request.Content.ReadAsStringAsync().Result); var AHSGId = Convert.ToInt64(Content.Split(';')[2]); var InstanceLoadCapacitorLoad = new R2CoreTransportationAndLoadNotificationInstanceLoadCapacitorLoadManager(); List <KeyValuePair <string, string> > Lst = InstanceLoadCapacitorLoad.ReportingInformationProviderClearanceLoadsReport(AHSGId, NSSSoftwareuser); List <Models.AnnouncedLoadsReportClearanceLoadsReport> _AnnouncedLoadsReportClearanceLoadsReport = new List <Models.AnnouncedLoadsReportClearanceLoadsReport>(); for (int Loopx = 0; Loopx <= Lst.Count - 1; Loopx++) { var Item = new Models.AnnouncedLoadsReportClearanceLoadsReport(); Item.ReportItemHeader = Lst[Loopx].Key; Item.ReportItemDetails = Lst[Loopx].Value; _AnnouncedLoadsReportClearanceLoadsReport.Add(Item); } HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK); response.Content = new StringContent(JsonConvert.SerializeObject(_AnnouncedLoadsReportClearanceLoadsReport), Encoding.UTF8, "application/json"); return(response); } catch (Exception ex) { return(WebAPi.CreateErrorContentMessage(ex)); } }
public HttpResponseMessage TruckDriverInqueryWithLicensePlate() { ATISMobileWebApi WebAPi = new ATISMobileWebApi(); try { //تایید اعتبار کلاینت WebAPi.AuthenticateClientApikeyNoncePersonalNonceWith2Parameter(Request, ATISMobileWebApiLogTypes.WebApiClientTruckDriverInqueryWithLicensePlate); 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 LPPelak = Content.Split(';')[2]; var LPSerial = Content.Split(';')[3]; var InstanceTruckDrivers = new R2CoreTransportationAndLoadNotificationInstanceTruckDriversManager(); HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK); response.Content = new StringContent(JsonConvert.SerializeObject(InstanceTruckDrivers.GetNSSTruckDriverWithLicensePlate(new R2CoreTransportationAndLoadNotificationStandardTruckStructure(new R2StandardCarStructure(null, null, LPPelak, LPSerial, null), null)).NSSDriver.StrPersonFullName), 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 GetTruckDriver() { ATISMobileWebApi WebAPi = new ATISMobileWebApi(); try { //تایید اعتبار کلاینت WebAPi.AuthenticateClientApikeyNonce(Request, ATISMobileWebApiLogTypes.WebApiClientTruckDriverRequest); var NSSSoftwareuser = WebAPi.GetNSSSoftwareUser(Request); var InstanseTruckDrivers = new R2CoreTransportationAndLoadNotificationInstanceTruckDriversManager(); var TruckDriver = InstanseTruckDrivers.GetNSSTruckDriver(NSSSoftwareuser); var Item = new Models.TruckDriver(); Item.NameFamily = TruckDriver.NSSDriver.StrPersonFullName; Item.FatherName = "فرزند: " + TruckDriver.NSSDriver.StrFatherName; Item.SmartCardNo = "شماره هوشمند: " + TruckDriver.StrSmartCardNo; Item.NationalCode = "کد ملی: " + TruckDriver.NSSDriver.StrNationalCode; Item.Tel = "تلفن: " + TruckDriver.NSSDriver.StrIdNo; Item.DrivingLicenceNo = "گواهینامه: " + TruckDriver.NSSDriver.strDrivingLicenceNo; Item.Address = "آدرس: " + TruckDriver.NSSDriver.StrAddress; Item.DriverId = "کد راننده: " + TruckDriver.NSSDriver.nIdPerson; HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK); response.Content = new StringContent(JsonConvert.SerializeObject(Item), Encoding.UTF8, "application/json"); return(response); } catch (TruckDriverNotFoundException ex) { return(WebAPi.CreateErrorContentMessage(ex)); } catch (UserNotExistByMobileNumberException 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)); } }
public HttpResponseMessage GetLoadPermissionsViaLicensePlate() { ATISMobileWebApi WebAPi = new ATISMobileWebApi(); try { //تایید اعتبار کلاینت WebAPi.AuthenticateClientApikeyNonceWith2Parameter(Request, ATISMobileWebApiLogTypes.WebApiClientGetLoadPermissionsViaLicensePlate); 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 LPPelak = Content.Split(';')[2]; var LPSerial = Content.Split(';')[3]; var InstanceLoadAllocation = new R2CoreTransportationAndLoadNotificationInstanceLoadAllocationManager(); List <Models.LoadAllocationsforTruckDriver> _LoadAllocations = new List <Models.LoadAllocationsforTruckDriver>(); var Lst = InstanceLoadAllocation.GetLoadPermissionsViaLicensePlate(LPPelak, LPSerial); StringBuilder SB = new StringBuilder(); for (int Loopx = 0; Loopx <= Lst.Count - 1; Loopx++) { var Item = new Models.LoadAllocationsforTruckDriver(); SB.Clear(); SB.Append("شرکت حمل و نقل: " + Lst[Loopx].TransportCompanyTitle.Trim() + " " + Lst[Loopx].TransportCompanyTel.Trim() + "\r\n"); SB.Append("کد مرجع: " + Lst[Loopx].LoadCapacitorLoadnEstelamId + "\r\n"); SB.Append(Lst[Loopx].LoadCapacitorLoadGoodTitle.Trim() + " " + Lst[Loopx].LoadCapacitorLoadTargetTitle.Trim() + " تعدادبار: " + Lst[Loopx].LoadCapacitorLoadnCarNumKol.Trim() + "\r\n"); SB.Append("تعرفه: " + Lst[Loopx].LoadCapacitorLoadStrPriceSug.Trim() + "\r\n"); SB.Append("توضیحات بار: " + Lst[Loopx].LoadCapacitorLoadStrDescription.Trim() + " " + Lst[Loopx].LoadCapacitorLoadStrBarName.Trim() + " " + Lst[Loopx].LoadCapacitorLoadStrAddress.Trim() + "\r\n"); SB.Append("وضعیت تخصیص بار: " + Lst[Loopx].LoadAllocationStatusTitle.Trim() + "\r\n"); SB.Append("تاریخ تخصیص بار: " + Lst[Loopx].LoadPermissionDate + " - " + Lst[Loopx].LoadPermissionTime + "\r\n"); SB.Append("توضیحات تخصیص: " + Lst[Loopx].LoadAllocationNote.Trim() + "\r\n"); SB.Append("طول سفر: " + Lst[Loopx].LoadCapacitorLoadTargetTravelength.Trim() + "\r\n"); Item.Description = SB.ToString(); Item.DescriptionColor = Lst[Loopx].LoadAllocationStatusColor; Item.LoadAllocationId = "شماره تخصیص:" + Lst[Loopx].LoadAllocationId + " - " + "اولویت:" + Lst[Loopx].LoadAllocationPriority; _LoadAllocations.Add(Item); } HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.OK); response.Content = new StringContent(JsonConvert.SerializeObject(_LoadAllocations), Encoding.UTF8, "application/json"); return(response); } catch (UserNotExistByApiKeyException ex) { return(WebAPi.CreateErrorContentMessage(ex)); } catch (LoadAllocationNotFoundException ex) { return(WebAPi.CreateErrorContentMessage(ex)); } catch (Exception ex) { return(WebAPi.CreateErrorContentMessage(ex)); } }
public HttpResponseMessage ISWebApiLive() { ATISMobileWebApi WebAPi = new ATISMobileWebApi(); try { //تایید اعتبار کلاینت WebAPi.AuthenticateClient(Request, ATISMobileWebApiLogTypes.WebApiClientIsWebAPIAliveRequest); HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK); response.Content = new StringContent(JsonConvert.SerializeObject("ATISMobileWebAPiIsLive"), Encoding.UTF8, "application/json"); return(response); } catch (Exception ex) { return(WebAPi.CreateErrorContentMessage(ex)); } }
public HttpResponseMessage PaymentRequest() { ATISMobileWebApi WebAPi = new ATISMobileWebApi(); try { //تایید اعتبار کلاینت WebAPi.AuthenticateClientApikeyNoncePersonalNonceWith1Parameter(Request, ATISMobileWebApiLogTypes.WebApiClientMoneyWalletPaymentRequest); 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 NSSSoftwareuser = InstanceSoftwareusers.GetNSSUser(new R2CoreSoftwareUserMobile(MobileNumber)); var Amount = Convert.ToInt32(Content.Split(';')[2]) * 10; if (Amount > 1000000) { throw new ChargingAmountInvalidException(); } var WS = new R2Core.R2PrimaryWS.R2PrimaryWebService(); var PayId = WS.WebMethodPaymentRequest(R2CoreMonetaryCreditSupplySources.ZarrinPalPaymentGate, Amount, NSSSoftwareuser.UserId, WS.WebMethodLogin(R2CoreMClassSoftwareUsersManagement.GetNSSSystemUser().UserShenaseh, R2CoreMClassSoftwareUsersManagement.GetNSSSystemUser().UserPassword)); var InstancePaymentRequests = new R2CoreInstansePaymentRequestsManager(); var NSSPaymentRequest = InstancePaymentRequests.GetNSSPayment(PayId); while ((NSSPaymentRequest.Authority == string.Empty) & (NSSPaymentRequest.PaymentErrors == string.Empty)) { System.Threading.Thread.Sleep(500); NSSPaymentRequest = InstancePaymentRequests.GetNSSPayment(PayId); } if (NSSPaymentRequest.Authority != string.Empty) { HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK); response.Content = new StringContent(JsonConvert.SerializeObject(new MessageStruct { ErrorCode = false, Message1 = NSSPaymentRequest.Authority, Message2 = InstanceConfiguration.GetConfigString(R2CoreConfigurations.ZarrinPalPaymentGate, 2), Message3 = string.Empty }), Encoding.UTF8, "application/json"); return(response); } else { throw new Exception(NSSPaymentRequest.PaymentErrors); } } catch (UserNotExistByApiKeyException ex) { return(WebAPi.CreateErrorContentMessage(ex)); } catch (Exception ex) { return(WebAPi.CreateErrorContentMessage(ex)); } }
public HttpResponseMessage LoadAllocationCancelling() { ATISMobileWebApi WebAPi = new ATISMobileWebApi(); try { //تایید اعتبار کلاینت WebAPi.AuthenticateClientApikeyNoncePersonalNonceWith1Parameter(Request, ATISMobileWebApiLogTypes.WebApiClientLoadAllocationCancellingRequest); 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 NSSSoftwareuser = InstanceSoftwareusers.GetNSSUser(new R2CoreSoftwareUserMobile(MobileNumber)); var LoadAllocationId = Convert.ToInt64(Content.Split(';')[2]); AuthorizationLoadAllocationIdWithSoftwareUser(NSSSoftwareuser, LoadAllocationId); var InstanceLoadAllocation = new R2CoreTransportationAndLoadNotificationInstanceLoadAllocationManager(); InstanceLoadAllocation.LoadAllocationCancelling(LoadAllocationId, R2CoreTransportationAndLoadNotificationLoadAllocationStatuses.CancelledUser, NSSSoftwareuser); HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK); return(response); } catch (TimingNotReachedException ex) { return(WebAPi.CreateErrorContentMessage(ex)); } catch (TurnHandlingNotAllowedBecuaseTurnStatusException ex) { return(WebAPi.CreateErrorContentMessage(ex)); } catch (LoadAllocationCancellingNotAllowedBecauseLoadAllocationStatusException ex) { return(WebAPi.CreateErrorContentMessage(ex)); } catch (LoadAllocationCancellingNotAllowedBecauseTurnStatusException ex) { return(WebAPi.CreateErrorContentMessage(ex)); } catch (UserNotExistByApiKeyException ex) { return(WebAPi.CreateErrorContentMessage(ex)); } catch (UserLast5DigitNotMatchingException ex) { return(WebAPi.CreateErrorContentMessage(ex)); } catch (UserIdNotExistException ex) { return(WebAPi.CreateErrorContentMessage(ex)); } catch (LoadAllocationNotFoundException ex) { return(WebAPi.CreateErrorContentMessage(ex)); } catch (LoadCapacitorLoadNotFoundException ex) { return(WebAPi.CreateErrorContentMessage(ex)); } catch (TurnNotFoundException ex) { return(WebAPi.CreateErrorContentMessage(ex)); } catch (Exception ex) { return(WebAPi.CreateErrorContentMessage(ex)); } }
public HttpResponseMessage LogoutSoftwareUser() { ATISMobileWebApi WebAPi = new ATISMobileWebApi(); try { //تایید اعتبار کلاینت WebAPi.AuthenticateClientApikeyNonce(Request, ATISMobileWebApiLogTypes.WebApiClientLogoutSoftwareUserRequest); var NSSSoftwareUser = WebAPi.GetNSSSoftwareUser(Request); var InstanceSoftwareUser = new R2CoreInstanseSoftwareUsersManager(); InstanceSoftwareUser.LogoutSoftwareUser(NSSSoftwareUser.UserId); HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK); return response; } catch (UserNotExistByMobileNumberException ex) { return WebAPi.CreateErrorContentMessage(ex); } catch (Exception ex) { return WebAPi.CreateErrorContentMessage(ex); } }
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 GetLoadAllocationsforTruckDriver() { ATISMobileWebApi WebAPi = new ATISMobileWebApi(); try { //تایید اعتبار کلاینت WebAPi.AuthenticateClientApikeyNonce(Request, ATISMobileWebApiLogTypes.WebApiClientLoadAllocationsRequest); var NSSSoftwareuser = WebAPi.GetNSSSoftwareUser(Request); var InstanceLoadAllocation = new R2CoreTransportationAndLoadNotificationInstanceLoadAllocationManager(); List <Models.LoadAllocationsforTruckDriver> _LoadAllocations = new List <Models.LoadAllocationsforTruckDriver>(); var Lst = InstanceLoadAllocation.GetLoadAllocationsforTruckDriver(NSSSoftwareuser.UserId); StringBuilder SB = new StringBuilder(); for (int Loopx = 0; Loopx <= Lst.Count - 1; Loopx++) { var Item = new Models.LoadAllocationsforTruckDriver(); SB.Clear(); SB.Append("شرکت حمل و نقل: " + Lst[Loopx].TransportCompanyTitle.Trim() + " " + Lst[Loopx].TransportCompanyTel.Trim() + "\r\n"); SB.Append("کد مرجع: " + Lst[Loopx].LoadCapacitorLoadnEstelamId + "\r\n"); SB.Append(Lst[Loopx].LoadCapacitorLoadGoodTitle.Trim() + " " + Lst[Loopx].LoadCapacitorLoadTargetTitle.Trim() + " تعدادبار: " + Lst[Loopx].LoadCapacitorLoadnCarNumKol.Trim() + "\r\n"); SB.Append("تعرفه: " + Lst[Loopx].LoadCapacitorLoadStrPriceSug.Trim() + "\r\n"); SB.Append("توضیحات بار: " + Lst[Loopx].LoadCapacitorLoadStrDescription.Trim() + " " + Lst[Loopx].LoadCapacitorLoadStrBarName.Trim() + " " + Lst[Loopx].LoadCapacitorLoadStrAddress.Trim() + "\r\n"); SB.Append("وضعیت تخصیص بار: " + Lst[Loopx].LoadAllocationStatusTitle.Trim() + "\r\n"); SB.Append("توضیحات تخصیص: " + Lst[Loopx].LoadAllocationNote.Trim() + "\r\n"); SB.Append("طول سفر: " + Lst[Loopx].LoadCapacitorLoadTargetTravelength.Trim() + "\r\n"); Item.Description = SB.ToString(); Item.DescriptionColor = Lst[Loopx].LoadAllocationStatusColor; Item.LoadAllocationId = "شماره تخصیص:" + Lst[Loopx].LoadAllocationId + " - " + "اولویت:" + Lst[Loopx].LoadAllocationPriority; _LoadAllocations.Add(Item); } HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.OK); response.Content = new StringContent(JsonConvert.SerializeObject(_LoadAllocations), Encoding.UTF8, "application/json"); return(response); } catch (UserNotExistByApiKeyException ex) { return(WebAPi.CreateErrorContentMessage(ex)); } catch (LoadAllocationNotFoundException ex) { return(WebAPi.CreateErrorContentMessage(ex)); } catch (Exception ex) { return(WebAPi.CreateErrorContentMessage(ex)); } }
public HttpResponseMessage GetCaptcha() { ATISMobileWebApi WebAPi = new ATISMobileWebApi(); try { //تایید اعتبار کلاینت WebAPi.AuthenticateClientGetCaptcha(Request); var NSSSoftwareuser = WebAPi.GetNSSSoftwareUser(Request); var InstanceSoftwareusers = new R2CoreInstanseSoftwareUsersManager(); var InstanceCaptcha = new R2CoreInstanceCaptchaManager(); var CaptchaImage = InstanceCaptcha.GenerateCaptcha(InstanceSoftwareusers.GetCaptchaNumericforSoftwareUser(NSSSoftwareuser)); ImageRawData IImage = new ImageRawData(); IImage.IRawData = (new JsonImage(CaptchaImage)).GetRawData(); HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK); response.Content = new StringContent(JsonConvert.SerializeObject(IImage), Encoding.UTF8, "application/json"); return response; } catch (Exception ex) { return WebAPi.CreateErrorContentMessage(ex); } }
public HttpResponseMessage ExistPermission() { ATISMobileWebApi WebAPi = new ATISMobileWebApi(); try { //تایید اعتبار کلاینت WebAPi.AuthenticateClientApikeyNonceWith1Parameter(Request, ATISMobileWebApiLogTypes.WebApiClientExistPermissionRequest); var Content = JsonConvert.DeserializeObject <string>(Request.Content.ReadAsStringAsync().Result); var TargetMobileProcessId = Content.Split(';')[2]; var InstansePermissions = new R2CoreInstansePermissionsManager(); bool P = InstansePermissions.ExistPermission(R2CorePermissionTypes.SoftwareUsersAccessMobileProcesses, WebAPi.GetNSSSoftwareUser(Request).UserId, Convert.ToInt64(TargetMobileProcessId)); HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK); response.Content = new StringContent(JsonConvert.SerializeObject(P), Encoding.UTF8, "application/json"); return(response); } catch (Exception ex) { return(WebAPi.CreateErrorContentMessage(ex)); } }
public HttpResponseMessage GetMoneyWalletAccounting() { ATISMobileWebApi WebAPi = new ATISMobileWebApi(); try { //تایید اعتبار کلاینت WebAPi.AuthenticateClientApikeyNonce(Request, ATISMobileWebApiLogTypes.WebApiClientMoneyWalletAccountingRequest); var InstanceTerraficCards = new R2CoreTransportationAndLoadNotificationInstanceTerraficCardsManager(); var NSSSoftwareUser = WebAPi.GetNSSSoftwareUser(Request); var InstanceAccounting = new R2CoreParkingSystemInstanceAccountingManager(); var InstancePublicProcedures = new R2CoreInstancePublicProceduresManager(); var NSSTrafficCard = InstanceTerraficCards.GetNSSTerafficCard(NSSSoftwareUser); List <Models.MoneyWalletAccounting> _MoneyWalletAccountings = new List <Models.MoneyWalletAccounting>(); var Lst = InstanceAccounting.GetAccountingCollection(NSSTrafficCard, 50); for (int Loopx = 0; Loopx <= Lst.Count - 1; Loopx++) { var Item = new Models.MoneyWalletAccounting(); Item.AccountName = Lst[Loopx].AccountName; Item.AccountDateTime = Lst[Loopx].DateShamsiA + "\n" + Lst[Loopx].TimeA; Item.CurrentCharge = InstancePublicProcedures.ParseSignDigitToSignString(Lst[Loopx].CurrentChargeA); Item.Mblgh = InstancePublicProcedures.ParseSignDigitToSignString(Lst[Loopx].MblghA); Item.ReminderCharge = InstancePublicProcedures.ParseSignDigitToSignString(Lst[Loopx].ReminderChargeA); Item.ComputerName = Lst[Loopx].ComputerName; Item.UserName = Lst[Loopx].UserName; Item.BackGroundColorName = Lst[Loopx].ColorName; Item.ForeGroundColorName = InstancePublicProcedures.IdealBlackWhiteTextColor(Color.FromName(Lst[Loopx].ColorName)).Name; _MoneyWalletAccountings.Add(Item); } HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK); response.Content = new StringContent(JsonConvert.SerializeObject(_MoneyWalletAccountings), Encoding.UTF8, "application/json"); return(response); } catch (UserNotExistByApiKeyException ex) { return(WebAPi.CreateErrorContentMessage(ex)); } catch (Exception ex) { return(WebAPi.CreateErrorContentMessage(ex)); } }
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)); } }
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)); } }
public HttpResponseMessage GetAnnouncementHallsAnnouncementhAllSubGroupsJOINT() { ATISMobileWebApi WebAPi = new ATISMobileWebApi(); try { //تایید اعتبار کلاینت WebAPi.AuthenticateClientApikeyNonce(Request, ATISMobileWebApiLogTypes.WebApiClientAnnouncementHallSubGroupsRequest); var InstanceAnnouncementHalls = new R2CoreTransportationAndLoadNotificationInstanceAnnouncementHallsManager(); var Lst = InstanceAnnouncementHalls.GetAnnouncementHallsAnnouncementHallSubGroupsJOINT(); var LstPair = new List <KeyValuePair <string, string> >(); for (int Loopx = 0; Loopx <= Lst.Count - 1; Loopx++) { LstPair.Add(new KeyValuePair <string, string>(Lst[Loopx].NSSAnnouncementHallSubGroup.AHSGId.ToString(), Lst[Loopx].NSSAnnouncementHallSubGroup.AHSGTitle)); } HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK); response.Content = new StringContent(JsonConvert.SerializeObject(LstPair), Encoding.UTF8, "application/json"); return(response); } catch (Exception ex) { return(WebAPi.CreateErrorContentMessage(ex)); } }