Ejemplo n.º 1
0
        public HttpResponseMessage getAgreementDetailByCustId(int id, String username_ad, String password_ad)
        {
            Authentication_class var_auth = new Authentication_class();
            AuthenticationHeader ah       = var_auth.getAuthHeader(username_ad, password_ad);

            AsmRepository.SetServiceLocationUrl(var_auth.var_service_location_url);
            var agreementManagementService = AsmRepository.GetServiceProxyCachedOrDefault <IAgreementManagementService>(ah);
            AgreementDetailCollection adc  = agreementManagementService.GetAgreementDetailsForCustomer(id, 1);

            if (adc != null)
            {
                return(Request.CreateResponse(HttpStatusCode.OK, adc));
            }
            else
            {
                var       message = string.Format("error");
                HttpError err     = new HttpError(message);
                return(Request.CreateResponse(HttpStatusCode.OK, message));
            }
        }
Ejemplo n.º 2
0
        public void getAgreementDetail()
        {
            Authentication_class var_auth   = new Authentication_class();
            AuthenticationHeader authHeader = var_auth.getAuthentication_header();

            AsmRepository.SetServiceLocationUrl("http://mncsvasm.mskydev1.local/asm/all/servicelocation.svc");

            var m_IAgreementManagementService = AsmRepository.GetServiceProxyCachedOrDefault <IAgreementManagementService>(authHeader);
            var viewService = AsmRepository.GetServiceProxy <IViewFacadeService>(authHeader);


            AgreementDetailCollection adc = m_IAgreementManagementService.GetAgreementDetailsForCustomer(500016733, 1);

            if (adc != null && adc.Items.Count > 0)
            {
                foreach (AgreementDetail a in adc.Items)
                {
                    Console.WriteLine("Found product ID {0}: Status ID = {1}", a.CommercialProductId, a.Status);
                }
            }
            else
            {
                Console.WriteLine("I found nothing.");
            }



            var viewD = viewService.GetCustomerDeviceView(new BaseQueryRequest()
            {
                FilterCriteria = Op.Eq("CustomerId", 500016733),
                PageCriteria   = new PageCriteria()
                {
                    Page     = 0,
                    PageSize = 100
                },
                DeepLoad = true
            });



            foreach (var device in viewD.Items)
            {
                // here you can call GetDeviceView to get more info, parameters are the same like above GetCustomerDeviceView , just change Op.Eq("CustomerId", customer_id) to Op,Eq("Id",device.Id.Value)
                Console.WriteLine("Device ID : " + device.DeviceId.Value + " Serial Number : " + device.SerialNumber
                                  + " Status : " + device.DeviceStatusName + " Model:" + device.ModelDescription);
            }


            var viewAg = viewService.GetAgreementDetailView(new BaseQueryRequest()
            {
                FilterCriteria = Op.Eq("CustomerId", 500016733),
                PageCriteria   = new PageCriteria()
                {
                    Page     = 0,
                    PageSize = 100
                }
            });

            foreach (var product in viewAg.Items)
            {
                Console.WriteLine("Agreement Detail ID : " + product.Id.Value + " Product Name :" + product.CommercialProductName + " Charge Until Date : " + product.ChargeUntilDate + " Charge Period : "
                                  + product.ChargePeriodName + " Finance Option : " + product.FinanceOptionName + " Recurring Price : " + product.RecurringListPrice
                                  + " Status :" + product.StatusName);
            }

            Console.ReadLine();
        }
        public AgreementDetailCollection LinkDeviceThenSipped(String username_ad, String password_ad, int cust_id, String decode_sn, String smartcard_sn, int is_inet, string lnb_sn, string antenna_sn, int shipping_order_id, int is_hd)
        {
            Authentication_class var_auth = new Authentication_class();
            AuthenticationHeader ah       = var_auth.getAuthHeader(username_ad, password_ad);

            AsmRepository.SetServiceLocationUrl(var_auth.var_service_location_url);

            bool is_inet_bool = false;
            bool is_hd_bool   = false;

            string lnb_sn_string;
            string antenna_sn_string;


            if (is_inet == 1)
            {
                is_inet_bool = true;
            }

            else if (is_inet == 0)
            {
                is_inet_bool = false;
            }


            if (is_hd == 1)
            {
                is_hd_bool = true;
            }

            else if (is_hd == 0)
            {
                is_hd_bool = false;
            }



            if (lnb_sn == "0")
            {
                lnb_sn_string = "";
            }
            else
            {
                lnb_sn_string = lnb_sn;
            }

            if (antenna_sn == "0")
            {
                antenna_sn_string = "";
            }
            else
            {
                antenna_sn_string = antenna_sn;
            }

            MayShipSO(username_ad, password_ad, cust_id);

            ShippingOrder var_shipping_order = ShipShippingOrder_ver2(username_ad, password_ad, cust_id, decode_sn, smartcard_sn, is_inet_bool, lnb_sn_string, antenna_sn_string, shipping_order_id, is_hd_bool);

            //return var_shipping_order;

            if (var_shipping_order != null)
            {
                var agreementManagementService = AsmRepository.GetServiceProxyCachedOrDefault <IAgreementManagementService>(ah);
                AgreementDetailCollection adc  = agreementManagementService.GetAgreementDetailsForCustomer(cust_id, 1);
                return(adc);
            }
            else
            {
                return(null);
            }
        }