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();
        }
Exemple #2
0
        public void GetAbsent()
        {
            String ConnString = ConfigurationManager.ConnectionStrings["PayrollConn"].ConnectionString;


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


            try
            {
                int Presents      = 0;
                int TotalSunday   = Calculate.GetSunday(MonthYear.Value);
                int NumberOfDays  = Calculate.GetTotalDaysOfMonth(MonthYear.Value);
                int Totalpresents = 0;
                using (conn)
                {
                    //Statuslabel
                    sql = "SP_getEmployeePresent";
                    SqlCommand cmd1 = new SqlCommand(sql, conn);
                    cmd1.CommandType = CommandType.StoredProcedure;
                    cmd1.Parameters.Add("@ID", SqlDbType.VarChar).Value    = IDTB.Text;
                    cmd1.Parameters.Add("@Month", SqlDbType.VarChar).Value = MonthSelected;
                    cmd1.Parameters.Add("@Year", SqlDbType.VarChar).Value  = YearSelected;
                    conn.Open();
                    reader = cmd1.ExecuteReader();
                    reader.Read();
                    if (reader.HasRows)
                    {
                        // MessageBox.Show(reader[0].ToString());
                        // AbsenceTextBox.Text
                        Presents = int.Parse(reader[0].ToString());
                    }
                }
                //MessageBox.Show("Presents " + Presents);
                //MessageBox.Show("TotalSunday " + TotalSunday);
                //MessageBox.Show("Hollydays " + Hollydays);
                Totalpresents = (Presents + TotalSunday + Hollydays);
                //MessageBox.Show("Totalpresents " + Totalpresents);
                //MessageBox.Show("NumberOfDays " + NumberOfDays);
                int Absence = NumberOfDays - Totalpresents;
                //MessageBox.Show("Absence " + Absence);
                if (Totalpresents < NumberOfDays)
                {
                    AbsenceTextBox.Text = Absence.ToString();
                    //  AtdDec = int.Parse(AbsenceTextBox.Text);
                }
            }
            catch (Exception)
            {
                //  MessageBox.Show(ex.Message);
            }
        }
Exemple #3
0
        public void GetPresentByDr()
        {
            String ConnString = ConfigurationManager.ConnectionStrings["PayrollConn"].ConnectionString;


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


            try
            {
                int Presents = 0;

                int TotalSunday   = Calculate.GetSunday(StartTimePicker.Value);
                int NumberOfDays  = Calculate.GetTotalDaysOfMonth(StartTimePicker.Value);
                int Totalpresents = 0;
                using (conn)
                {
                    //Statuslabel
                    sql = "SP_getEmployeePresentBydr";
                    SqlCommand cmd1 = new SqlCommand(sql, conn);
                    cmd1.CommandType = CommandType.StoredProcedure;
                    cmd1.Parameters.Add("@ID", SqlDbType.VarChar).Value = IDTB.Text;
                    cmd1.Parameters.AddWithValue("@StartDate", StartTimePicker.Value);
                    cmd1.Parameters.AddWithValue("@EndDate", EndTimePicker.Value);


                    conn.Open();
                    reader = cmd1.ExecuteReader();
                    reader.Read();
                    if (reader.HasRows)
                    {
                        //     MessageBox.Show(reader[0].ToString());
                        Presentlabel.Text = reader[0].ToString();
                        Presents          = int.Parse(reader[0].ToString());
                    }
                    else
                    {
                        MessageBox.Show("It Does Not Exist", "Emply", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                GetHollydayByDr();
                Totalpresents = (Presents + TotalSunday + Hollydays);
                int Absence = NumberOfDays - Totalpresents;
                if (Totalpresents < NumberOfDays)
                {
                    if (Presents > 0)
                    {
                        Absencelabel.Text = Absence.ToString();
                    }
                    else
                    {
                        Absencelabel.Text = "0";
                    }
                }
                if (Absence == 0)
                {
                    Absencelabel.Text = "0";
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }