protected void btnSubmit_Click(object sender, EventArgs e) { if (CheckFields()) { LoginCls LogObj = new LoginCls(txtUserName.Text, txtPwd.Text); switch (LogObj.CheckLogin("admin")) { case users.Anonymous: ShowMessage(Message.Error, "Invalid Username Or Password."); break; case users.Admin: Session.Add("_di09ADM", LogObj.AInfo); Response.Redirect(GetPath(LogObj.ProfilePage), true); break; default: break; } } else { ShowMessage(Message.Error, "Fill all required fields."); } }
protected void btnSubmit_Click(object sender, EventArgs e) { if (CheckFields()) { LoginCls LogObj = new LoginCls(txtUserName.Text, txtPwd.Text); switch (LogObj.CheckLogin("user")) { case users.Anonymous: ShowMessage(Message.Error, "Invalid Username Or Password."); break; case users.User: Session.Add("_di09USR", LogObj.UInfo); Response.Redirect(GetPath(LogObj.ProfilePage), true); //if (hiddenSource.Value != "" && File.Exists(Server.MapPath(hiddenSource.Value))) //{ // Response.Redirect(hiddenSource.Value, true); //} //else //{ // Response.Redirect(LogObj.ProfilePage, true); //} break; default: break; } } else { ShowMessage(Message.Error, "Fill all required fields."); } }
public void RegisterUser() { if (CheckPage()) { User UserObj = new User(); UserObj.Email = txtEmail.Text; UserObj.Password = txtPwd.Text; UserObj.Image = USER_INIT_PATH; if (!UserObj.CheckUser()) { if (UserObj.RegUser()) { //userInfo uInfo = new userInfo(); //uInfo.UserId = UserObj.UserId; //uInfo.UserName = getUserName(UserObj.Email); //Session.Add("_di09USR", uInfo); //Response.Redirect("~/home.aspx", true); LoginCls LogObj = new LoginCls(UserObj.Email, UserObj.GetPassword); switch (LogObj.CheckLogin("user")) { case users.Anonymous: ShowMessage(Message.Error, "Invalid Username Or Password."); break; case users.User: Session.Add("_di09USR", LogObj.UInfo); Response.Redirect(LogObj.ProfilePage, true); break; default: break; } } else { ShowMessage(Message.Error, "Unable To Register."); } } else { ShowMessage(Message.Warning, "Email Already Exists."); } } else { ShowMessage(Message.Error, "Fill all fields."); } }