示例#1
0
        // Insert data to database and load that data to gridview
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                //Customersql obj = new Customersql();

                UsersEntity entity = new UsersEntity();
                if (hdnUserID.Value != string.Empty)
                     entity.UserID = Convert.ToInt32(hdnUserID.Value);
                entity.FirstName = txtFirstName.Text;
                entity.LastName = txtLastName.Text;
                entity.PhoneNo = txtPhoneNumber.Text;
                entity.Email = txtEmail.Text;
                entity.EmpID = txtEmpID.Text;
                entity.UserName = txtUserName.Text;
                entity.Password = txtPassword.Text;
                entity.UserType = ddlUseType.SelectedValue;

                UsersBI users = new UsersBI();
                //if (hdnUserID.Value == string.Empty)
                //{
                users.Insert(entity);
                //}
                //else
                //{
                //    users.Update(entity);
                //}
                LoadUsers();
                ClearData();
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message.ToString());
            }
        }
示例#2
0
        private void BindApprovers()
        {
            List<UsersEntity> list = new UsersBI().GetApproverList();

            BindDropDown(list, ddlAgreementReviewer);
            BindDropDown(list, ddlBusinessTypeApprover);
            BindDropDown(list, ddlLawyerApprover);
            BindDropDown(list, ddlOtherApprover);
        }
示例#3
0
        protected void btnSignin_Click(object sender, EventArgs e)
        {
            UsersEntity entity = new UsersEntity();
            entity.UserName = txtUserName.Text;
            entity.Password = txtPassword.Text;

            UsersBI usersBI = new UsersBI();
            entity = usersBI.ReadUsers(entity);
            if (entity != null)
            {
                SessionManager.UsersID = entity.UserID;
                SessionManager.UsersEntity = entity;
                Response.Redirect("Home.aspx");
            }
            else
            {
                ClientScript.RegisterStartupScript(Page.GetType(), "_Login_", "alert('Invalid Username and Password.');", true);
            }
        }
示例#4
0
        //Occurs when a button is clicked in a GridView control.
        protected void dtgUsers_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "E")
            {
                DisplayUser(Convert.ToInt32(e.CommandArgument));//Convert the row index stored in the CommandArgument property to an Integer and call the function displayusers.
                // disable validators
                valReqConfirmPassword.Enabled = false;
                valReqPassword.Enabled = false;
                valComparePassword.Enabled = false;
            }
            else if (e.CommandName == "D")
            {

                UsersBI users = new UsersBI();
                users.Delete(Convert.ToInt32(e.CommandArgument));
                LoadUsers();
            }
        }
示例#5
0
        //load all the data to gridview
        private void LoadUsers()
        {
            UsersBI users = new UsersBI();
            List<UsersEntity> list = users.ReadList();

            dtgUsers.DataSource = list;
            dtgUsers.DataBind();//to bind datasource to Gridview control
        }
示例#6
0
        //display data from gridview to relevant controls
        private void DisplayUser(int UserID)
        {
            UsersBI users = new UsersBI();
            UsersEntity entity = users.Read(UserID);
            hdnUserID.Value = UserID.ToString();
            //select the records and display it on the screen
            txtFirstName.Text = entity.FirstName;
            txtLastName.Text = entity.LastName;
            txtPhoneNumber.Text = entity.PhoneNo;
            txtEmail.Text = entity.Email;
            txtEmpID.Text = entity.EmpID;
            //if (hdnUserID.Value == string.Empty)
            //{
                txtUserName.Text = entity.UserName;
                txtPassword.Text = entity.Password;
            //}
            //else
            //{
            //    idPassword.Disabled = true;
            //    idConfirmPassword.Disabled = true;

            //}
            ddlUseType.SelectedValue = entity.UserType;
        }