コード例 #1
0
 private void FillWcDriverTruckInf()
 {
     try
     {
         if (TxtTruckDriverNationalCode.Text == String.Empty)
         {
             return;
         }
         R2StandardDriverTruckStructure NSS = null;
         var InstacneLogin        = new ATISWebMClassLoginManager();
         var InstanceTruckDrivers = new R2CoreTransportationAndLoadNotificationInstanceTruckDriversManager();
         try
         {
             NSS = PayanehClassLibraryMClassDriverTrucksManagement.GetNSSDriverTruckbyNationalCode(TxtTruckDriverNationalCode.Text);
             _WcNSSTruckDriver = InstanceTruckDrivers.GetNSSTruckDriver(Convert.ToInt64(NSS.NSSDriver.nIdPerson));
         }
         catch (DriverTruckInformationNotExistException ex)
         {
             PayanehWebService WS = new PayanehWebService();
             var TruckDriverId    = WS.WebMethodGetDriverTruckByNationalCodefromRMTO(TxtTruckDriverNationalCode.Text, WS.WebMethodLogin(InstacneLogin.GetNSSCurrentUser().UserShenaseh, InstacneLogin.GetNSSCurrentUser().UserPassword));
             _WcNSSTruckDriver = InstanceTruckDrivers.GetNSSTruckDriver(TruckDriverId);
             WS = null;
         }
     }
     catch (Exception ex) when(ex is SqlInjectionException || ex is RMTOWebServiceSmartCardInvalidException || ex is InternetIsnotAvailableException || ex is RMTOWebServiceSmartCardInvalidException)
     {
         throw ex;
     }
     catch (PleaseReloginException ex)
     { Response.Redirect("/LoginManagement/Wflogin.aspx"); }
     catch (Exception ex)
     { throw new Exception(MethodBase.GetCurrentMethod().ReflectedType.FullName + "." + MethodBase.GetCurrentMethod().Name + "." + ex.Message); }
 }
コード例 #2
0
        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)); }
        }