protected void LOGINbtn_Click(object sender, EventArgs e)
 {
     if (txtusrname.Text != string.Empty && txtpass.Text != string.Empty)
     {
         Userbll bll  = new Userbll();
         int     flag = bll.isvalidsignin(txtusrname.Text, txtpass.Text);
         if (flag == 1)
         {
             Session["User"] = txtusrname.Text;
             string uname = Session["User"].ToString();
             bll.calculatepenaltyprice(uname);
             Response.Redirect("al/Home.aspx");
         }
         else if (flag == 0)
         {
             errorlabel.Text    = "Invalid Username or Password";
             errorlabel.Visible = true;
         }
     }
     else
     {
         errorlabel.Text    = "No Field can be Empty ";
         errorlabel.Visible = true;
     }
 }
        public void showData()
        {
            var user = Userbll.Search(pageIndex, pageSize, sortBy, sortOrder, keyword);

            dgUsers.ItemsSource = user.Items;
            pageCount           = user.PageCount;
        }
Example #3
0
        protected void loginbtn_Click(object sender, EventArgs e)
        {
            Userbll user = new Userbll();

            bool   UserValidate;
            string Email    = loginEmail.Text;
            string Password = loginPassword.Text;

            try
            {
                UserValidate = user.ValidateUser(Email, Password);
                if (UserValidate == true)
                {
                    userloggedNode.InnerText = "true";
                    userEmailNode.InnerText  = Email;

                    if (Email == "*****@*****.**")
                    {
                        adminNode.InnerText = "true";
                    }
                    //save xml
                    xmlDoc.Save(Server.MapPath("ProductUpdate.xml"));
                    Response.Redirect(Request.RawUrl);
                }
                else
                {
                    Response.Write("<script>alert('Wrong Email and/or Password')</script>");
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        protected void Regbtn_Click(object sender, EventArgs e)
        {
            if (txtFName.Text != string.Empty && txtlname.Text != string.Empty && txtPassword.Text != string.Empty && txtusername.Text != string.Empty && txtemail.Text != string.Empty && txtdob.Text != string.Empty)
            {
                Userbll bll    = new Userbll();
                string  gender = null;
                if (rdMale.Checked == true)
                {
                    gender = "Male";
                }
                else if (rdFemale.Checked == true)
                {
                    gender = "Female";
                }
                bool check = bll.isvalidsignup(txtFName.Text, txtlname.Text, txtusername.Text, txtPassword.Text, txtdob.Text, txtemail.Text, gender);

                if (check == true)
                {
                    Response.Redirect("WebForm1.aspx");
                }
                else
                {
                    errorlabel.Text    = "Username already Exists";
                    errorlabel.Visible = true;
                }
            }
            else
            {
                errorlabel.Text    = "No field can be left empty";
                errorlabel.Visible = true;
            }
        }
Example #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Userbll bl = new Userbll();
            if (Session["User"] == null)
            {
                Response.Redirect("../Login.aspx");
            }
            else
            {
                string username = Session["User"].ToString();
                if (bl.gethistorybooks(username) != null)
                {
                    datalis1.DataSource = bl.gethistorybooks(username);
                    datalis1.DataBind();
                }
                                
            }

        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Userbll bl = new Userbll();

            if (Session["User"] == null)
            {
                Response.Redirect("../Login.aspx");
            }
            else
            {
                string uname = Session["User"].ToString();
                int    val   = bl.getpenaltyprice(uname);
                if (val > 0)
                {
                    penalty.CssClass = "alert alert-danger";
                    penalty.Text     = "Please Pay the Following Dues : " + val.ToString();
                }
            }
        }
Example #7
0
        private void BtnLogin_Click(object sender, RoutedEventArgs e)
        {
            lblError.Content = "";

            if (string.IsNullOrEmpty(txtEmailAddress.Text))
            {
                lblError.Content = "Invalid Login";
                return;
            }
            ;

            if (string.IsNullOrEmpty(txtPassword.Text))
            {
                lblError.Content = "Invalid Login";
                return;
            }
            ;


            var op = Userbll.Login(txtEmailAddress.Text, txtPassword.Text);

            if (op.Code == "200")
            {
                var users = Userbll.GetById(op.ReferenceId);
                var roles = Userbll.GetRoles(op.ReferenceId);

                ProgramUser.Id           = op.ReferenceId;
                ProgramUser.FirstName    = users.FirstName;
                ProgramUser.LastName     = users.LastName;
                ProgramUser.EmailAddress = users.Email;
                ProgramUser.Roles        = roles;

                Users.List userList = new Users.List();
                userList.Show();
                this.Close();
            }
            else
            {
                lblError.Content = "Invalid Login";
            }
        }
        private void btnDeactivate_Click(object sender, RoutedEventArgs e)
        {
            UserDTO userDto = ((FrameworkElement)sender).DataContext as UserDTO;

            if (MessageBox.Show("Are you sure you want to deactivate " + userDto.FirstName + " " + userDto.Email + "?",
                                "Are you sure?", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
            {
                var op = Userbll.Deactivate(userDto.UserID);

                if (op.Code != "200")
                {
                    MessageBox.Show("Error : " + op.Message);
                }
                else
                {
                    MessageBox.Show("User is successfully deactivated from table");
                    showData();
                }
            }
            ;
        }
Example #9
0
 protected void adLOGINbtn_Click(object sender, EventArgs e)
 {
     if (txtusrname.Text != string.Empty && txtpass.Text != string.Empty)
     {
         Userbll bll  = new Userbll();
         int     flag = bll.isvalidadmnlogin(txtusrname.Text, txtpass.Text);
         if (flag == 1)
         {
             Session["Admin"] = txtusrname.Text;
             Response.Redirect("AdminofLib/adhomlib.aspx");
         }
         else if (flag == 0)
         {
             errorlabel.Text    = "Invalid Username or Password";
             errorlabel.Visible = true;
         }
     }
     else
     {
         errorlabel.Text    = "No Field can be Empty ";
         errorlabel.Visible = true;
     }
 }
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            List <string> errors = new List <string>();

            if (string.IsNullOrEmpty(txtFirstName.Text))
            {
                errors.Add("FirstName is required.");
            }
            ;

            if (string.IsNullOrEmpty(txtLastName.Text))
            {
                errors.Add("LastName is required.");
            }
            ;

            if (string.IsNullOrEmpty(txtAddress.Text))
            {
                errors.Add("Address is required.");
            }
            ;

            if (string.IsNullOrEmpty(txtSex.Text))
            {
                errors.Add("Sex is required.");
            }
            ;

            if (string.IsNullOrEmpty(txtContactNumber.Text))
            {
                errors.Add("Contact-Number is required.");
            }
            ;

            if (string.IsNullOrEmpty(txtEmail.Text))
            {
                errors.Add("Email is required.");
            }
            ;

            if (string.IsNullOrEmpty(txtPassword.Text))
            {
                errors.Add("Password is required.");
            }
            ;

            if (errors.Count > 0)
            {
                foreach (var error in errors)
                {
                    txtError.Text = txtError.Text + error + "\n";
                }

                return;
            }


            var op = Userbll.Add(new User()
            {
                UserID        = Guid.NewGuid(),
                FirstName     = txtFirstName.Text,
                LastName      = txtLastName.Text,
                Address       = txtAddress.Text,
                Sex           = txtSex.Text,
                ContactNumber = txtContactNumber.Text,
                Email         = txtEmail.Text,
                Password      = txtPassword.Text
            });

            if (op.Code != "200")
            {
                MessageBox.Show("Error : " + op.Message);
            }

            else
            {
                MessageBox.Show(" is successfully added to table");
            }

            this.Close();
        }
Example #11
0
        protected void regButton_Click(object sender, EventArgs e)
        {
            try
            {
                //Validate User Code
                if (txtfName.Text == "")
                {
                    fNameErr.InnerHtml = "<i style='color:red;'>Please Enter your First Name</i>";
                    txtfName.Focus();
                }
                else if (txtlName.Text == "")
                {
                    lNameErr.InnerHtml = "<i style='color:red;'>Please Enter your Last Name</i>";
                    txtlName.Focus();
                }
                else if (txtEmail.Text == "")
                {
                    EmailErr.InnerHtml = "<i style='color:red;'>Please Enter your Email</i>";
                    txtEmail.Focus();
                }
                else if (txtPassword.Text == "")
                {
                    PasswordErr.InnerHtml = "<i style='color:red;'>Please Enter a Password</i>";
                    txtPassword.Focus();
                }
                else if (txtRePassword.Text == "")
                {
                    rePasswordErr.InnerHtml = "<i style='color:red;'>Please Re-Enter your Password</i>";
                    txtRePassword.Focus();
                }
                else if (txtPassword.Text != txtRePassword.Text)
                {
                    Response.Write("<script>alert('Your Passwords do not match');</script>");
                    txtPassword.Focus();
                }

                else if (txtContNo.Text == "")
                {
                    cNoErr.InnerHtml = "<i style='color:red;'>Please Enter your Contact Number</i>";
                    txtContNo.Focus();
                }
                else
                {
                    //Save User Code
                    Userbll oUBll = new Userbll();
                    User    oUser = new User();
                    //initialization for checking duplicate emails
                    string Email = txtEmail.Text;
                    bool   CheckEmail;
                    CheckEmail = oUBll.EmailCheck(Email);

                    //If the email already exist then display message to enter different email
                    if (CheckEmail == false)
                    {
                        Response.Write("<script>alert('The Email address already exists!');</script>");
                        txtEmail.Focus();
                    }
                    else
                    {
                        oUser.FirstName  = txtfName.Text;
                        oUser.LastName   = txtlName.Text;
                        oUser.Email      = txtEmail.Text;
                        oUser.Password   = txtPassword.Text;
                        oUser.Contact    = int.Parse(txtContNo.Text);
                        oUser.LocationID = Convert.ToInt32(drlocation.SelectedValue);
                        bool confirm = oUBll.SaveUser(oUser);
                        Response.Write("User Registered Successfully");
                    }
                }
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message.ToString());
            }
        }