コード例 #1
0
        /// <summary>
        /// btnLogin_Click
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            try
            {
                string userName = txtUserName.Text;
                string password = txtPassword.Text;

                if (!string.IsNullOrEmpty(userName) && !string.IsNullOrEmpty(password))
                {
                    DataTable dt = new DataDAL().UserLogin(userName, password);

                    if (dt.Rows.Count > 0)
                    {
                        Session["UserID"]   = dt.Rows[0].Field <int>("UserID");
                        Session["UserName"] = userName;


                        Response.Redirect("DashBoard.aspx", false);
                    }
                    else
                    {
                        lblMessage.Visible = true;
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionLogging.SaveException(ex);
            }
        }
コード例 #2
0
 /// <summary>
 /// BindGrid
 /// </summary>
 private void BindGrid()
 {
     try
     {
         DataTable dt = new DataDAL().GetDepartmentsUsers();
         gdDepartmentUsers.DataSource = dt;
         gdDepartmentUsers.DataBind();
     }
     catch (Exception ex)
     {
         ExceptionLogging.SaveException(ex);
     }
 }
コード例 #3
0
        /// <summary>
        /// BindDepartment
        /// </summary>
        private void BindDepartment()
        {
            try
            {
                DataTable dt = new DataDAL().GetDepartments();
                ddlDepartment.DataSource = dt;

                ddlDepartment.DataTextField  = "DepartmentName";
                ddlDepartment.DataValueField = "DepartmentID";
                ddlDepartment.DataBind();

                ddlDepartment.Items.Insert(0, "Select");
            }
            catch (Exception ex)
            {
                ExceptionLogging.SaveException(ex);
            }
        }
コード例 #4
0
        /// <summary>
        /// GetUserDetails
        /// </summary>
        /// <param name="id"></param>
        private void GetUserDetails(string id)
        {
            try
            {
                DataTable dt = new DataDAL().GetUserDetails(Convert.ToInt32(id));

                if (dt.Rows.Count > 0)
                {
                    string departmentID = dt.Rows[0].Field <int>("DepartmentID").ToString();
                    txtName.Text = dt.Rows[0].Field <string>("Name").ToString();

                    ddlDepartment.SelectedValue = departmentID;
                }
            }
            catch (Exception ex)
            {
                ExceptionLogging.SaveException(ex);
            }
        }