示例#1
0
        public static ESNStatusDoc[] ActivateSubscription(List <ESNInfo> lstESNInfo)
        {
            List <ESNStatusDoc> lstESNDoc = new List <ESNStatusDoc>();

            try
            {
                // wssService.activa
                wssService.wsMessageHeader = getHeader();
                SecurityHelper.prepareSoapContext(wssService.RequestSoapContext);
                ESNStatusDoc doc = null;
                foreach (ESNInfo info in lstESNInfo)
                {
                    try
                    {
                        ActivateSubscriptionRequest request = new ActivateSubscriptionRequest();
                        request.csa                    = info.CSA;
                        request.effectiveDate          = DateTime.Now;
                        request.effectiveDateSpecified = true;
                        ProductDeployment deployment = new ProductDeployment();
                        deployment.serviceCode = "321PLAN2";
                        deployment.serviceEffectiveDateSpecified  = false;
                        deployment.serviceExpirationDateSpecified = false;
                        request.pricePlan = deployment;
                        ElectronicSerialNumber number = new ElectronicSerialNumber();
                        number.Item            = info.ESN;
                        number.ItemElementName = ItemChoiceType.electronicSerialNumberDec;
                        SerialNumber number2 = new SerialNumber();
                        number2.Item = number;
                        request.esn  = number2;
                        List <ProductDeployment> list = new List <ProductDeployment>();

                        var dt = DataLayer_WholesaleSubscriptionDetailService.GetPpSocList(info.CSA);

                        if (info.LocalCallOnly)
                        {
                            var soc = from r in dt.AsEnumerable()
                                      where r.Field <string>("socDescription") == "LOCAL CALLING ONLY"
                                      select r.Field <string>("soc");

                            ProductDeployment item = new ProductDeployment();
                            item.serviceCode                    = soc.FirstOrDefault().ToString();
                            item.serviceEffectiveDate           = DateTime.Now;
                            item.serviceEffectiveDateSpecified  = true;
                            item.serviceExpirationDateSpecified = false;
                            list.Add(item);
                        }
                        if (info.SMSBlock)
                        {
                            var soc = from r in dt.AsEnumerable()
                                      where r.Field <string>("socDescription") == "MO/MT SMS BLOCKING"
                                      select r.Field <string>("soc");

                            ProductDeployment deployment3 = new ProductDeployment();
                            deployment3.serviceCode                    = soc.FirstOrDefault().ToString();
                            deployment3.serviceEffectiveDate           = DateTime.Now;
                            deployment3.serviceEffectiveDateSpecified  = true;
                            deployment3.serviceExpirationDateSpecified = false;
                            list.Add(deployment3);
                        }
                        if (info.VoiceMail)
                        {
                            var soc = from r in dt.AsEnumerable()
                                      where r.Field <string>("socDescription") == "VOICEMAIL"
                                      select r.Field <string>("soc");

                            ProductDeployment deployment4 = new ProductDeployment();
                            deployment4.serviceCode                    = soc.FirstOrDefault().ToString();
                            deployment4.serviceEffectiveDate           = DateTime.Now;
                            deployment4.serviceEffectiveDateSpecified  = true;
                            deployment4.serviceExpirationDateSpecified = false;
                            list.Add(deployment4);
                        }

                        if (list.Count > 0)
                        {
                            request.serviceList = list.ToArray();
                        }
                        ActivateSubscriptionReply reply = wssService.ActivateSubscription(request);

                        info.MDN  = reply.mdn;
                        info.MSID = reply.msid;

                        doc           = new ESNStatusDoc();
                        doc.ESN       = info.ESN;
                        doc.MDN       = info.MDN;
                        doc.MSID      = info.MSID;
                        doc.ESNStatus = ESNSTATUSENUM.SUCCEEDED;
                        doc.Message   = "Activated";
                        lstESNDoc.Add(doc);
                    }
                    catch (System.Web.Services.Protocols.SoapException soapEx)
                    {
                        doc           = new ESNStatusDoc();
                        doc.ESN       = info.ESN;
                        doc.ESNStatus = ESNSTATUSENUM.FAILED;
                        doc.Message   = soapEx.Detail.InnerText;
                        lstESNDoc.Add(doc);
                    }
                }
                return(lstESNDoc.ToArray());
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#2
0
        public static ESNStatusDoc[] ActivateSubscriptionV2(List <ESNInfo> lstESNInfo)
        {
            List <ESNStatusDoc> lstESNDoc = new List <ESNStatusDoc>();

            try
            {
                // wssService.activa
                wssService.wsMessageHeader = getHeader();
                SecurityHelper.prepareSoapContext(wssService.RequestSoapContext);
                ESNStatusDoc doc = null;
                foreach (ESNInfo info in lstESNInfo)
                {
                    try
                    {
                        WholesaleActivateSubscriptionV2Type request = new WholesaleActivateSubscriptionV2Type();
                        request.csa                    = info.CSA;
                        request.effectiveDate          = DateTime.Now;
                        request.effectiveDateSpecified = true;
                        ProductDeploymentType2 deployment = new ProductDeploymentType2();
                        deployment.serviceCode = "321PLAN4";

                        request.pricePlan = deployment;

                        request.deviceInfo = new DeviceInfoType3()
                        {
                            serialNumber        = info.ESN,
                            serialType          = DeviceSerialNumberTypeCodeType3.E,
                            serialTypeSpecified = true
                        };

                        List <ProductDeploymentType2> serviceLIst = new List <ProductDeploymentType2>();
                        var dt = DataLayer_WholesaleSubscriptionDetailService.GetPpSocList(info.CSA);
                        if (info.SMSBlock == true)
                        {
                            var soc = from r in dt.AsEnumerable()
                                      where r.Field <string>("socDescription") == "MO/MT SMS BLOCKING"
                                      select r.Field <string>("soc");

                            ProductDeploymentType2 service = new ProductDeploymentType2
                            {
                                serviceCode = soc.FirstOrDefault().ToString()
                            };
                            serviceLIst.Add(service);
                        }
                        if (info.VoiceMail == true)
                        {
                            var soc = from r in dt.AsEnumerable()
                                      where r.Field <string>("socDescription") == "VOICEMAIL"
                                      select r.Field <string>("soc");

                            ProductDeploymentType2 service = new ProductDeploymentType2
                            {
                                serviceCode = soc.FirstOrDefault().ToString()
                            };
                            serviceLIst.Add(service);
                        }
                        if (info.LocalCallOnly == true)
                        {
                            var soc = from r in dt.AsEnumerable()
                                      where r.Field <string>("socDescription") == "LOCAL CALLING ONLY"
                                      select r.Field <string>("soc");

                            ProductDeploymentType2 service = new ProductDeploymentType2
                            {
                                serviceCode = soc.FirstOrDefault().ToString()
                            };
                            serviceLIst.Add(service);
                        }


                        //data blocking by default
                        ProductDeploymentType2 svc = new ProductDeploymentType2 {
                            serviceCode = "321DISNAI"
                        };
                        serviceLIst.Add(svc);

                        if (serviceLIst.Count > 0)
                        {
                            request.serviceList = serviceLIst.ToArray();
                        }



                        wholesaleActivateSubscriptionV2ResponseType reply = wssService.WholesaleActivateSubscriptionV2(request);

                        info.MDN  = reply.mdn;
                        info.MSID = reply.msid;

                        doc           = new ESNStatusDoc();
                        doc.ESN       = info.ESN;
                        doc.MDN       = info.MDN;
                        doc.MSID      = info.MSID;
                        doc.ESNStatus = ESNSTATUSENUM.SUCCEEDED;
                        doc.Message   = "Activated";
                        lstESNDoc.Add(doc);
                    }
                    catch (System.Web.Services.Protocols.SoapException soapEx)
                    {
                        doc           = new ESNStatusDoc();
                        doc.ESN       = info.ESN;
                        doc.ESNStatus = ESNSTATUSENUM.FAILED;
                        doc.Message   = soapEx.Detail.InnerText;
                        lstESNDoc.Add(doc);
                    }
                }
                return(lstESNDoc.ToArray());
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }