/// <summary>
        /// 获得网站信息数据
        /// 作者:姚东
        /// 时间:20100919
        /// </summary>
        private DataSet GetData()
        {
            DataSet ds = new DataSet();

            ds = new BLL.Query.HuiYuanInfoQuery().GetInfo(this.Name, this.Account, this.Status, viewpage1.CurrentPageIndex, viewpage1.PageSize);

            return(ds);
        }
        /// <summary>
        /// 登录按钮点击事件
        /// 作者:姚东
        /// 时间:20100925
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void lbLogin_Click(object sender, EventArgs e)
        {
            try
            {
                string uid = this.txtHuiYuanAccount.Text.Trim();
                if (uid == "")
                {
                    PageHelper.ShowExceptionMessage("请输入登录账号!");
                    return;
                }
                try
                {
                    DataTable dt = new BLL.Query.HuiYuanInfoQuery().GetInfoHuiYuan(txtHuiYuanAccount.Text.Trim(), txtPwd.Text.Trim());
                    if (dt.Rows.Count > 0)
                    {
                        Session["UserGUID"]       = dt.Rows[0]["ID"].ToString();
                        Session["UserIDClient"]   = dt.Rows[0]["UserID"].ToString();
                        Session["HuiYuanAccount"] = dt.Rows[0]["LoginAcc"].ToString();
                        Session["HuiYuanName"]    = dt.Rows[0]["LoginPWD"].ToString();
                        lblHuiYuanName.Text       = Session["HuiYuanName"].ToString();
                    }
                    else
                    {
                        PageHelper.ShowExceptionMessage("登录账号或者密码错误!");
                        return;
                    }
                }
                catch (Exception E)
                {
                    throw E;
                }

                this.divLogin.Visible       = false;
                divUser.Visible             = true;
                this.txtHuiYuanAccount.Text = "";
                this.txtPwd.Text            = "";

                if (this.Page.Request.QueryString["RedirectURL"] != null)
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "redirect",
                                                            "window.parent.location.href='" + this.Page.Request.QueryString["RedirectURL"].ToString().Replace('^', '&') + "'", true);
                }
                else
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "redirect",
                                                            "window.parent.location.href='Index.aspx'", true);
                }
            }
            catch (Exception E)
            {
                //FrameWeb.WebCommon.ExceptionMessage(E);
            }
        }
        /// <summary>
        /// 数据加载
        /// 作者:姚东
        /// 时间:20100925
        /// </summary>
        private void LoadData()
        {
            BLL.Query.IndexQuery query = new BLL.Query.IndexQuery();

            //会员数量
            lblHuiYuanAmount.Text = query.GetHuiYuanAmount().ToString();

            //问卷数量
            lblSurveyAmount.Text = query.GetSurveyAmount().ToString();

            //答卷数量
            lblAnswers.Text = query.GetAnswerAmount().ToString();

            //会员登录
            if (Session["UserGUID"] != null)
            {
                //已经登录的,则自动登录
                divUser.Visible  = true;
                divLogin.Visible = false;

                DataTable dt = new BLL.Query.HuiYuanInfoQuery().GetInfoHuiYuan(Session["UserGUID"].ToString());

                if (dt.Rows.Count > 0)
                {
                    lblHuiYuanName.Text = dt.Rows[0]["Name"].ToString();
                }
            }
            else if (Request.QueryString["U"] != null && Request.QueryString["P"] != null)
            {
                //通过网站跳转过来的,则尝试登录
                string userGuid = Request.QueryString["U"].ToString();
                string passWrd  = Business.Safety.SafetyBusiness.Decrypt(Request.QueryString["P"].ToString(), Business.Const.PageConst.Security.Key);

                HuiYuanEntity entity = new HuiYuanEntity(userGuid);
                if (entity.LoginPWD == passWrd)
                {
                    Session["UserGUID"]       = entity.id;
                    Session["UserIDClient"]   = entity.UserID;
                    Session["HuiYuanAccount"] = entity.LoginAcc;
                    Session["HuiYuanName"]    = entity.Name;
                    lblHuiYuanName.Text       = Session["HuiYuanName"].ToString();

                    Page.ClientScript.RegisterStartupScript(this.GetType(), "redirect",
                                                            "window.parent.location.href='Index.aspx'", true);
                }
            }
            else
            {
                divUser.Visible  = false;
                divLogin.Visible = true;
            }
        }
Example #4
0
        /// <summary>
        /// 信息绑定
        /// 作者:姚东
        /// 时间:20100927
        /// </summary>
        private void BindInfo()
        {
            HuiYuanEntity entity = new HuiYuanEntity(Session["UserGUID"].ToString());

            lblHuiYuanAccount.Text = entity.LoginAcc;
            lblPwd.Text            = "<a href='#' onclick='window.open(\"ModifyPassword.aspx\");'>修改密码</a>";
            txtHuiYuanName.Text    = entity.Name;
            txtEmail.Text          = entity.Email;
            txtMobile.Text         = entity.Tel;

            DataTable dt = new BLL.Query.HuiYuanInfoQuery().GetInfoHuiYuan(Session["UserGUID"].ToString());

            if (dt.Rows.Count > 0)
            {
                lblTotalPoint.Text  = dt.Rows[0]["TotalPoint"].ToString();
                lblRemainPoint.Text = dt.Rows[0]["RemainPoint"].ToString();
            }
        }
        /// <summary>
        /// toolbar事件
        /// 作者:姚东
        /// 时间:20100919
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void toolbar_MenuItemClick(object sender, MenuEventArgs e)
        {
            switch (e.Item.Value)
            {
            case "Delete":
                string HuiYuanID = "";
                int    count     = 0;
                int    num       = 0;
                for (int i = 0; i < grid.Rows.Count; i++)
                {
                    CheckBox chkItem = (CheckBox)grid.Rows[i].FindControl("chkItem");
                    if (chkItem != null && chkItem.Checked == true)
                    {
                        count++;
                        HuiYuanID = grid.DataKeys[i]["ID"].ToString();
                        DataTable dt = new BLL.Query.HuiYuanInfoQuery().GetInfoHuiYuan(HuiYuanID);

                        if (dt.Rows.Count > 0 && dt.Rows[0]["Status"].ToString() == "1")
                        {
                            new BLL.Rule.HuiYuanRule().DelInfoHuiYuan(HuiYuanID);
                        }
                        else
                        {
                            num++;
                            continue;
                        }
                    }
                }
                if (count == this.grid.Rows.Count)
                {
                    viewpage1.CurrentPageIndex = viewpage1.CurrentPageIndex == 1 ? 1 : viewpage1.CurrentPageIndex - 1;
                }
                BindGridView();

                PageHelper.ShowMessage("停用成功!");
                if (num > 0)
                {
                    PageHelper.ShowExceptionMessage("部分(已审核、禁用)信息无法停用!");
                }
                break;

            case "Authorization":
                HuiYuanID = "";
                count     = 0;
                num       = 0;
                for (int i = 0; i < grid.Rows.Count; i++)
                {
                    CheckBox chkItem = (CheckBox)grid.Rows[i].FindControl("chkItem");
                    if (chkItem != null && chkItem.Checked == true)
                    {
                        count++;
                        HuiYuanID = grid.DataKeys[i]["ID"].ToString();
                        DataTable dt = new BLL.Query.HuiYuanInfoQuery().GetInfoHuiYuan(HuiYuanID);

                        if (dt.Rows.Count > 0 && dt.Rows[0]["Status"].ToString() == "0")
                        {
                            new BLL.Rule.HuiYuanRule().StartInfoHuiYuan(HuiYuanID);
                        }
                        else
                        {
                            num++;
                            continue;
                        }
                    }
                }
                if (count == this.grid.Rows.Count)
                {
                    viewpage1.CurrentPageIndex = viewpage1.CurrentPageIndex == 1 ? 1 : viewpage1.CurrentPageIndex - 1;
                }
                BindGridView();

                PageHelper.ShowMessage("启用成功!");
                if (num > 0)
                {
                    PageHelper.ShowExceptionMessage("部分(已审核、禁用)信息无法停用!");
                }
                break;
            }
        }