public async System.Threading.Tasks.Task <JsonResult> CheckMobileNumber2(string MobileNo)
        {
            MobileNumberClass2 response        = MobileNumberValidate2(MobileNo);
            string             Code            = response.Code;
            string             Message         = response.Message;
            string             LogoUrl         = response.ProductLogo;
            string             MinAmount       = response.MinAmount;
            string             MaxAmount       = response.MaxAmount;
            string             ProductId       = response.ProductId;
            string             CommissionValue = response.CommissionValue;
            string             CommissionType  = response.CommissionType;

            return(Json(new { Code, Message, LogoUrl, MinAmount, MaxAmount, ProductId, CommissionValue, CommissionType, response.CompanyCode, response.ServiceCode }, JsonRequestBehavior.AllowGet));
        }
        private MobileNumberClass2 MobileNumberValidate2(string MobileNumber, long Amount = 0)
        {
            //string type = "1";
            string             userid       = Session["UserId"].ToString();
            var                serviceslist = _payment.ServiceDetail(userid);
            MobileNumberClass2 response     = new MobileNumberClass2();

            response.Code    = "1";
            response.Message = "Invalid Number!!";
            if (string.IsNullOrEmpty(MobileNumber))
            {
                response.Message = "Number is Invalid!!";
                return(response);
            }
            if (MobileNumber.Length > 10 && MobileNumber.Substring(0, 3) == "977")
            {
                MobileNumber = MobileNumber.Substring(3);
            }
            if (!MobileNumberLengthValidate(MobileNumber))
            {
                response.Code    = "1";
                response.Message = "Please Enter Valid Mobile Number of length 10";
                return(response);
            }
            if (MobileNumber.Substring(0, 3) == "980" || MobileNumber.Substring(0, 3) == "981" || MobileNumber.Substring(0, 3) == "982")//NCELL
            {
                var serviceInfo = serviceslist.FirstOrDefault(x => x.ProductId == "2");
                response.Code             = "0";
                response.Message          = serviceInfo.ProductLabel;
                response.ProductLogo      = "/Content/assets/images/service logos/" + serviceInfo.ProductLogo;
                response.MinAmount        = string.IsNullOrEmpty(serviceInfo.MinAmount) ? "1" : serviceInfo.MinAmount;
                response.MaxAmount       += string.IsNullOrEmpty(serviceInfo.MaxAmount) ? "1000" : "|" + serviceInfo.MaxAmount;
                response.ProductId       += serviceInfo.ProductId;
                response.CommissionValue += serviceInfo.CommissionValue;
                response.CommissionType  += serviceInfo.CommissionType;
                response.ServiceCode      = "0";
                response.CompanyCode      = "78";
                return(response);
            }
            else if (MobileNumber.Substring(0, 3) == "984" || MobileNumber.Substring(0, 3) == "986")//ntc prepaid
            {
                var serviceInfo = serviceslist.FirstOrDefault(x => x.ProductId == "1");
                response.Code             = "0";
                response.Message          = serviceInfo.ProductLabel;
                response.ProductLogo      = "/Content/assets/images/service logos/" + serviceInfo.ProductLogo;
                response.MinAmount        = string.IsNullOrEmpty(serviceInfo.MinAmount) ? "1" : serviceInfo.MinAmount;
                response.MaxAmount       += string.IsNullOrEmpty(serviceInfo.MaxAmount) ? "1000" : serviceInfo.MaxAmount;
                response.ProductId       += serviceInfo.ProductId;
                response.CommissionValue += serviceInfo.CommissionValue;
                response.CommissionType  += serviceInfo.CommissionType;
                response.ServiceCode      = "0";
                response.CompanyCode      = "585";
                return(response);
            }
            else if (MobileNumber.Substring(0, 3) == "974" || MobileNumber.Substring(0, 3) == "976" || MobileNumber.Substring(0, 3) == "975")//ntc cdma
            {
                var serviceInfo = serviceslist.FirstOrDefault(x => x.ProductId == "9");
                response.Code             = "0";
                response.Message          = serviceInfo.ProductLabel;
                response.ProductLogo      = "/Content/assets/images/service logos/" + serviceInfo.ProductLogo;
                response.MinAmount        = string.IsNullOrEmpty(serviceInfo.MinAmount) ? "1" : serviceInfo.MinAmount;
                response.MaxAmount       += string.IsNullOrEmpty(serviceInfo.MaxAmount) ? "1000" : "|" + serviceInfo.MaxAmount;
                response.ProductId       += serviceInfo.ProductId;
                response.CommissionValue += serviceInfo.CommissionValue;
                response.CommissionType  += serviceInfo.CommissionType;
                response.ServiceCode      = "5";
                response.CompanyCode      = "585";
                return(response);
            }
            else if (MobileNumber.Substring(0, 3) == "985")//ntc postpaid
            {
                var serviceInfo = serviceslist.FirstOrDefault(x => x.ProductId == "14");
                response.Code             = "0";
                response.Message          = serviceInfo.ProductLabel;
                response.ProductLogo      = "/Content/assets/images/service logos/" + serviceInfo.ProductLogo;
                response.MinAmount        = string.IsNullOrEmpty(serviceInfo.MinAmount) ? "1" : serviceInfo.MinAmount;
                response.MaxAmount       += string.IsNullOrEmpty(serviceInfo.MaxAmount) ? "1000" : "|" + serviceInfo.MaxAmount;
                response.ProductId       += serviceInfo.ProductId;
                response.CommissionValue += serviceInfo.CommissionValue;
                response.CommissionType  += serviceInfo.CommissionType;
                response.ServiceCode      = "1";
                response.CompanyCode      = "585";
                return(response);
            }
            else if (MobileNumber.Substring(0, 3) == "988" || MobileNumber.Substring(0, 3) == "961" || MobileNumber.Substring(0, 3) == "962")//smartcell
            {
                var serviceInfo = serviceslist.FirstOrDefault(x => x.ProductId == "4");
                response.Code             = "0";
                response.Message          = serviceInfo.ProductLabel;
                response.ProductLogo      = "/Content/assets/images/service logos/" + serviceInfo.ProductLogo;
                response.MinAmount        = string.IsNullOrEmpty(serviceInfo.MinAmount) ? "1" : serviceInfo.MinAmount;
                response.MaxAmount       += string.IsNullOrEmpty(serviceInfo.MaxAmount) ? "1000" : "|" + serviceInfo.MaxAmount;
                response.ProductId       += serviceInfo.ProductId;
                response.CommissionValue += serviceInfo.CommissionValue;
                response.CommissionType  += serviceInfo.CommissionType;
                ushort ServiceCode = 0;
                if (Amount == 1000)
                {
                    ServiceCode = 10;
                }
                else if (Amount == 2000)
                {
                    ServiceCode = 0;
                }
                else if (Amount == 5000)
                {
                    ServiceCode = 1;
                }
                else if (Amount == 10000)
                {
                    ServiceCode = 2;
                }
                else if (Amount == 20000)
                {
                    ServiceCode = 3;
                }
                else if (Amount == 50000)
                {
                    ServiceCode = 4;
                }
                else if (Amount == 100000)
                {
                    ServiceCode = 5;
                }
                response.ServiceCode = Amount != 2000 && ServiceCode == 0 ? "" : ServiceCode.ToString();
                response.CompanyCode = "709";
                return(response);
            }
            else if (MobileNumber.Substring(0, 3) == "972")//UTL
            {
                var serviceInfo = serviceslist.FirstOrDefault(x => x.ProductId == "3");
                response.Code             = "0";
                response.Message          = serviceInfo.ProductLabel;
                response.ProductLogo      = "/Content/assets/images/service logos/" + serviceInfo.ProductLogo;
                response.MinAmount        = string.IsNullOrEmpty(serviceInfo.MinAmount) ? "1" : serviceInfo.MinAmount;
                response.MaxAmount       += string.IsNullOrEmpty(serviceInfo.MaxAmount) ? "1000" : "|" + serviceInfo.MaxAmount;
                response.ProductId       += serviceInfo.ProductId;
                response.CommissionValue += serviceInfo.CommissionValue;
                response.CommissionType  += serviceInfo.CommissionType;
                ushort ServiceCode = 1;
                if (Amount == 1000 || Amount == 2000 || Amount == 5000 || Amount == 10000 || Amount == 25000 || Amount == 50000 || Amount == 100000)
                {
                    ServiceCode = 0;
                }
                response.ServiceCode = ServiceCode == 1 ? "" : ServiceCode.ToString();
                response.CompanyCode = "582";
                return(response);
            }
            else
            {
                return(response);
            }
        }