Esempio n. 1
0
        private void employeeAttendanceToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmEmployeeAttendanceEntry frm = new frmEmployeeAttendanceEntry();

            frm.lblUser.Text = User.Text;
            con = new SqlConnection(cs.DBcon);
            con.Open();
            cmd             = con.CreateCommand();
            cmd.CommandText = "SELECT RTRIM(Saves),RTRIM(Getdata)  from UserGrants inner join Users on UserGrants.UserId=Users.ID where Forms='Employee Attendance' and Users.UserID='" + User.Text + "' ";
            rdr             = cmd.ExecuteReader();
            if (rdr.Read())
            {
                frm.lblsave.Text    = rdr[0].ToString().Trim();
                frm.lblgetdata.Text = rdr[1].ToString().Trim();
            }
            if ((rdr != null))
            {
                rdr.Close();
            }
            if (con.State == ConnectionState.Open)
            {
                con.Close();
            }

            if (frm.lblsave.Text == "True")
            {
                frm.btnSave.Enabled = true;
            }
            else
            {
                frm.btnSave.Enabled = false;
            }

            if (frm.lblgetdata.Text == "True")
            {
                frm.btnGetData.Enabled = true;
            }
            else
            {
                frm.btnGetData.Enabled = false;
            }
            frm.ShowDialog();
        }