protected void btnGetAllEmployess_Click(object sender, EventArgs e) { ManageEmployees objManageEmployees = new ManageEmployees(); grdEmployee.DataSource = objManageEmployees.GetEmployeesByDepartment(Int32.Parse(ddlDepartment.SelectedValue.ToString())); grdEmployee.DataBind(); }
protected void btn_report_Click(object sender, EventArgs e) { btnExport.Visible = true; ManageReports objManageReports = new ManageReports(); TimeSpan relaxationTime = new TimeSpan(); relaxationTime = TimeSpan.Parse(ddlRelaxation.SelectedValue.ToString()); int EmployeeId = 0; //Int32.TryParse(txtEmployeeId.Text, out EmployeeId); ManageEmployees objEmployee = new ManageEmployees(); lstEmployees = objEmployee.GetAllEmployees(); EmployeeId = lstEmployees.Where(y => y.Name == txtEmployeeId.Text).Select(x => x.Id).FirstOrDefault(); DateTime StartDate = DateTime.Parse(txtStartDate.Text); DateTime EndDate = DateTime.Parse(txtEndDate.Text); MonthlyReportOfEmployee objMonthlyReportOfEmployee = new MonthlyReportOfEmployee(); var data = objManageReports.GetMonthlyAttendanceDetailedReport(EmployeeId, StartDate,EndDate, relaxationTime, out objMonthlyReportOfEmployee); grid_monthly_attendanceBasic.DataSource = data; grid_monthly_attendanceBasic.DataBind(); if (data.Count != 0) { lblName.Text = "Name : " + data[0].Name; lblDepartment.Text = "Department : " + data[0].DepartmentName; } else { lblName.Text = "No Data"; } lblTotalDuration.Text = "TotalDuration : " + objMonthlyReportOfEmployee.TotalDuration.ToString(); lblPresentDays.Text = "PresentDays : " + objMonthlyReportOfEmployee.PresentDays.ToString(); lblLeaves.Text = "Leaves : " + objMonthlyReportOfEmployee.Leaves.ToString(); lblHolidays.Text = "Holidays : " + objMonthlyReportOfEmployee.Holidays.ToString(); lblAbsentDays.Text = objMonthlyReportOfEmployee.AbsentDays.ToString(); lblAbsentDays.Text = "AbsentDays : " + objMonthlyReportOfEmployee.AbsentDays.ToString(); lblWeeklyOff.Text = "WeeklyOff : " + objMonthlyReportOfEmployee.WeeklyOff.ToString(); }
protected void btnDelete_Click(object sender, EventArgs e) { Button btn = (Button)sender; ManageEmployees objManageEmployee = new ManageEmployees(); objManageEmployee.DeleteEmployee(Convert.ToInt64(btn.CommandArgument)); BindgrdEmployee(); }
protected void BindgrdEmployee() { ManageEmployees objManageEmployee = new ManageEmployees(); grdEmployee.DataSource = objManageEmployee.GetAllEmployees(); grdEmployee.DataBind(); }
protected void setControlValues() { ManageEmployees objManageEmployees = new ManageEmployees(); Employees objEmployee = objManageEmployees.GetEmployeeById(Convert.ToInt64(Session[0].ToString())); txtName.Text = objEmployee.Name; rdrbtnMale.Checked = objEmployee.Gender == "NULL" ? true : objEmployee.Gender == "Male" ? true : false; rdrbtnFemale.Checked = rdrbtnMale.Checked ? false : true; txtDateOfJoining.Text = objEmployee.JoiningDate == new DateTime() ? "" : objEmployee.JoiningDate.ToString("dd/M/yyyy"); txtContactNumber.Text = objEmployee.ContactNumber == 0 ? "" : objEmployee.ContactNumber.ToString(); ddlDepartments.SelectedValue = objEmployee.DepartmentId.ToString(); ddlRoles.SelectedValue = objEmployee.RoleId.ToString(); ddlDays.SelectedValue = objEmployee.WeeklyOffDay.ToString(); ddlShifts.SelectedValue = objEmployee.ShiftId.ToString(); }
protected void lnkUpdateEmployee_Click(object sender, EventArgs e) { Employees objEmployee = new Employees(); objEmployee.Id = Convert.ToInt32(Session["EmployeeId"] == null ? 0 : Session["EmployeeId"]); objEmployee.DateOfBirth = Convert.ToDateTime(txtDateOfBirth.Text); objEmployee.JoiningDate = Convert.ToDateTime(txtDateOfJoining.Text); objEmployee.ContactNumber = Convert.ToInt64(txtContactNumber.Text); objEmployee.RoleId = Convert.ToInt32(ddlRoles.SelectedValue); objEmployee.DepartmentId = Convert.ToInt32(ddlRoles.SelectedValue); objEmployee.Password = txtPassword.Text; objEmployee.Gender = rdrbtnMale.Checked == true ? "Male" : "Female"; ManageEmployees objManageEmployees = new ManageEmployees(); objManageEmployees.UpdateEmployee(objEmployee); Response.Redirect("ViewEmployee.aspx"); }
protected void lnkUpdateEmployee_Click(object sender, EventArgs e) { Employees objEmployee = new Employees(); objEmployee.Id = Convert.ToInt32(Session["EmployeeId"] == null ? 0 : Session["EmployeeId"]); objEmployee.DateOfBirth = DateTime.Now; objEmployee.JoiningDate = Convert.ToDateTime(txtDateOfJoining.Text); objEmployee.ContactNumber = Convert.ToInt64(txtContactNumber.Text); objEmployee.RoleId = Convert.ToInt32(ddlRoles.SelectedValue); objEmployee.DepartmentId = Convert.ToInt32(ddlDepartments.SelectedValue); objEmployee.Password = ""; objEmployee.Gender = rdrbtnMale.Checked == true ? "Male" : "Female"; objEmployee.WeeklyOffDay = Convert.ToInt32(ddlDays.SelectedValue); objEmployee.ShiftId = Convert.ToInt32(ddlShifts.SelectedValue); ManageEmployees objManageEmployees = new ManageEmployees(); objManageEmployees.UpdateEmployee(objEmployee); Response.Redirect("ViewEmployee.aspx"); }
protected void BindDropDown() { ManageEmployees objEmployee = new ManageEmployees(); lstEmployees = objEmployee.GetAllEmployees(); string empNames = ""; foreach (var item in lstEmployees) { empNames = empNames + "\"" + item.Name + "\","; } empNames = empNames.Remove(empNames.Length - 1); string data = @"<script>$(function () { var availableTags = [ " + empNames + @"]; $(""#ContentPlaceHolder1_txtEmployeeId"").autocomplete({ source: availableTags }); }); </script>"; lit_autocomplete.Text = data; }
protected void btnSUbmit_Click(object sender, EventArgs e) { Employees objEmployee = new Employees(); objEmployee.Id = Convert.ToInt32(txtEmployeeId.Text); objEmployee.Name = txtName.Text; objEmployee.DepartmentId = Convert.ToInt32(ddlDepartments.SelectedValue); objEmployee.RoleId = Convert.ToInt32(ddlRoles.SelectedValue); objEmployee.CreatedOn = DateTime.Now; objEmployee.UpdatedOn = DateTime.Now; objEmployee.JoiningDate = DateTime.Parse(txtDateOfJoining.Text); long contact = new long(); long.TryParse(txtContactNumber.Text, out contact); objEmployee.ContactNumber = contact; objEmployee.Gender = rdrbtnFemale.Checked ? "Female" : "Male"; objEmployee.ShiftId = Convert.ToInt32(ddlShifts.SelectedValue); ManageEmployees objManageEmployee = new ManageEmployees(); objManageEmployee.CreateEmployee(objEmployee); Response.Redirect(Request.Url.AbsoluteUri); }
protected void btn_report_Click(object sender, EventArgs e) { btnExport.Visible = true; ManageReports objManageReports = new ManageReports(); TimeSpan relaxationTime = new TimeSpan(); relaxationTime = TimeSpan.Parse(ddlRelaxation.SelectedValue.ToString()); int EmployeeId = 0; ManageEmployees objEmployee = new ManageEmployees(); lstEmployees = objEmployee.GetAllEmployees(); EmployeeId = lstEmployees.Where(y => y.Name == txtEmployeeId.Text).Select(x => x.Id).FirstOrDefault(); DateTime StartDate = DateTime.Parse(txtStartDate.Text); DateTime EndDate = DateTime.Parse(txtEndDate.Text); MonthlyReportOfEmployee objMonthlyReportOfEmployee = new MonthlyReportOfEmployee(); var data = objManageReports.GetMonthlyAttendanceDetailedReport(EmployeeId, StartDate, EndDate, relaxationTime, out objMonthlyReportOfEmployee); grid_monthly_attendanceDetailed.DataSource = data; grid_monthly_attendanceDetailed.DataBind(); if (data.Count != 0) { lblName.Text = "Name : " + data[0].Name; } else { lblName.Text = "No Data"; } lblTotalDuration.Text = "TotalDuration : " + objMonthlyReportOfEmployee.TotalDuration.ToString(); lblPresentDays.Text = "PresentDays : " + objMonthlyReportOfEmployee.PresentDays.ToString(); lblLeaves.Text = "Leaves : " + objMonthlyReportOfEmployee.Leaves.ToString(); lblHolidays.Text = "Holidays : " + objMonthlyReportOfEmployee.Holidays.ToString(); lblAbsentDays.Text = objMonthlyReportOfEmployee.AbsentDays.ToString(); lblAbsentDays.Text = "AbsentDays : " + objMonthlyReportOfEmployee.AbsentDays.ToString(); lblWeeklyOff.Text = "WeeklyOff : " + objMonthlyReportOfEmployee.WeeklyOff.ToString(); }
public bool AssignSessionWiseLeave(DateTime sessionStartDate) { DBDataHelper.ConnectionString = ConfigurationManager.ConnectionStrings["CSBiometricAttendance"].ConnectionString; MasterEntries objMasterEntries = new MasterEntries(); List<Role> lstRole = new List<Role>(); lstRole = objMasterEntries.GetAllRoles(); DateTime sessionEndDate = new DateTime(sessionStartDate.Year + 1, 7, 31); #region Roles foreach (Role role in lstRole) { ManageEmployees objManageEmployees = new ManageEmployees(); List<Employees> lstEmployees = objManageEmployees.GetEmployeesByRole(role.Id); List<LeavesCount> lstLeaveDetails = new List<LeavesCount>(); ManageLeaves objManageLeaves = new ManageLeaves(); lstLeaveDetails = objManageLeaves.GetLeavesCountAssignedByRole(role.Id); #region List of Employees foreach (Employees objEmployees in lstEmployees) { #region List of Leaves foreach (LeavesCount LeaveDetails in lstLeaveDetails) { using (DBDataHelper objDDBDataHelper = new DBDataHelper()) { string query = @"INSERT INTO [dbo].[tblLeaveAssignedPerSession] VALUES (@employeeId, @leaveTypeId, @noOfLeaves, @sessionStartDate, @sessionEndDate)"; List<SqlParameter> list_params = new List<SqlParameter>() { new SqlParameter("@employeeId", objEmployees.Id), new SqlParameter("@leaveTypeId", LeaveDetails.LeaveId), new SqlParameter("@noOfLeaves", LeaveDetails.LeaveCount), new SqlParameter("@sessionStartDate", sessionStartDate), new SqlParameter("@sessionEndDate", sessionEndDate), }; objDDBDataHelper.ExecSQL(query, SQLTextType.Query, list_params); } } #endregion } #endregion } #endregion return true; }
private void ManageEmployeesToolStripButton_Click(object sender, EventArgs e) { ManageEmployees manageEmployees = new ManageEmployees(); manageEmployees.Show(); }
public void UpdateLeaveBalanceTable(DateTime sessionStartDate) { try { #region Vars DateTime sessionEndDate = new DateTime(sessionStartDate.Year + 1, 7, 31); int SLCountTaken = 0, ELCountTaken = 0, SLCountAssigned = 0, ELCountAssigned = 0, SLCountOld = 0, ELCountOld = 0, SLCountBalance = 0, ELCountBalance = 0; DateTime prevSessionStartDate = sessionStartDate.AddYears(-1); DateTime prevSessionEndDate = sessionEndDate.AddYears(-1); #endregion #region GetAllEmployees ManageEmployees objManageEmployees = new ManageEmployees(); List<Employees> lstEmployees = objManageEmployees.GetAllEmployees(); #endregion foreach (var employee in lstEmployees) { #region Get EL Taken By Emp string queryELTaken = "Select Count(*) from tblLeave Where EmployeeId = @employeeId AND LeaveTypeId = 2 AND [Date] Between @sessionStartDate AND @sessionEndDate"; List<SqlParameter> list_params_el = new List<SqlParameter>() { new SqlParameter("@employeeId", employee.Id), new SqlParameter("@sessionStartDate", prevSessionStartDate), new SqlParameter("@sessionEndDate", prevSessionEndDate) }; DataTable dtEL; using (DBDataHelper helper = new DBDataHelper()) { dtEL = helper.GetDataTable(queryELTaken, SQLTextType.Query, list_params_el); ELCountTaken = Convert.ToInt32(dtEL.Rows[0][0].ToString()); } #endregion #region Get SL Taken By Emp string querySLTaken = "Select Count(*) from tblLeave Where EmployeeId = @employeeId AND LeaveTypeId = 5 AND [Date] Between @sessionStartDate AND @sessionEndDate"; List<SqlParameter> list_params = new List<SqlParameter>() { new SqlParameter("@employeeId", employee.Id), new SqlParameter("@sessionStartDate", prevSessionStartDate), new SqlParameter("@sessionEndDate", prevSessionEndDate) }; DataTable dtSL; using (DBDataHelper helper = new DBDataHelper()) { dtSL = helper.GetDataTable(querySLTaken, SQLTextType.Query, list_params); if (dtSL.Rows.Count > 0) SLCountTaken = dtSL.Rows[0][0] != DBNull.Value ? Convert.ToInt32(dtSL.Rows[0][0].ToString()) : 0; else SLCountTaken = 0; } #endregion #region Get EL Assigned string queryELAssigned = @"SELECT [NoOfLeaves]FROM [BiometricAttendanceManagementSystem].[dbo].[tblLeaveAssignedPerSession] WHERE EmployeeId = @employeeId AND LeaveTypeId = 2 AND [SessionStartDate] = @sessionStartDate"; List<SqlParameter> list_params_el2 = new List<SqlParameter>() { new SqlParameter("@employeeId", employee.Id), new SqlParameter("@sessionStartDate", prevSessionStartDate) }; DataTable dtELAssigned; using (DBDataHelper helper = new DBDataHelper()) { dtELAssigned = helper.GetDataTable(queryELAssigned, SQLTextType.Query, list_params_el2); if (dtELAssigned.Rows.Count > 0) ELCountAssigned = dtELAssigned.Rows[0][0] != DBNull.Value ? Convert.ToInt32(dtELAssigned.Rows[0][0].ToString()) : 0; else ELCountAssigned = 0; } #endregion #region Get SL Assigned string querySLAssigned = @"SELECT [NoOfLeaves] FROM [BiometricAttendanceManagementSystem].[dbo].[tblLeaveAssignedPerSession] WHERE EmployeeId = @employeeId AND LeaveTypeId = 5 AND [SessionStartDate] = @sessionStartDate"; List<SqlParameter> list_params_sl2 = new List<SqlParameter>() { new SqlParameter("@employeeId", employee.Id), new SqlParameter("@sessionStartDate", prevSessionStartDate) }; DataTable dtSLAssigned; using (DBDataHelper helper = new DBDataHelper()) { dtSLAssigned = helper.GetDataTable(querySLAssigned, SQLTextType.Query, list_params_sl2); if (dtSLAssigned.Rows.Count > 0) SLCountAssigned = dtSLAssigned.Rows[0][0] != DBNull.Value ? Convert.ToInt32(dtSLAssigned.Rows[0][0].ToString()) : 0; else SLCountAssigned = 0; //SLCountAssigned = Convert.ToInt32(dtSLAssigned.Rows[0][0].ToString()); } #endregion #region Get Old Data string queryOld = @"SELECT TOP 1000 [SLCount] ,[ELCount] FROM [tblLeavesOldStock] WHERE EmployeeId = @employeeId AND SessionStartDate = @sessionStartDate"; List<SqlParameter> list_params_old = new List<SqlParameter>() { new SqlParameter("@employeeId", employee.Id), new SqlParameter("@sessionStartDate", prevSessionStartDate) }; DataTable dtOld; using (DBDataHelper helper = new DBDataHelper()) { dtOld = helper.GetDataTable(queryOld, SQLTextType.Query, list_params_old); if (dtOld.Rows.Count > 0) { ELCountOld = Convert.ToInt32(dtOld.Rows[0][1].ToString()); SLCountOld = Convert.ToInt32(dtOld.Rows[0][0].ToString()); } } #endregion #region Calculation Of Balance ELCountBalance = ELCountOld + ELCountAssigned - ELCountTaken; ELCountBalance = ELCountBalance > 60 ? 60 : ELCountBalance; SLCountBalance = SLCountOld + SLCountAssigned - SLCountTaken; SLCountBalance = SLCountBalance > 30 ? 30 : SLCountBalance; #endregion #region Insert New Data string queryInset = @"INSERT INTO [tblLeavesOldStock] VALUES (@employeeId, @slCount,@elCount, @sessionStartDate,@sessionEndDate)"; List<SqlParameter> list_params_insert = new List<SqlParameter>() { new SqlParameter("@employeeId", employee.Id), new SqlParameter("@slCount", SLCountBalance), new SqlParameter("@elCount", ELCountBalance), new SqlParameter("@sessionStartDate", sessionStartDate), new SqlParameter("@sessionEndDate", sessionEndDate) }; using (DBDataHelper helper = new DBDataHelper()) { helper.ExecSQL(queryInset, SQLTextType.Query, list_params_insert); } #endregion } } catch (Exception) { } }
public List<DailyAttendanceReportViewModel> GetDailyAttendanceDetailedReport(DateTime date, TimeSpan relaxation) { ManageEmployees objManageEmployees = new ManageEmployees(); List<Employees> lstEmployees = objManageEmployees.GetAllEmployees(); List<DailyAttendanceReportViewModel> lstDailyAttendanceReportViewModel = new List<DailyAttendanceReportViewModel>(); foreach (Employees employee in lstEmployees) { DailyAttendanceReportViewModel objDailyAttendanceReportViewModel = GetDataForReportEmployeeWise(employee.Id, date, relaxation); objDailyAttendanceReportViewModel.DepartmentId = employee.DepartmentId; objDailyAttendanceReportViewModel.DepartmentName = employee.DepartmentName; objDailyAttendanceReportViewModel.Date = date; objDailyAttendanceReportViewModel.DepartmentName = employee.DepartmentName; lstDailyAttendanceReportViewModel.Add(objDailyAttendanceReportViewModel); } return lstDailyAttendanceReportViewModel; }