Ejemplo n.º 1
0
        public string QueryFeeByNumber(string strTelNumber)
        {
            string strFee       = string.Empty;
            string strLocal     = string.Empty;
            string strQueryInfo = TXFeeQuery.QueryNumberInfo("T08711142", "t11Aqi42", strTelNumber);

            var KeyQuery = new { custName = "", product = "", custNo = "", retCode = "", money = "", errorMsg = "" };

            if (JsonConvert.DeserializeAnonymousType(strQueryInfo, KeyQuery).retCode == "1")
            {
                strFee = JsonConvert.DeserializeAnonymousType(strQueryInfo, KeyQuery).money.Replace("\r\n", "") + "元";
            }
            else
            {
                //strFee = JsonConvert.DeserializeAnonymousType(strQueryInfo, KeyQuery).errorMsg;
                strFee = "未查询到";
            }
            //取号码所属地
            if (strTelNumber.Substring(0, 1) == "1")
            {
                DAL.PublicService.aq_CeleWhere dal = new DAL.PublicService.aq_CeleWhere();
                strLocal = dal.GetLocalState(strTelNumber);
            }
            else
            {
                switch (strTelNumber.Substring(0, 4))
                {
                case "0691":
                    strLocal = "云南版纳固话";
                    break;

                case "0692":
                    strLocal = "云南德宏固话";
                    break;

                case "0870":
                    strLocal = "云南昭通固话";
                    break;

                case "0871":
                    strLocal = "云南昆明固话";
                    break;

                case "0872":
                    strLocal = "云南大理固话";
                    break;

                case "0873":
                    strLocal = "云南红河固话";
                    break;

                case "0874":
                    strLocal = "云南曲靖固话";
                    break;

                case "0875":
                    strLocal = "云南保山固话";
                    break;

                case "0876":
                    strLocal = "云南文山固话";
                    break;

                case "0877":
                    strLocal = "云南玉溪固话";
                    break;

                case "0878":
                    strLocal = "云南楚雄固话";
                    break;

                case "0879":
                    strLocal = "云南思茅固话";
                    break;

                case "0883":
                    strLocal = "云南临沧固话";
                    break;

                case "0886":
                    strLocal = "云南怒江固话";
                    break;

                case "0887":
                    strLocal = "云南迪庆固话";
                    break;

                case "0888":
                    strLocal = "云南丽江固话";
                    break;

                default:
                    strLocal = "未知";
                    break;
                }
            }
            return(strFee + " 归属:" + strLocal);
        }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string strChargeType   = string.Empty;
            string strChargeNo     = string.Empty;
            string strChargeAmount = string.Empty;
            string strOpenID       = string.Empty;
            string strCelWhere     = string.Empty;

            try
            {
                if (null == Request.QueryString["openid"])
                {
                    if (Session["OpenID"] != null && Session["OpenID"].ToString() != "")
                    {
                        strOpenID = Session["strOpenID"].ToString();
                    }
                    else
                    {
                        return;
                    }
                }
                else
                {
                    if (Request.QueryString["openid"].ToString().Length > 29 || Request.QueryString["openid"].ToString().Length < 25)
                    {
                        return;
                    }
                    else
                    {
                        strOpenID = Request.QueryString["openid"].ToString();
                    }
                }


                if (null == Request.QueryString["type"])
                {
                    return;
                }
                else
                {
                    switch (Request.QueryString["type"].ToString())
                    {
                    case "0":
                        strChargeType = "话费充值";
                        break;

                    case "1":
                        strChargeType = "Q币充值";
                        break;

                    default:
                        strChargeType = "话费充值";
                        break;
                    }
                }

                strChargeNo = Common.Common.NoHtml(Request.Form["ChargeNumber"].ToString());
                if (string.IsNullOrEmpty(strChargeNo.Trim()) || strChargeNo == "")
                {
                    Response.Write("<script>alert('充值号码不能为空!');history.back();</script>");
                    return;
                }

                strChargeAmount = Common.Common.NoHtml(Request.Form["PayFee"].ToString());

                string strOtherPay = "0";

                if (strChargeType == "话费充值")
                {
                    strOtherPay = Common.Common.NoHtml(Request.Form["other_price"].Trim());

                    if (!string.IsNullOrWhiteSpace(strOtherPay))
                    {
                        strChargeAmount = "其它";
                    }

                    if (strChargeAmount == "其它")
                    {
                        strChargeAmount = Common.Common.NoHtml(Request.Form["other_price"].ToString());
                    }
                }
                else
                {
                    strOtherPay = Common.Common.NoHtml(Request.Form["other_QQprice"].Trim());

                    if (!string.IsNullOrWhiteSpace(strOtherPay))
                    {
                        strChargeAmount = "其它";
                    }

                    if (strChargeAmount == "其它")
                    {
                        strChargeAmount = Common.Common.NoHtml(Request.Form["other_QQprice"].ToString());
                    }
                }

                if (string.IsNullOrEmpty(strChargeAmount.Trim()) || strChargeNo == "")
                {
                    Response.Write("<script>alert('充值金额不能为空!');history.back();</script>");
                    return;
                }
                if (strChargeType == "话费充值")
                {
                    string strYNLocal   = "0691,0692,0870,0871,0872,0873,0874,0875,0876,0877,0878,0879,0883,0886,0887,0888";
                    string strMobieNO   = "134、135、136、137、138、139、147、150、151、152、157、158、159、182、183、184、187、188";
                    string strMobieCUNO = "130、131、132、145、155、156、185、186";
                    string strMobieCTNO = "133、153、189、181、180";
                    strCelWhere = "CMCC";


                    if (strYNLocal.IndexOf(strChargeNo.Substring(0, 4)) > -1)
                    {
                        strCelWhere = "CT";
                    }
                    else
                    {
                        if (!IsMobilePhone(strChargeNo))
                        {
                            Response.Write("<script>alert('请输入正确的缴费号码!');history.back();</script>");
                            return;
                        }

                        if (strMobieNO.IndexOf(strChargeNo.Substring(0, 3)) > -1)
                        {
                            strCelWhere = "CMCC";
                            DAL.PublicService.aq_CeleWhere dal = new DAL.PublicService.aq_CeleWhere();
                            string strLocal = dal.GetLocalStateName(strChargeNo);
                            if (strLocal != "昆明")
                            {
                                Response.Write("<script>alert('移动只能缴昆明本地电话费!');history.back();</script>");
                                return;
                            }
                        }

                        if (strMobieCUNO.IndexOf(strChargeNo.Substring(0, 3)) > -1)
                        {
                            strCelWhere = "CU";
                        }

                        if (strMobieCTNO.IndexOf(strChargeNo.Substring(0, 3)) > -1 || strChargeNo.Substring(0, 1) != "1")
                        {
                            strCelWhere = "CT";
                        }

                        if (strCelWhere != "CMCC")
                        {
                            if (int.Parse(strChargeAmount.Trim()) < 10)
                            {
                                Response.Write("<script>alert('非移动缴费金额不能小于10元!');history.back();</script>");
                                return;
                            }

                            DAL.PublicService.aq_CeleWhere dal = new DAL.PublicService.aq_CeleWhere();
                            string strLocal = dal.GetLocalProvinceName(strChargeNo);
                            if (strLocal != "云南")
                            {
                                Response.Write("<script>alert('联通电信只能缴云南省电话费!');history.back();</script>");
                                return;
                            }
                        }
                    }
                }
                else
                {
                    if (!IsInteger(strChargeNo))
                    {
                        Response.Write("<script>alert('请输入正确的缴费号码!');history.back();</script>");
                        return;
                    }
                }

                if (strChargeAmount == "其它")
                {
                    strChargeAmount = Common.Common.NoHtml(Request.Form["other_price"].ToString());
                }

                string text = System.IO.File.ReadAllText(Server.MapPath("../ShopPage/ChargeType.html"));
                JinianNet.JNTemplate.TemplateContext context = new JinianNet.JNTemplate.TemplateContext();

                context.TempData["ChargeType"]   = strChargeType;
                context.TempData["ChargeNo"]     = strChargeNo;
                context.TempData["ChargeAmount"] = strChargeAmount;
                context.TempData["CelWhere"]     = strCelWhere;
                context.TempData["OpenID"]       = strOpenID;

                JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(context, text);
                t.Render(Response.Output);
            }
            catch (Exception ex)
            {
                Model.SYS.ExceptionLog log = new Model.SYS.ExceptionLog();
                log.Message = string.Format("Q币充值出错:" + ex.Message);
                ExceptionLogDAL.InsertExceptionLog(log);
            }
        }