Beispiel #1
0
        public string CreateConsignment(string saediFromId, CreateConsignmentRequest createConsignmentRequest, out int shipmateConsignmentCreationId)
        {
            CreateConsignmentResponse     createConsignmentResponse;
            OnlineBookingLogBLL           onlineBookingLogBLL = new OnlineBookingLogBLL();
            ShipmateConsignmentDetailsBLL shipmateBLL         = new ShipmateConsignmentDetailsBLL();

            shipmateConsignmentCreationId = 0;
            string trackingReference = null;

            try
            {
                createConsignmentRequest.Token = _shipmateConfig.ShipmateToken;
                createConsignmentResponse      = MakeWebRequest <CreateConsignmentResponse>(GetUrl(ShipmateAction.CreateConsignment), createConsignmentRequest.ToJson());

                if (createConsignmentResponse.message == "Consignment Created")
                {
                    onlineBookingLogBLL.InsertOnlineServiceLog(createConsignmentRequest, createConsignmentResponse, saediFromId, GetUrl(ShipmateAction.CreateConsignment), true);
                    DateTime?labelCreated = GetLabelCreated(createConsignmentResponse.data[0].tracking_reference);
                    trackingReference             = createConsignmentResponse.data[0].tracking_reference;
                    shipmateConsignmentCreationId = shipmateBLL.CreateLogEntry(GetShipmateConsignmentDetails(true, null, createConsignmentRequest, createConsignmentResponse, labelCreated), true);
                }
                else
                {
                    onlineBookingLogBLL.InsertOnlineServiceLog(createConsignmentRequest, createConsignmentResponse.message + " " + StringHelper.Dump(createConsignmentResponse), saediFromId, GetUrl(ShipmateAction.CreateConsignment), false);
                    shipmateConsignmentCreationId = shipmateBLL.CreateLogEntry(GetShipmateConsignmentDetails(false, createConsignmentResponse.message, createConsignmentRequest, null, null), false);
                }
            }
            catch (Exception e)
            {
                onlineBookingLogBLL.InsertOnlineServiceLog(createConsignmentRequest, e.Message, saediFromId, GetUrl(ShipmateAction.CreateConsignment), false);
                shipmateBLL.CreateLogEntry(GetShipmateConsignmentDetails(false, e.Message, createConsignmentRequest, null, null), false);
                throw;
            }

            if (createConsignmentResponse.message != "Consignment Created")
            {
                throw new Exception(createConsignmentResponse.message);
            }

            return(trackingReference);
        }
Beispiel #2
0
        public CourierRMABLL()
        {
            _dal         = new CourierRMADataProvider();
            Clientdal    = new ClientDataProvider();
            onlineClient = new IFzOnlineBookingservice();
            //  onlineClient = new CourierRMAService();
            // The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'Basic'.
            //onlineClient.ClientCredentials.UserName.Password = "******";
            //onlineClient.ClientCredentials.UserName.UserName = "******";

            // onlineClient.Credentials = new ClientCredentials(

            //System.Net.CredentialCache sysCredentail = new System.Net.CredentialCache();
            //NetworkCredential netCred = new NetworkCredential("SONY3C", "SONCAIR432");
            //sysCredentail.Add(new Uri(strSysURL), "Basic", netCred);
            //onlineClient.Credentials = sysCredentail;
            //  ascService = new IFzOnlineBooking();
            //ascService.ClientCredentials
            onlineBookingLogBLL = new OnlineBookingLogBLL();
            //header = new AuthHeader();
            Saediclient = new Client();
        }