private string GetAppUrl(M_QrCode model, DeviceHelper.Agent agent, DeviceHelper.Brower brower)
        {
            string url = "";

            if (string.IsNullOrEmpty(model.Urls))
            {
                return(url);
            }
            url = codeBll.GetUrlByAgent(agent, model);
            switch (agent)
            {
            case DeviceHelper.Agent.iPhone:
            case DeviceHelper.Agent.iPad:
                switch (brower)
                {
                case DeviceHelper.Brower.Micro:        //如果是微信,并且是分发市场的Url,则提示其用外置浏览器打开
                    string html = SafeSC.ReadFileStr("/APP/AppStore.html");
                    //html = html.Replace("@Device", "");
                    Response.Clear();
                    Response.Write(html); Response.Flush(); Response.End();
                    break;
                }
                break;
            }
            return(url);
        }
        public void AppUrl()
        {
            int      appId     = DataConverter.CLng(Request["appid"]);
            int      Mid       = DataConverter.CLng(Request["ID"]);
            string   agent     = Request.UserAgent;
            M_QrCode qrcodeMod = null;

            if (Mid > 0)
            {
                qrcodeMod = codeBll.SelReturnModel(Mid);
            }
            else if (appId > 0)
            {
                qrcodeMod = codeBll.SelModelByAppID(appId);
            }
            else
            {
                function.WriteErrMsg("参数不能为空");
            }
            if (qrcodeMod == null)
            {
                function.WriteErrMsg("参数错误,该链接不存在");
            }
            string url = GetAppUrl(qrcodeMod, DeviceHelper.GetAgent(agent), DeviceHelper.GetBrower(agent));

            url = string.IsNullOrEmpty(url) ? GetAppUrl(qrcodeMod, DeviceHelper.Agent.Android, DeviceHelper.GetBrower(agent)) : url;
            if (string.IsNullOrEmpty(url))
            {
                function.WriteErrMsg("未为该设备指定链接");
            }
            Response.Redirect(url);
        }
        public ActionResult CL()
        {
            if (!B_Admin.CheckIsLogged(Request.RawUrl))
            {
                return(null);
            }
            M_QrCode qrcodeMod = null;
            int      Mid       = DataConverter.CLng(Request["ID"]);

            if (Mid > 0)
            {
                qrcodeMod = codeBll.SelReturnModel(Mid);
            }
            if (qrcodeMod != null)
            {
                ViewBag.alias   = qrcodeMod.UserName;
                ViewBag.android = codeBll.GetUrlByAgent(DeviceHelper.Agent.Android, qrcodeMod);
                ViewBag.iphone  = codeBll.GetUrlByAgent(DeviceHelper.Agent.iPhone, qrcodeMod);
                ViewBag.ipad    = codeBll.GetUrlByAgent(DeviceHelper.Agent.iPad, qrcodeMod);
                ViewBag.wphone  = codeBll.GetUrlByAgent(DeviceHelper.Agent.WindowsPhone, qrcodeMod);
                ViewBag.pc      = codeBll.GetUrlByAgent(DeviceHelper.Agent.PC, qrcodeMod);
                string url = StrHelper.UrlDeal(SiteConfig.SiteInfo.SiteUrl + "/app/appurl?id=" + qrcodeMod.ID);
                ViewBag.link = codeBll.GetUrl(qrcodeMod.ID);
                ViewBag.code = "<img src='/Common/Common.ashx?url=" + url + "' class='codeimg'  />";
            }
            ViewBag.navLabel = "<li><a href='" + CustomerPageAction.customPath2 + "Main.aspx'>工作台</a></li><li><a href='/APP/Default'>移动应用</a></li><li><a href='CLList'>APP颁发</a></li><li class='active'>颁发管理</li>";
            return(View());
        }
        public void CreateLink()
        {
            int      Mid     = DataConverter.CLng(Request["ID"]);
            M_QrCode codeMod = null;

            if (Mid > 0)
            {
                codeMod = codeBll.SelReturnModel(Mid);
            }
            if (codeMod == null)
            {
                codeMod = new M_QrCode();
            }
            codeMod.UserName = Request.Form["alias_t"].Trim();
            codeMod.Urls     = DeviceHelper.Agent.Android + "$" + StrHelper.UrlDeal(Request.Form["android_t"].Trim()) + ","
                               + DeviceHelper.Agent.iPhone + "$" + StrHelper.UrlDeal(Request.Form["iphone_t"].Trim()) + ","
                               + DeviceHelper.Agent.iPad + "$" + StrHelper.UrlDeal(Request.Form["ipad_t"].Trim()) + ","
                               + DeviceHelper.Agent.WindowsPhone + "$" + StrHelper.UrlDeal(Request.Form["wphone_t"].Trim()) + ","
                               + DeviceHelper.Agent.PC + "$" + StrHelper.UrlDeal(Request.Form["pc_t"].Trim());
            if (codeMod.ID <= 0)
            {
                codeMod.AppID = DataConverter.CLng(function.GetRandomString(6, 2));
                codeMod.ID    = Sql.insertID(codeBll.strTableName, codeMod.GetParameters(codeMod), BLLCommon.GetParas(codeMod), BLLCommon.GetFields(codeMod));
            }
            else
            {
                codeBll.UpdateByID(codeMod);
            }
            Response.Redirect("CL?ID=" + codeMod.ID);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BtnSave.Visible = false;
                if (!string.IsNullOrEmpty(Request["ID"]))
                {
                    int ID = DataConverter.CLng(Request["ID"]);
                    Mcode = Bcode.SelReturnModel(ID);
                    this.TxtContent.Text       = Mcode.CodeContents;
                    this.Level.SelectedValue   = Mcode.CodeLevel;
                    this.Version.SelectedValue = Mcode.CodeVersion.ToString();
                    BtnSave.Visible            = true;
                    ShowImgs.Visible           = true;
                    ImgCode.ImageUrl           = SiteConfig.SiteOption.UploadDir + "/" + Mcode.ImageUrl;
                    string tit = Mcode.CodeContents;

                    if (Request["Type"] == "1")
                    {
                        string[] str = tit.Split(new Char[] { ';' });
                        {
                            if (str.Length > 0)
                            {
                                //for (int i = 0; i > str.Length; i++)
                                //{

                                FN.Value    = str[0].Split(new Char[] { ':' })[1];
                                TEL.Value   = str[1].Split(new Char[] { ':' })[1];
                                EMAIL.Value = str[2].Split(new Char[] { ':' })[1];
                                MSN.Value   = str[3].Split(new Char[] { ':' })[1];
                                QQ.Value    = str[4].Split(new Char[] { ':' })[1];
                                URL.Value   = str[5].Split(new Char[] { ':' })[1];
                                // }
                            }
                        }
                        tit = tit.Split(new Char[] { ';' })[0].Split(new Char[] { ':' })[2] + "的名片";
                    }
                    TxtZoneCode.Text = "<img src='" + SiteConfig.SiteOption.UploadDir + "/" + Mcode.ImageUrl + "' alt='" + tit + "' />";
                }
            }

            Call.SetBreadCrumb(Master, "<li><a href='" + CustomerPageAction.customPath2 + "Main.aspx'>工作台</a></li><li><a href='" + CustomerPageAction.customPath2 + "WeiXin/Default.aspx'>微信管理</a></li><li>二维码管理<a href='QrCode.aspx'>[生成二维码]</a></li>");
        }