private void makeAttendance()
        {
            conn = new conDB();
            int count = (int)conn.dataReaderScalar("select count(AtID) from Attendance where Date = '" + datetime + "' ");

            //MessageBox.Show(count.ToString());

            if (count == 0)
            {
                int x = (int)conn.dataReaderScalar("select count(EmpID) from Employee where MarkedStatus='on' ");
                //MessageBox.Show(x.ToString());
                SqlDataReader dr = conn.dataReader("select EmpID from Employee where MarkedStatus='on' ");

                for (int i = 0; i < x; i++)
                {
                    while (dr.Read())
                    {
                        IDvalues = dr[0].ToString();
                        //MessageBox.Show(IDvalues);
                        conn = new conDB();
                        conn.executeQry("INSERT INTO Attendance (Date,EmpID) VALUES ('" + datetime + "','" + IDvalues + "') ");
                    }
                }
            }

            conn.closeConnection();
        }
        private void lblSetAtt_MouseClick(object sender, MouseEventArgs e)
        {
            string datetime = DateTime.Now.ToString();

            for (int i = 0; i < bunifuCustomDataGrid1.Rows.Count; i++)
            {
                String status = (String)bunifuCustomDataGrid1.Rows[i].Cells[0].Value;
                MessageBox.Show(status);

                String EmpID = bunifuCustomDataGrid1.Rows[i].Cells[1].Value.ToString();
                MessageBox.Show(EmpID);

                String leavestatus = (String)bunifuCustomDataGrid1.Rows[i].Cells[0].Value;
                //MessageBox.Show(leavestatus);

                try
                {
                    if (leavestatus != null)
                    {
                        conn = new conDB();
                        conn.executeQry("update Attendance set LeaveStates='" + status + "',LeaveTime='" + datetime + "' where EmpID='" + EmpID + "' and Date ='" + datetime + "' ");

                        MessageBox.Show("Successful");
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }

            tableLoad();
        }
Esempio n. 3
0
        private void lblSet_MouseClick(object sender, MouseEventArgs e)
        {
            for (int i = 0; i < bunifuCustomDataGrid1.Rows.Count; i++)
            {
                try
                {
                    conn = new conDB();

                    String status = (String)bunifuCustomDataGrid1.Rows[i].Cells[0].Value;
                    //MessageBox.Show(status);

                    String EmpID = bunifuCustomDataGrid1.Rows[i].Cells[1].Value.ToString();
                    //MessageBox.Show(EmpID);

                    if (status == "Present")
                    {
                        conn.executeQry("update Attendance set ArivalTime='" + datetime
                                        + "', AttendanceStatus='Present' where EmpID='" + EmpID + "' and Date='" + datetime + "' ");
                    }
                    else if (status == "Absent")
                    {
                        conn.executeQry("update Attendance set AttendanceStatus='Absent' where EmpID='" + EmpID + "' and Date='" + datetime + "' ");
                    }
                    else
                    {
                        conn.executeQry("update Attendance set AttendanceStatus='Waiting' where EmpID='" + EmpID + "' and Date='" + datetime + "' ");
                    }

                    MessageBox.Show("Successful");
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }

            TableLoad();
        }
Esempio n. 4
0
        private void lblSubmit_MouseClick(object sender, MouseEventArgs e)
        {
            if (txtNIC.Text == "" || dropdPos.Text == "" || txtfName.Text == "" || txtlName.Text == "" || datetimeBD.Text == "" || txtAddressNo.Text == "" || txtAddressCity.Text == "" || txtAddressStreet.Text == "" || txtTele.Text == "" || txtEmail.Text == "" || photoBox.Image == null)
            {
                MessageBox.Show("Please Fill all the Details");
            }
            else
            {
                try
                {
                    //validatenow();

                    //MessageBox.Show(lblID.Text);
                    string query = ("update Employee set EmpNIC = '" + txtNIC.Text
                                    + "', EmpfName = '" + txtfName.Text
                                    + "', EmplName = '" + txtlName.Text
                                    + "', Position = '" + dropdPos.Text.ToString()
                                    + "', DOB = '" + datetimeBD.Value.ToString()
                                    + "', Email = '" + txtEmail.Text
                                    + "', ContactNo = '" + txtTele.Text
                                    + "', No = '" + txtAddressNo.Text
                                    + "', Street = '" + txtAddressStreet.Text
                                    + "', City = '" + txtAddressCity.Text
                                    + "', Photo = '" + realname
                                    + "' where EmpID = '" + lblID.Text.ToString() + "' ");

                    int h = conn.executeQry(query);
                    if (h == 1)
                    {
                        System.IO.File.Copy(FileName, @"C:\Users\House MoNaRa\Documents\Visual Studio 2015\Projects\EmployeeM\EmployeeM\Images\" + realname);
                    }

                    conn.closeConnection();

                    mntForm hh = ((mntForm)container);
                    hh.Enabled = true;
                    hh.tbl.loadFirstPage();

                    resetData();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }
Esempio n. 5
0
        private void lblSubmit_MouseClick(object sender, MouseEventArgs e)
        {
            if (txtNIC.Text == "" || dropdPos.Text == "" || txtfName.Text == "" || txtlName.Text == "" || datetimeBD.Text == "" || txtAddressNo.Text == "" || txtAddressCity.Text == "" || txtAddressStreet.Text == "" || txtTele.Text == "" || txtEmail.Text == "" || photoBox.Image == null)
            {
                MessageBox.Show("Please Fill all the Details");
            }
            else
            {
                try
                {
                    //validatenow();

                    System.IO.File.Copy(FileName, @"C:\Users\House MoNaRa\Documents\Visual Studio 2015\Projects\EmployeeM\EmployeeM\Images\" + realname);

                    string query = "insert into Employee (EmpNIC,EmpfName,EmplName,JoinDate,Position,DOB,Email,No,Street,City,Photo,ContactNo) values ('"
                                   + txtNIC.Text + "','" + txtfName.Text + "','" + txtlName.Text + "','" + DateTime.Now + "','" + dropdPos.Text.ToString() + "','"
                                   + datetimeBD.Value.ToString() + "','" + txtEmail.Text + "','" + txtAddressNo.Text + "','" + txtAddressStreet.Text + "','"
                                   + txtAddressCity.Text + "','" + realname + "','" + txtTele.Text + "')";


                    conn.executeQry(query);

                    conn.closeConnection();

                    resetData();
                    mntForm hh = ((mntForm)container);
                    hh.Enabled = true;
                    hh.tbl.loadFirstPage();
                    hh.tbl.QuickGo();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }