コード例 #1
0
        public void SearchAtt()
        {
            try
            {
                String ConnString = ConfigurationManager.ConnectionStrings["PayrollConn"].ConnectionString;

                SqlConnection conn = new SqlConnection(ConnString);


                using (conn)
                {
                    SqlCommand cmds = new SqlCommand("SP_getEmployeeAttendance", conn);
                    cmds.CommandType = CommandType.StoredProcedure;

                    cmds.Parameters.Add("@ID", SqlDbType.VarChar).Value = IDTB.Text;
                    cmds.Parameters.AddWithValue("@Month", GetSelected.Month(DT.Month));
                    cmds.Parameters.AddWithValue("@Year", DT.Year);
                    SqlDataAdapter sda = new SqlDataAdapter(cmds);
                    DataTable      dt  = new DataTable();

                    sda.Fill(dt);
                    ViewdataGridView.DataSource = dt;
                    GetData = dt;
                }


                MyConnectionMethods.NoDayUpdate();
            }
            catch (Exception)
            {
            }
        }
コード例 #2
0
        private void ViewdataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            String ConnString = ConfigurationManager.ConnectionStrings["PayrollConn"].ConnectionString;

            SqlConnection Conn = new SqlConnection(ConnString);

            try
            {
                String     ID  = ViewdataGridView[2, e.RowIndex].Value.ToString();
                SqlCommand cmd = new SqlCommand("SP_EmployeeExitTime", Conn);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@Emp_ID", ID);
                cmd.Parameters.AddWithValue("@ExitTime", DateTime.Now.ToString());



                Conn.Open();
                cmd.ExecuteNonQuery();
                ViewdataGridView[0, e.RowIndex].Value = "Exit";
                MyConnectionMethods.NoDayUpdate();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                Conn.Close();
            }
        }
コード例 #3
0
        private void GetWorkingorprDays()
        {
            int NumberOfDays = Calculate.GetTotalDaysOfMonth(MonthYear.Value);
            int TotalSunday  = Calculate.GetSunday(MonthYear.Value);

            GetHollyday();
            Official_Working_Days = (NumberOfDays - (Hollydays + TotalSunday)).ToString();
            Total_Hours           = (int.Parse(MyConnectionMethods.GetTotalHr()) * int.Parse(Official_Working_Days)).ToString();
        }
コード例 #4
0
        private void AttendanceForm_Load(object sender, EventArgs e)
        {
            MyConnectionMethods.NoDayUpdate();
            StartTimePicker.Value = DateTime.Now;
            EndTimePicker.Value   = DateTime.Now;
            if (EmployeeID != "")
            {
                IDTB.Text = EmployeeID;

                groupBox2.Hide();
            }
            SearchAtt();
        }
コード例 #5
0
        public void GetOvertimeHours()
        {
            String ConnString = ConfigurationManager.ConnectionStrings["PayrollConn"].ConnectionString;


            SqlConnection conn = new SqlConnection(ConnString);
            SqlDataReader reader;
            String        sql;

            try
            {
                using (conn)
                {
                    //Statuslabel
                    sql = "GetOvertimeHours";
                    SqlCommand cmd1 = new SqlCommand(sql, conn);
                    cmd1.CommandType = CommandType.StoredProcedure;
                    cmd1.Parameters.AddWithValue("@ID", IDTB.Text);
                    cmd1.Parameters.AddWithValue("@Month", MonthSelected);
                    cmd1.Parameters.AddWithValue("@Year", YearSelected);
                    cmd1.Parameters.AddWithValue("@OnTime", MyConnectionMethods.GetTotalHr());
                    conn.Open();
                    reader = cmd1.ExecuteReader();
                    reader.Read();
                    if (reader.HasRows)
                    {
                        //  MessageBox.Show(reader[0].ToString());
                        if (reader[0].ToString() != "")
                        {
                            OverTimeHrtextBox.Text = reader[0].ToString();
                            OvertimeHours          = int.Parse(OverTimeHrtextBox.Text);
                        }
                        //  OvertimeHours = int.Parse(OverTimeHrtextBox.Text);
                    }
                    else
                    {
                        OverTimeHrtextBox.Text = "No OverTime";
                    }
                }
            }
            catch (Exception)
            {
            }
        }
コード例 #6
0
 private void EmployeeExitFormRec_Load(object sender, EventArgs e)
 {
     MyConnectionMethods.NoDayUpdate();
     SearchEmp();
 }