コード例 #1
0
ファイル: AgShift.aspx.cs プロジェクト: singlag888/NewWeb
 protected void btnSava_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(Request.QueryString["id"]))
     {
         try
         {
             int             agId      = Convert.ToInt32(Request.QueryString["id"]);
             string          agAccount = txtAgentAccount.Text.Trim();
             Model.AgentInfo agentL    = new BLL.AgentInfo().GetModel(agAccount);
             if (agentL == null)
             {
                 Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('亲,转移的代理不存在,请重新输入帐号')</script>");
             }
             else
             {
                 Model.AgentInfo agentinfo = new Model.AgentInfo();
                 agentinfo.HigherLevel = agentL.AgentID;
                 agentinfo.AgentID     = agId;
                 bool result = new BLL.AgentInfo().UpdateHigherLevel(agentinfo);
                 if (result)
                 {
                     Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('转移代理成功')</script>");
                 }
                 else
                 {
                     Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('转移代理失败')</script>");
                 }
             }
         }
         catch (Exception)
         {
             throw;
         }
     }
 }
コード例 #2
0
        public int ClearSession()
        {
            if (Session["Agent"] != null)
            {
                Model.AgentInfo ags = new Model.AgentInfo();

                ags.AgentID     = ((Model.AgentInfo)Session["Agent"]).AgentID;
                ags.OnlineState = 0;
                new BLL.AgentInfo().UpdateONState(ags);
            }
            Session.Clear();


            return(0);
        }
コード例 #3
0
ファイル: AddAgent.aspx.cs プロジェクト: singlag888/NewWeb
        protected void btnSava_Click(object sender, EventArgs e)
        {
            try
            {
                Model.AgentInfo agent = new Model.AgentInfo();
                agent.AgentAccount = txtAgentAccount.Text.Trim();
                agent.AgentName    = txtAgentName.Text;
                agent.AgentPasswd  = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(txtAgentPasswd.Text.Trim(), "MD5");
                agent.AgentQQ      = txtAgentQQ.Text.Trim();
                agent.AgentEmail   = txtAgentEmail.Text.Trim();
                agent.AgentTel     = txtAgentTel.Text;
                agent.RegisterTime = DateTime.Now;
                int OperateType = 0;
                if (base.Session["manager"] != null)
                {
                    agent.HigherLevel = 0;
                    OperateType       = 1;
                }
                else if (base.Session["Agent"] != null)
                {
                    agent.HigherLevel = ((Model.AgentInfo)Session["Agent"]).AgentID;
                    OperateType       = 2;
                }



                agent.JurisdictionID = getQxID();

                agent.RevenueModel = Convert.ToInt32(dropModel.SelectedValue);

                int result = new BLL.AgentInfo().Add(agent);
                if (result > 0)
                {
                    Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('保存成功')</script>");
                }
                else
                {
                    Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('保存失败')</script>");
                }
            }
            catch (Exception ec)
            {
                Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('" + ec.Message + "')</script>");
                throw;
            }
        }
コード例 #4
0
ファイル: UpdateAgent.aspx.cs プロジェクト: singlag888/NewWeb
 protected void btnSava_Click(object sender, EventArgs e)
 {
     try
     {
         if (!string.IsNullOrEmpty(Request.QueryString["id"]))
         {
             int             agId  = Convert.ToInt32(Request.QueryString["id"]);
             Model.AgentInfo agent = new Model.AgentInfo();
             agent.AgentAccount = txtAgentAccount.Text.Trim();
             agent.AgentName    = txtAgentName.Text.Trim();
             if (txtAgentPasswd.Text.Trim() != "")
             {
                 agent.AgentPasswd = txtAgentPasswd.Text.Trim();
             }
             else
             {
                 Model.AgentInfo ag = new BLL.AgentInfo().GetModel(agId);
                 agent.AgentPasswd = ag.AgentPasswd;
             }
             agent.AgentQQ  = txtAgentQQ.Text.Trim();
             agent.AgentTel = txtAgentTel.Text.Trim();
             agent.AgentID  = agId;
             bool result = new BLL.AgentInfo().UpdateAg(agent);
             if (result)
             {
                 Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('保存成功')</script>");
             }
             else
             {
                 Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('保存失败')</script>");
             }
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
コード例 #5
0
ファイル: login.aspx.cs プロジェクト: singlag888/NewWeb
        protected void btnlogin_Click(object sender, EventArgs e)
        {
            Session.Clear();
            string username = Request.Form["username"].ToString();
            string passwd   = Request.Form["password"].ToString();

            string md5pass = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(passwd, "MD5");

            try
            {
                if (dropModel.SelectedValue == "0")
                {
                    Model.ManagerInfo manager = new BLL.ManagerInfo().GetModel(username);
                    if (manager == null || string.IsNullOrEmpty(manager.AdminAccount))
                    {
                        Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('帐号不存在,请重新输入')</script>");
                    }
                    else if (md5pass != manager.AdminPasswd)
                    {
                        Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('密码不正确,请重新输入')</script>");
                    }
                    else
                    {
                        Session["manager"] = manager;

                        AddLog(manager.AdminID, 1, DateTime.Now, "在Ip为:" + Request.UserHostAddress + " 的PC端登录");
                        Response.Redirect("Manage\\Management.aspx");
                    }
                }
                else if (dropModel.SelectedValue == "1")
                {
                    Model.AgentInfo agent = new BLL.AgentInfo().GetModel(username);
                    if (agent == null || string.IsNullOrEmpty(agent.AgentAccount))
                    {
                        Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('帐号不存在,请重新输入')</script>");
                    }
                    else if (md5pass != agent.AgentPasswd)
                    {
                        Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('密码不正确,请重新输入')</script>");
                    }
                    else
                    {
                        Session["Agent"] = agent;

                        Model.AgentInfo agents = new Model.AgentInfo();
                        agents.AgentID     = agent.AgentID;
                        agents.LoginIP     = Request.UserHostAddress;
                        agents.LoginTime   = DateTime.Now;
                        agents.OnlineState = 1;
                        new BLL.AgentInfo().UpdateIPonTime(agents);

                        AddLog(agent.AgentID, 2, DateTime.Now, "在IP为:" + Request.UserHostAddress + " 的PC端登录");
                        Response.Redirect("Manage\\AgentInfo.aspx");
                    }
                }
                else if (dropModel.SelectedValue == "2")
                {
                    Model.CustomerInfo cust = new BLL.CustomerInfo().GetModel(username);
                    if (cust == null || string.IsNullOrEmpty(cust.CustomerAccount))
                    {
                        Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('帐号不存在,请重新输入')</script>");
                    }
                    else if (md5pass != cust.CustomerPwd)
                    {
                        Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('密码不正确,请重新输入')</script>");
                    }
                    else
                    {
                        Session["Cust"] = cust;
                        Model.CustomerInfo Customer = new Model.CustomerInfo();
                        Customer.CustomerState   = 1;
                        Customer.CustomerAccount = cust.CustomerAccount;
                        new BLL.CustomerInfo().UpdateState(Customer);
                        Response.Redirect("Manage\\OnlineProblem.aspx");
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }