Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            this.companyID.Value = OperUtil.Get("companyID");
            this._operaID.Value  = OperUtil.Get("operaID");
            if (string.IsNullOrEmpty(OperUtil.Get("companyID")))
            {
                Response.Write("<script>alert('您尚未登录或已长时间未进行操作,请重新登录!');top.location.href='../../index.aspx';</script>");
                return;
            }

            string    sql = "select * from asm_protype where 1=1";
            DataTable dt  = DbHelperSQL.Query(sql).Tables[0];

            this.typeLB.DataTextField  = "typeName";
            this.typeLB.DataValueField = "productTypeID";
            this.typeLB.DataSource     = dt;
            this.typeLB.DataBind();

            string    sql1 = "select * from asm_brand where companyID=" + this.companyID.Value;
            DataTable dts  = DbHelperSQL.Query(sql1).Tables[0];

            this.brandlist.DataTextField  = "brandName";
            this.brandlist.DataValueField = "id";
            this.brandlist.DataSource     = dts;
            this.brandlist.DataBind();
        }
Example #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string id = OperUtil.Get("comOperID");

            this.operaID.Value = id;
            this.OPID.Value    = OperUtil.Get("operaID");
        }
Example #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            companyID             = OperUtil.Get("companyID");
            this._companyID.Value = companyID;
            agentID             = OperUtil.Get("operaID");
            this._agentID.Value = agentID;
            if (string.IsNullOrEmpty(companyID))
            {
                Response.Write("<script>alert('您尚未登录或已长时间未进行操作,请重新登录!');top.location.href='../../index.aspx';</script>");
                return;
            }
            try
            {
                province     = Request.QueryString["province"].ToString();
                city         = Request.QueryString["city"].ToString();
                country      = Request.QueryString["country"].ToString();
                start        = Request.QueryString["start"].ToString();
                end          = Request.QueryString["end"].ToString();
                sxType       = Request.QueryString["sxType"].ToString();
                mechineIDStr = Request.QueryString["mechineIDStr"].ToString();

                getData(province, city, country, start, end, sxType, companyID, mechineIDStr, agentID);
            }
            catch
            {
                //初始化的时候查全部
                getData(null, null, null, null, null, null, companyID, null, this._agentID.Value);
            }
        }
Example #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            comID = OperUtil.Get("companyID");
            this._operaID.Value = OperUtil.Get("operaID");
            if (string.IsNullOrEmpty(comID))
            {
                Response.Write("<script>alert('您尚未登录或已长时间未进行操作,请重新登录!');top.location.href='../../index.aspx';</script>");
                return;
            }

            this.companyID.Value = comID;
            string    sql = "select * from asm_company where id=" + comID;
            DataTable dd  = DbHelperSQL.Query(sql).Tables[0];

            if (dd.Rows.Count > 0)
            {
                //this.appTime.Value = dd.Rows[0]["p2"].ToString();
                this.getTime.Value = dd.Rows[0]["p3"].ToString();
                //this.downTime.Value = dd.Rows[0]["p1"].ToString();

                this.jlc.Value = dd.Rows[0]["jlc"].ToString();

                this.syqx.Value         = dd.Rows[0]["p12"].ToString();
                this.biz.Value          = dd.Rows[0]["biz"].ToString();
                this.tkbs.Value         = dd.Rows[0]["tkbs"].ToString();
                this.minAppid.Value     = dd.Rows[0]["minAppid"].ToString();
                this.minAppSerect.Value = dd.Rows[0]["minSecret"].ToString();
                this.phone.Value        = dd.Rows[0]["customerPhone"].ToString();
            }
        }
Example #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            comID = OperUtil.Get("companyID");

            if (string.IsNullOrEmpty(comID))
            {
                Response.Write("<script>alert('您尚未登录或已长时间未进行操作,请重新登录!');top.location.href='../../index.aspx';</script>");
                return;
            }

            this._activityID.Value = Request.QueryString["activityID"].ToString();
            this.companyID.Value   = comID;
            //获取选中的列表
            string    sql = "select * from asm_activity_fulldiscount_detail  where activityID='" + this._activityID.Value + "' and companyID='" + companyID.Value + "'";
            DataTable dt  = DbHelperSQL.Query(sql).Tables[0];

            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    this.menu_id.Value += dt.Rows[i]["productTypeID"].ToString() + "_" + dt.Rows[i]["productID"].ToString() + "-";
                }
                this.menu_id.Value = this.menu_id.Value.Substring(0, this.menu_id.Value.Length - 1);
            }
        }
Example #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                time               = this.end.Value;
                comID              = OperUtil.Get("companyID");
                operaID            = OperUtil.Get("operaID");
                this.agentID.Value = operaID;
                if (string.IsNullOrEmpty(comID) || string.IsNullOrEmpty(operaID))
                {
                    Response.Write("<script>alert('您尚未登录或已长时间未进行操作,请重新登录!');top.location.href='../../index.aspx';</script>");
                    return;
                }
                if (operaID != "0")
                {
                    this.companyID.Value = comID;
                    string  sqlme = "select  id sCode,bh sName from  asm_mechine where dls='" + operaID + "' and companyID=" + comID;
                    DataSet dd    = DbHelperSQL.Query(sqlme);

                    this.cbosDeparentment.dtDataList = dd;
                }
                else
                {
                    this.companyID.Value = comID;
                    string  sqlme = "select  id sCode,bh sName from  asm_mechine where companyID=" + comID;
                    DataSet dd    = DbHelperSQL.Query(sqlme);

                    this.cbosDeparentment.dtDataList = dd;
                }
            }
        }
Example #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            comID = OperUtil.Get("companyID");
            this._operaID.Value = OperUtil.Get("operaID");
            if (string.IsNullOrEmpty(comID))
            {
                Response.Write("<script>alert('您尚未登录或已长时间未进行操作,请重新登录!');top.location.href='../../index.aspx';</script>");
                return;
            }

            if (!IsPostBack)
            {
                this.companyID.Value = comID;
                string    sql = "select * from asm_mechine where companyID=" + comID;
                DataTable dt  = DbHelperSQL.Query(sql).Tables[0];
                this.mechineList.DataTextField  = "bh";
                this.mechineList.DataValueField = "id";
                this.mechineList.DataSource     = dt;
                this.mechineList.DataBind();
                this.mechineList.Items.Insert(0, new ListItem("所有机器", "0")); //添加项

                string    sql1 = "select * from  asm_activity where companyID=" + this.companyID.Value + " and  is_del=0";
                DataTable d1   = DbHelperSQL.Query(sql1).Tables[0];
                this.zqList.DataTextField  = "zqName";
                this.zqList.DataValueField = "zq";
                this.zqList.DataSource     = d1;
                this.zqList.DataBind();
                this.zqList.Items.Insert(0, new ListItem("所有周期", "0")); //添加项
            }
        }
Example #8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     comID = OperUtil.Get("companyID");
     this.companyID.Value = comID;
     if (string.IsNullOrEmpty(comID))
     {
         Response.Write("<script>alert('您尚未登录或已长时间未进行操作,请重新登录!');top.location.href='../../index.aspx';</script>");
         return;
     }
 }
Example #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            comID = OperUtil.Get("companyID");
            this._operaID.Value  = OperUtil.Get("operaID");
            this.companyID.Value = comID;

            if (!IsPostBack)
            {
                search(comID, "1");
            }
        }
Example #10
0
 protected void Page_Load(object sender, EventArgs e)
 {
     comID = OperUtil.Get("companyID");
     if (string.IsNullOrEmpty(comID))
     {
         Response.Write("<script>alert('您尚未登录或已长时间未进行操作,请重新登录!');top.location.href='../../index.aspx';</script>");
         return;
     }
     this.time.Value      = Request.QueryString["time"].ToString();
     this.mechineID.Value = Request.QueryString["mechineID"].ToString();
 }
Example #11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            comID                = OperUtil.Get("companyID");
            operaID              = OperUtil.Get("operaID");
            this.opera_id.Value  = operaID;
            this.agentID.Value   = operaID;
            this.companyId.Value = comID;
            if (string.IsNullOrEmpty(comID))
            {
                Response.Write("<script>alert('您尚未登录或已长时间未进行操作,请重新登录!');top.location.href='../../index.aspx';</script>");
                return;
            }
            if (operaID != "0")
            {
                string    sql = "select * from asm_opera where   appQX in (2) and companyID=" + comID;
                DataTable dt  = DbHelperSQL.Query(sql).Tables[0];
                this.sel1.DataTextField  = "name";
                this.sel1.DataValueField = "id";
                this.sel1.DataSource     = dt;
                this.sel1.DataBind();

                string    sql0 = "select * from asm_opera where companyID=" + comID + " and qx in (select roleID from asm_qx where menuID='szdls') and appQX in (1,2)";
                DataTable dt1  = DbHelperSQL.Query(sql0).Tables[0];
                this.DropDownList1.DataTextField  = "name";
                this.DropDownList1.DataValueField = "id";
                this.DropDownList1.DataSource     = dt1;
                this.DropDownList1.DataBind();
            }
            else
            {
                string    sql = "select * from asm_opera where companyID=" + comID + " and appQX in (1,2)";
                DataTable dt  = DbHelperSQL.Query(sql).Tables[0];
                this.sel1.DataTextField  = "name";
                this.sel1.DataValueField = "id";
                this.sel1.DataSource     = dt;
                this.sel1.DataBind();
                string    sql0 = "select * from asm_opera where companyID=" + comID + " and qx in (select roleID from asm_qx where menuID='szdls') and appQX in (1,2)";
                DataTable dt1  = DbHelperSQL.Query(sql0).Tables[0];
                this.DropDownList1.DataTextField  = "name";
                this.DropDownList1.DataValueField = "id";
                this.DropDownList1.DataSource     = dt1;
                this.DropDownList1.DataBind();
            }

            string    sql1 = "select * from asm_zfbhb where companyID=" + comID;
            DataTable dd   = DbHelperSQL.Query(sql1).Tables[0];

            this.hblist.DataTextField  = "des";
            this.hblist.DataValueField = "id";
            this.hblist.DataSource     = dd;
            this.hblist.DataBind();
            this.hblist.Items.Insert(0, new ListItem("暂不设置", "0")); //添加项
        }
Example #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            this._cardbh.Value = Request.QueryString["bh"].ToString();

            comID              = OperUtil.Get("companyID");
            operaID            = OperUtil.Get("operaID");
            this.agentID.Value = operaID;
            if (string.IsNullOrEmpty(comID))
            {
                Response.Write("<script>alert('您尚未登录或已长时间未进行操作,请重新登录!');top.location.href='../../index.aspx';</script>");
                return;
            }
            this.companyID.Value = comID;
        }
Example #13
0
 protected void Page_Load(object sender, EventArgs e)
 {
     comID = OperUtil.Get("companyID");
     this._operaID.Value = OperUtil.Get("operaID");
     if (string.IsNullOrEmpty(comID))
     {
         Response.Write("<script>alert('您尚未登录或已长时间未进行操作,请重新登录!');top.location.href='../../index.aspx';</script>");
         return;
     }
     this.companyId.Value = comID;
     //string sqlme = "select  id sCode,mechineName sName from  asm_mechine where companyID=" + comID;
     //DataSet dd = DbHelperSQL.Query(sqlme);
     //this.cbosDeparentment.dtDataList = dd;
 }
Example #14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            comID = OperUtil.Get("companyID");
            this._operaID.Value = OperUtil.Get("operaID");
            if (string.IsNullOrEmpty(comID))
            {
                Response.Write("<script>alert('您尚未登录或已长时间未进行操作,请重新登录!');top.location.href='../../index.aspx';</script>");
                return;
            }
            this.com_id.Value = comID;
            //查询公司信息

            string    sql1 = "select * from asm_company where id=" + comID;
            DataTable dd   = DbHelperSQL.Query(sql1).Tables[0];

            Token     = dd.Rows[0]["wx_token"].ToString();
            appid     = dd.Rows[0]["wx_appid"].ToString();
            appsecret = dd.Rows[0]["wx_appsecret"].ToString();
            string sql = "SELECT * from asm_menu where pid='0' and companyID=" + comID;

            dt = DbHelperSQL.Query(sql).Tables[0];
            if (dt.Rows.Count > 0)
            {
                //if (dt.Rows.Count == 1) {
                //二级菜单的个数
                string sql7 = "SELECT * from asm_menu where pid!='0' and pid='" + dt.Rows[0]["id"].ToString() + "' and companyID=" + comID;
                dt7 = DbHelperSQL.Query(sql7).Tables[0];
            }
            //string sqlP = "select * from asm_platformInfo ";
            //DataTable dp = DbHelperSQL.Query(sqlP).Tables[0];
            //string comToken = Util.getComToken();

            //if (string.IsNullOrEmpty(comToken))
            //{
            //    string ticket = dp.Rows[0]["ticket"].ToString();
            //    comToken = GetToken(OpenPFConfig.Appid, OpenPFConfig.Appsecret, ticket);
            //}
            //tokenModel = GetTokenInfo(OpenPFConfig.Appid,dd.Rows[0]["appId"].ToString(), comToken, dd.Rows[0]["refresh_token"].ToString());

            //if (tokenModel == null)
            //{
            //    string ticket = dp.Rows[0]["ticket"].ToString();
            //    comToken = GetToken(OpenPFConfig.Appid, OpenPFConfig.Appsecret, ticket);
            //    tokenModel = GetTokenInfo(OpenPFConfig.Appid, dd.Rows[0]["appId"].ToString(), comToken, dd.Rows[0]["refresh_token"].ToString());
            //}

            //this.HF_accesstoken.Value = tokenModel.authorizer_access_token;
        }
Example #15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            comID               = OperUtil.Get("companyID");
            operaID             = OperUtil.Get("operaID");
            this._operaID.Value = operaID;
            if (string.IsNullOrEmpty(comID) || string.IsNullOrEmpty(operaID))
            {
                Response.Write("<script>alert('您尚未登录或已长时间未进行操作,请重新登录!');top.location.href='../../index.aspx';</script>");
                return;
            }
            this.companyID.Value = comID;

            if (operaID != "0")
            {
                string  sqlme = "select  id sCode,bh sName from  asm_mechine where dls='" + operaID + "' and companyID=" + comID;
                DataSet dd    = DbHelperSQL.Query(sqlme);
                this.cbosDeparentment.dtDataList = dd;

                string    sql1 = "select * from asm_opera where agentID='" + operaID + "' and  companyID=" + comID;
                DataTable dt1  = DbHelperSQL.Query(sql1).Tables[0];
                this.operaList.DataTextField  = "name";
                this.operaList.DataValueField = "id";
                this.operaList.DataSource     = dt1;
                this.operaList.DataBind();
                //this.operaList.Items.Insert(0, new ListItem("全部", "0")); //添加项
            }
            else
            {
                string  sqlme = "select  id sCode,bh sName from  asm_mechine where companyID=" + comID;
                DataSet dd    = DbHelperSQL.Query(sqlme);
                this.cbosDeparentment.dtDataList = dd;

                string    sql1 = "select * from asm_opera where companyID=" + comID;
                DataTable dt1  = DbHelperSQL.Query(sql1).Tables[0];
                this.operaList.DataTextField  = "name";
                this.operaList.DataValueField = "id";
                this.operaList.DataSource     = dt1;
                this.operaList.DataBind();
                this.operaList.Items.Insert(0, new ListItem("全部", "0")); //添加项
            }
        }
Example #16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            comID = OperUtil.Get("companyID");
            this._companyID.Value = comID;
            if (string.IsNullOrEmpty(comID))
            {
                Response.Write("<script>alert('您尚未登录或已长时间未进行操作,请重新登录!');top.location.href='../../index.aspx';</script>");
                return;
            }

            string  sqlme = "select  id sCode,bh sName from  asm_mechine where companyID=" + comID;
            DataSet ddd   = DbHelperSQL.Query(sqlme);

            this.cbosDeparentment.dtDataList = ddd;
            string    sql = "select id,bh,zdX,zdY from asm_mechine where zdX!='' and zdY!='' and statu=0 and companyID=" + comID;
            DataTable dd  = DbHelperSQL.Query(sql).Tables[0];
            string    str = "";

            if (dd.Rows.Count > 0)
            {
                for (int i = 0; i < dd.Rows.Count; i++)
                {
                    str += "[" + dd.Rows[i]["zdX"].ToString() + "," + dd.Rows[i]["zdY"].ToString() + "],";
                }
                str      = str.Substring(0, str.Length - 1);
                position = str;
            }
            string    sql1 = "select id,bh,zdX,zdY from asm_mechine where zdX!='' and zdY!='' and statu!=0 and companyID=" + comID;
            DataTable dds  = DbHelperSQL.Query(sql1).Tables[0];
            string    str2 = "";

            if (dds.Rows.Count > 0)
            {
                for (int i = 0; i < dds.Rows.Count; i++)
                {
                    str2 += "[" + dds.Rows[i]["zdX"].ToString() + "," + dds.Rows[i]["zdY"].ToString() + "],";
                }
                str2       = str2.Substring(0, str2.Length - 1);
                ycposttion = str2;
            }
        }
Example #17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            comID = OperUtil.Get("companyID");
            if (string.IsNullOrEmpty(comID))
            {
                Response.Write("<script>alert('您尚未登录或已长时间未进行操作,请重新登录!');top.location.href='../../index.aspx';</script>");
                return;
            }

            this.companyID.Value  = comID;
            this.mechine_id.Value = Request.QueryString["mechineID"].ToString();
            string    sql = "select * from asm_mechine where companyID=" + comID;
            DataTable dt  = DbHelperSQL.Query(sql).Tables[0];

            this.mechineList.DataTextField  = "bh";
            this.mechineList.DataValueField = "id";
            this.mechineList.DataSource     = dt;
            this.mechineList.DataBind();
            this.mechineList.Items.Insert(0, new ListItem("所有机器", "0")); //添加项
            this.mechineList.SelectedValue = this.mechine_id.Value;
        }
Example #18
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         id = Request.QueryString["id"].ToString();
         this.picID.Value = id;
         if (!string.IsNullOrEmpty(id))
         {
             string    sql = "select * from asm_zfbhb where id=" + id;
             DataTable dt  = DbHelperSQL.Query(sql).Tables[0];
             if (dt.Rows.Count > 0)
             {
                 this.des.Value              = dt.Rows[0]["des"].ToString();
                 this.pic1.Src               = dt.Rows[0]["path"].ToString();
                 this.url.Value              = dt.Rows[0]["url"].ToString();
                 this.start.Value            = dt.Rows[0]["startTime"].ToString();
                 this.end.Value              = dt.Rows[0]["endTime"].ToString();
                 this.typeList.SelectedValue = dt.Rows[0]["type"].ToString();
             }
         }
         comID = OperUtil.Get("companyID");
         if (string.IsNullOrEmpty(comID))
         {
             Response.Write("<script>alert('您尚未登录或已长时间未进行操作,请重新登录!');top.location.href='../../index.aspx';</script>");
             return;
         }
         this.companyID.Value = comID;
     }
     catch {
         comID = OperUtil.Get("companyID");
         if (string.IsNullOrEmpty(comID))
         {
             Response.Write("<script>alert('您尚未登录或已长时间未进行操作,请重新登录!');top.location.href='../../index.aspx';</script>");
             return;
         }
         this.companyID.Value = comID;
     }
 }
Example #19
0
        protected void Page_Load(object sender, EventArgs e)
        {
            comID = OperUtil.Get("companyID");
            this.companyID.Value = comID;
            operaID = OperUtil.Get("operaID");
            if (string.IsNullOrEmpty(comID) || string.IsNullOrEmpty(operaID))
            {
                Response.Write("<script>alert('您尚未登录或已长时间未进行操作,请重新登录!');top.location.href='../../index.aspx';</script>");
                return;
            }

            this.operID.Value = operaID;
            string    sql = "select * from asm_role where companyID=" + comID;
            DataTable dt  = DbHelperSQL.Query(sql).Tables[0];

            this.roleList.DataTextField  = "name";
            this.roleList.DataValueField = "id";
            this.roleList.DataSource     = dt;
            this.roleList.DataBind();
            this.DropDownList1.DataTextField  = "name";
            this.DropDownList1.DataValueField = "id";
            this.DropDownList1.DataSource     = dt;
            this.DropDownList1.DataBind();
        }
Example #20
0
        protected void Page_Load(object sender, EventArgs e)
        {
            productID             = Request.QueryString["productID"].ToString();
            this.product_id.Value = productID;
            comID = OperUtil.Get("companyID");
            this.companyID.Value = comID;
            if (string.IsNullOrEmpty(comID))
            {
                Response.Write("<script>alert('您尚未登录或已长时间未进行操作,请重新登录!');top.location.href='../../index.aspx';</script>");
                return;
            }

            string    sql1 = "select * from asm_protype ";
            DataTable dt1  = DbHelperSQL.Query(sql1).Tables[0];

            this.typeLB.DataTextField  = "typeName";
            this.typeLB.DataValueField = "productTypeID";
            this.typeLB.DataSource     = dt1;
            this.typeLB.DataBind();

            string    sql2 = "select * from asm_brand where companyID=" + this.companyID.Value;
            DataTable dts  = DbHelperSQL.Query(sql2).Tables[0];

            this.brandlist.DataTextField  = "brandName";
            this.brandlist.DataValueField = "id";
            this.brandlist.DataSource     = dts;
            this.brandlist.DataBind();
            if (productID != "")
            {
                string    sql = "select * from asm_product where productID=" + productID;
                DataTable dt  = DbHelperSQL.Query(sql).Tables[0];
                if (dt.Rows.Count > 0)
                {
                    this.name.Value           = dt.Rows[0]["proName"].ToString();
                    this.typeLB.SelectedValue = dt.Rows[0]["protype"].ToString();
                    this.price0.Value         = dt.Rows[0]["price0"].ToString();
                    this.price1.Value         = dt.Rows[0]["price1"].ToString();
                    this.price2.Value         = dt.Rows[0]["price2"].ToString();
                    this.price3.Value         = dt.Rows[0]["price3"].ToString();
                    this.bzqDay.Value         = dt.Rows[0]["bzq"].ToString();
                    this.progg.Value          = dt.Rows[0]["progg"].ToString();
                    this.description.Value    = dt.Rows[0]["description"].ToString();
                    this.shortname.Value      = dt.Rows[0]["shortName"].ToString();
                    this.bh.Value             = dt.Rows[0]["bh"].ToString();
                    this.tag.Value            = dt.Rows[0]["tag"].ToString();
                    this.ztList.SelectedValue = dt.Rows[0]["sluid"].ToString();
                    this.type.SelectedValue   = dt.Rows[0]["dstype"].ToString();
                    this.startSend.Value      = dt.Rows[0]["startSend"].ToString();
                    this.weight.Value         = dt.Rows[0]["weight"].ToString();
                    if (dt.Rows[0]["path"].ToString() != "")
                    {
                        this.pic.Src = "~" + dt.Rows[0]["path"].ToString();
                    }
                    else
                    {
                        this.pic.Src = "/main/public/images/addimg.png";
                    }
                    this.brandlist.SelectedValue = dt.Rows[0]["brandID"].ToString();
                }
            }
        }
Example #21
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string id = OperUtil.Get("AdminOperaID");

            this.operaID.Value = id;
        }
Example #22
0
        public DataTable DT = new DataTable(); //平台配置
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                comID = OperUtil.Get("companyID");
                this._operaID.Value = OperUtil.Get("operaID");
                if (string.IsNullOrEmpty(comID))
                {
                    Response.Write("<script>alert('您尚未登录或已长时间未进行操作,请重新登录!');top.location.href='../../index.aspx';</script>");
                    return;
                }
                this._companyID.Value = comID;
                Session.Timeout       = 360;

                if (!IsPostBack)
                {
                    //初始化页面的时候回去数据库校验当前登录用户(企业账号)是否“授权过”,是-展示企业公众号信息,否-展示授权二维码
                    //1-获取登录用户信息
                    string sql = "select * from asm_company where id=" + this._companyID.Value;

                    DC = DbHelperSQL.Query(sql).Tables[0];
                    DT = DbHelperSQL.Query("select * from asm_platformInfo").Tables[0];
                    this.HF_userInfoId.Value = comID;
                    //获取授权成功后回调的参数:
                    string auth_code  = Request.QueryString["auth_code"];
                    string expires_in = Request.QueryString["expires_in"];
                    Util.Debuglog("auth_code=" + auth_code + ";expires_in=" + expires_in, "_授权.txt");
                    if (!string.IsNullOrEmpty(auth_code))
                    {
                        //授权后的回调
                        auth_code = auth_code.Split(new string[] { "@@@" }, StringSplitOptions.RemoveEmptyEntries)[1];
                        string comToken = Util.getComToken();
                        //获取微信公众号接口“调用凭据authorizer_access_token”,用这个参数来调用微信公众平台接口
                        CommonMethod.RootObject authModel = GetAuthToken(OpenPFConfig.Appid, auth_code, comToken);
                        //将authorizer_refresh_token(这个是不会改变的)存入数据库,这是当token过期的时候用来刷新token的。如果authorizer_refresh_token丢失了,则需要重新授权
                        //获取“授权公众号详细信息”
                        authInfoModel = GetAuthInfo(OpenPFConfig.Appid, authModel.authorization_info.authorizer_appid, comToken);
                        string funcinfoIdStr = "";
                        //更新authorizer_refresh_token到userinfo表中
                        if (authInfoModel != null && authInfoModel.authorization_info != null && authInfoModel.authorization_info.func_info != null && authInfoModel.authorization_info.func_info.Count > 0)
                        {
                            UpdateUserInfo(authInfoModel, authModel.authorization_info.authorizer_refresh_token, DC.Rows[0]["id"].ToString());
                            //设置行业为消费品
                            string    sqlC    = "select * from asm_company where id=" + comID;
                            DataTable dt      = DbHelperSQL.Query(sql).Tables[0];
                            wxHelper  wx      = new wxHelper(comID);
                            string    token   = Util.GetTokenInfo(OpenPFConfig.Appid, dt.Rows[0]["appId"].ToString(), Util.getComToken(), dt.Rows[0]["refresh_token"].ToString()).authorizer_access_token;
                            string    result  = wx.setIndustry(token);
                            JObject   jo      = (JObject)JsonConvert.DeserializeObject(result);
                            string    errcode = jo["errcode"].ToString();
                        }
                        authAppid    = authModel.authorization_info.authorizer_appid;
                        refreshToken = authModel.authorization_info.authorizer_refresh_token;
                    }
                    else
                    {
                        //用户主动点击进来的(用户对象中含有Refresh_token属性)
                        if (DC != null && !string.IsNullOrEmpty(DC.Rows[0]["refresh_token"].ToString()))
                        {
                            //有这个值证明已经授权过,且在数据库中有信息
                            authAppid    = DC.Rows[0]["appId"].ToString();
                            refreshToken = DC.Rows[0]["refresh_token"].ToString();
                        }
                        else
                        {
                            //从Redis中取token
                            string comToken = Util.getComToken();
                            if (string.IsNullOrEmpty(comToken))
                            {
                                string ticket = DT.Rows[0]["ticket"].ToString();
                                comToken = GetToken(OpenPFConfig.Appid, OpenPFConfig.Appsecret, ticket);
                            }
                            //获取预授权码
                            string pac = GetPre_Auth_Code(OpenPFConfig.Appid, comToken);
                            //这里要判断下pac是否有值,无值证明comToken过期了,要重新获取
                            if (string.IsNullOrEmpty(pac))
                            {
                                comToken = GetToken(OpenPFConfig.Appid, OpenPFConfig.Appsecret, DT.Rows[0]["ticket"].ToString());
                                pac      = GetPre_Auth_Code(OpenPFConfig.Appid, comToken);
                            }
                            pac = pac.Split(new string[] { "@@@" }, StringSplitOptions.RemoveEmptyEntries)[1];
                            //拼接授权页面地址(用户扫描后跳转的扫码页面,前端必须用一个连接去进行跳转)
                            PhoneAuthPageUrl = "https://mp.weixin.qq.com/cgi-bin/componentloginpage?component_appid=" + OpenPFConfig.Appid + "&pre_auth_code=" + pac + "&redirect_uri=http://nq.bingoseller.com/main/enterprise/authPage.aspx&auth_type=3";
                        }
                    }
                }
            }
            catch (Exception ee)
            {
                Util.Debuglog("auth ee=" + ee.ToString(), "_授权.txt");
            }
        }
Example #23
0
        public void qx_judge(HttpContext context)
        {
            string menu    = context.Request["menu"].ToString();
            string operaID = OperUtil.Get("AdminOperaID");//为0说明是管理员登录

            if (operaID == "0")
            {
                //允许查看登录
                System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
                stringBuilder.Append("{");
                stringBuilder.Append("\"result\":\"ok\""); //完成
                stringBuilder.Append("}");
                context.Response.Write(stringBuilder.ToString());
            }
            else
            {
                string    sql = "select * from asm_opera where id=" + operaID;
                DataTable dd  = DbHelperSQL.Query(sql).Tables[0];
                if (dd.Rows.Count > 0)
                {
                    string    sql2 = "select * from asm_qx where roleID=" + dd.Rows[0]["qx"].ToString() + " and menuID='" + menu + "' ";
                    DataTable dt   = DbHelperSQL.Query(sql2).Tables[0];
                    if (dt.Rows.Count > 0)
                    {
                        if (dt.Rows[0]["flag"].ToString() == "0")
                        {
                            //不允许登录
                            System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
                            stringBuilder.Append("{");
                            stringBuilder.Append("\"result\":\"notLogin\""); //完成
                            stringBuilder.Append("}");
                            context.Response.Write(stringBuilder.ToString());
                        }
                        else if (dt.Rows[0]["flag"].ToString() == "1")
                        {
                            //允许登录
                            System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
                            stringBuilder.Append("{");
                            stringBuilder.Append("\"result\":\"ok\""); //完成
                            stringBuilder.Append("}");
                            context.Response.Write(stringBuilder.ToString());
                        }
                    }
                    else
                    {
                        //请联系管理员给当前登录角色赋值权限
                        System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
                        stringBuilder.Append("{");
                        stringBuilder.Append("\"result\":\"1\""); //完成
                        stringBuilder.Append("}");
                        context.Response.Write(stringBuilder.ToString());
                    }
                }
                else
                {
                    //跳转重新登录
                    System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
                    stringBuilder.Append("{");
                    stringBuilder.Append("\"result\":\"2\""); //完成
                    stringBuilder.Append("}");
                    context.Response.Write(stringBuilder.ToString());
                }
            }
        }
Example #24
0
 protected void Page_Load(object sender, EventArgs e)
 {
     comID = OperUtil.Get("companyID");
     this._operaID.Value  = OperUtil.Get("operaID");
     this.companyID.Value = comID;
 }