示例#1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["user"] != null)
     {
         DBHelper db = new DBHelper(AgentUtileries.dbcstring);
         CurrentUser = (AUser)Session["user"];
         CurrentUser = db.GetUser(CurrentUser.ID);
         Session["user"] = CurrentUser;
         Projects = db.GetProjects(CurrentUser.ID);
         Page.Title = CurrentUser.Name;
     }
 }
示例#2
0
 protected void BLogin_Click(object sender, EventArgs e)
 {
     string email = TBEmail.Text,
         password = TBPassword.Text;
     DBHelper db = new DBHelper(AgentUtileries.dbcstring);
     int id = db.Authenticate(email, password);
     if (id > 0)
     {
         AUser user = db.GetUser(id);
         Session["user"] = user;
         Response.Redirect("~/Default.aspx");
     }
     else
     {
         Response.Redirect("~/User/Login.aspx");
     }
 }
示例#3
0
        public XElement Authenticate(string email, string password)
        {
            XElement x = new XElement("users");

            DBHelper db = new DBHelper(AgentUtileries.dbcstring);
            int result = db.Authenticate(email, password);
            if (result > 0)
            {
                AUser user = db.GetUser(result);
                XElement xuser = new XElement("user");
                xuser.Add(new XElement("ID", user.ID));
                xuser.Add(new XElement("Email", user.Email));
                xuser.Add(new XElement("Name", user.Name));
                x.Add(xuser);
            }

            return x;
        }
示例#4
0
        public XElement UpdateUser(int userid, string name)
        {
            XElement x = new XElement("users");

            DBHelper db = new DBHelper(AgentUtileries.dbcstring);
            db.UpdateName(userid, name);

            AUser user = db.GetUser(userid);
            if (user != null)
            {
                XElement xuser = new XElement("user");
                xuser.Add(new XElement("ID", user.ID));
                xuser.Add(new XElement("Email", user.Email));
                xuser.Add(new XElement("Name", user.Name));
                x.Add(xuser);
            }

            return x;
        }