public async System.Threading.Tasks.Task <JsonResult> CheckMobileNumber(string MobileNo) { MobileNumberClass response = MobileNumberValidate(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 }, JsonRequestBehavior.AllowGet)); }
private MobileNumberClass MobileNumberValidate(string MobileNumber) { //string type = "1"; string userid = Session["UserId"].ToString(); var serviceslist = _payment.ServiceDetail(userid); MobileNumberClass response = new MobileNumberClass(); 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" || (ConfigurationManager.AppSettings["phase"] != null && ConfigurationManager.AppSettings["phase"].ToString().ToUpper() == "DEVELOPMENT" && MobileNumber.Substring(0, 3) == "880"))//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; 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; 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; 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; 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; 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; return(response); } else { return(response); } }