protected void grdShiftsBind() { MasterEntries objMasterEntries = new MasterEntries(); gvShifts.DataSource = objMasterEntries.GetAllShifts(); gvShifts.DataBind(); }
protected void lkbEditLeaveAssingedByRole_Click(object sender, EventArgs e) { ddlRole.Items.Clear(); ddlRole.Items.Add("select"); ddlLeave.Items.Clear(); ddlLeave.Items.Add("select"); ddlRole1.DataSource = GiveAllRole(); ddlRole1.DataTextField = "Name"; ddlRole1.DataValueField = "Id"; ddlRole1.DataBind(); ddlLeaveEdit.DataSource = GetAllLeaves(); ddlLeaveEdit.DataTextField = "LeaveName"; ddlLeaveEdit.DataValueField = "Id"; ddlLeaveEdit.DataBind(); MasterEntries objMasterEntry = new MasterEntries(); LinkButton b = (LinkButton)sender; int Id = Convert.ToInt32(b.CommandArgument); string roleName = objMasterEntry.GetRoleById(Id); LeaveAssignedByRole objLeaves = new LeaveAssignedByRole(); objMasterEntry.GetLeavesAssignedByRoleById(Id, out objLeaves); txtNoOfLeave.Text = objLeaves.NoOfLeaves.ToString(); ddlIsPromotedEdit.SelectedIndex = Convert.ToInt32(objLeaves.IsPromoted); ddlRole1.SelectedIndex = Convert.ToInt32(objLeaves.RoleId); ddlLeaveEdit.SelectedIndex = Convert.ToInt32(objLeaves.LeaveTypeId); ddlRole1.Enabled = false; ddlLeaveEdit.Enabled = false; Session["Id"] = Id; popupEditLeaveAssignedByRole.Show(); }
protected void grdLeaveAssignByRoleBind() { MasterEntries objMasterEntries = new MasterEntries(); gvViewLeaveAssignedByRole.DataSource = objMasterEntries.GetAllTypeOfLeavesAssignedByRole(); gvViewLeaveAssignedByRole.DataBind(); }
protected void grdDepartmentBind() { MasterEntries objMasterEntries = new MasterEntries(); grdDepartment.DataSource = objMasterEntries.GetAllDepartments(); grdDepartment.DataBind(); }
protected void lnkAddLeave_Click(object sender, EventArgs e) { string leave = txtLeave.Text; MasterEntries objMasterEntry = new MasterEntries(); objMasterEntry.AddTypeOfLeave(leave); // Input from Drop down grdLeaveBind(); }
protected void grdLeaveBind() { MasterEntries objMasterEntries = new MasterEntries(); grdLeave.DataSource = objMasterEntries.GetAllTypeOfLeaves(); grdLeave.DataBind(); }
public List<AssignLeaveViewModel> BindGridData() { MasterEntries objMasterEntries = new MasterEntries(); DBDataHelper.ConnectionString = ConfigurationManager.ConnectionStrings["CSBiometricAttendance"].ConnectionString; DataTable dt = new DataTable(); List<SqlParameter> lstData = new List<SqlParameter>(); lstData.Add(new SqlParameter("@employeeId", Convert.ToInt32(Session["employeeId"]))); lstData.Add(new SqlParameter("@dateMonth", Calendar1.SelectedDate.Month)); lstData.Add(new SqlParameter("@dateYear", Calendar1.SelectedDate.Year)); lstData.Add(new SqlParameter("@IsDeleted", Convert.ToInt32(0))); DataSet ds; int i = 0; string query = "SELECT Id , LeaveTypeId , [Date] FROM tblLeave WHERE MONTH([Date]) = @dateMonth AND YEAR([Date]) = @dateYear And EmployeeId = @employeeId And IsDeleted = @IsDeleted"; using (DBDataHelper objDDBDataHelper = new DBDataHelper()) { ds = objDDBDataHelper.GetDataSet(query, SQLTextType.Query, lstData); List<AssignLeaveViewModel> lstLeaves = new List<AssignLeaveViewModel>(); foreach (DataRow row in ds.Tables[0].Rows) { AssignLeaveViewModel objLeaves = new AssignLeaveViewModel(); int Id = Convert.ToInt32(ds.Tables[0].Rows[i][0]); int leaveId = Convert.ToInt32(ds.Tables[0].Rows[i][1]); Leaves objLeaves1 = new Leaves(); objMasterEntries.GetLeavesById(leaveId, out objLeaves1); objLeaves.leaveId = Id; objLeaves.Id = objLeaves1.Id; objLeaves.LeaveName = objLeaves1.LeaveName; objLeaves.EmployeeId = Convert.ToInt32(Session["employeeId"]); objLeaves.Date = (Convert.ToDateTime(ds.Tables[0].Rows[i][2])).Date; lstLeaves.Add(objLeaves); i++; } return lstLeaves; } }
protected int LeaveExists(DateTime date) { MasterEntries objMasterEntries = new MasterEntries(); DBDataHelper.ConnectionString = ConfigurationManager.ConnectionStrings["CSBiometricAttendance"].ConnectionString; List <SqlParameter> lstData = new List <SqlParameter>(); lstData.Add(new SqlParameter("@employeeId", Convert.ToInt32(Session["employeeId"]))); lstData.Add(new SqlParameter("@date", date)); lstData.Add(new SqlParameter("@IsDeleted", Convert.ToInt32(0))); DataSet ds; string query = @"SELECT Count(Id) FROM tblLeave WHERE [Date] = @date AND EmployeeId = @employeeId AND IsDeleted = @IsDeleted"; using (DBDataHelper objDDBDataHelper = new DBDataHelper()) { ds = objDDBDataHelper.GetDataSet(query, SQLTextType.Query, lstData); List <AssignLeaveViewModel> lstLeaves = new List <AssignLeaveViewModel>(); int number = Convert.ToInt32(ds.Tables[0].Rows[0][0]); return(number); } }
protected void grdRoleBind() { MasterEntries objMasterEntries = new MasterEntries(); grdRole.DataSource = objMasterEntries.GetAllRoles(); grdRole.DataBind(); }
protected void lnkAddDepartment_Click(object sender, EventArgs e) { string department = txtDepartment.Text; MasterEntries objMasterEntry = new MasterEntries(); objMasterEntry.AddDepartment(department); grdDepartmentBind(); }
protected List <Role> GiveAllRole() { MasterEntries objMasterEntries = new MasterEntries(); List <Role> lstRole = new List <Role>(); lstRole = objMasterEntries.GetAllRoles(); return(lstRole); }
protected List <Leaves> GetAllLeaves() { MasterEntries objMasterEntries = new MasterEntries(); List <Leaves> lstLeaves = new List <Leaves>(); lstLeaves = objMasterEntries.GetAllTypeOfLeaves(); return(lstLeaves); }
protected void BindDropDowns() { MasterEntries objMasterEntries = new MasterEntries(); ddlShowDepartment.DataSource = objMasterEntries.GetAllDepartments(); ddlShowDepartment.DataTextField = "Name"; ddlShowDepartment.DataValueField = "Id"; ddlShowDepartment.DataBind(); }
protected void lnkAddRole_Click(object sender, EventArgs e) { string role = txtRole.Text; MasterEntries objMasterEntry = new MasterEntries(); objMasterEntry.AddRole(role); grdRoleBind(); }
protected void lkbDeleteDepartment_Click(object sender, EventArgs e) { LinkButton b = (LinkButton)sender; int Id = Convert.ToInt32(b.CommandArgument); MasterEntries objMasterEntry = new MasterEntries(); objMasterEntry.DeleteDepartment(Id); grdDepartmentBind(); }
public void BindDropdown() { MasterEntries objMasterEntries = new MasterEntries(); ddlLeaves.DataSource = objMasterEntries.GetAllTypeOfLeaves(); ddlLeaves.DataTextField = "LeaveName"; ddlLeaves.DataValueField = "Id"; ddlLeaves.DataBind(); }
protected void BindDropDowns() { MasterEntries objMasterEntries = new MasterEntries(); ddlDepartment.DataSource = objMasterEntries.GetAllDepartments(); ddlDepartment.DataTextField = "Name"; ddlDepartment.DataValueField = "Id"; ddlDepartment.DataBind(); }
protected void btnUpdateDepartment_Click(object sender, EventArgs e) { MasterEntries objMasterEntry = new MasterEntries(); string departmentName = txtEditDepartment.Text; int Id = Convert.ToInt32(Session["departmentId"]); objMasterEntry.UpdateDepartment(Id, departmentName); grdDepartmentBind(); popupEditDepartment.Hide(); }
public List <AssignLeaveViewModel> GetDataForGridview() { MasterEntries objMasterEntries = new MasterEntries(); DBDataHelper.ConnectionString = ConfigurationManager.ConnectionStrings["CSBiometricAttendance"].ConnectionString; DateTime sessionStartDate = new DateTime(); DateTime sessionEndDate = new DateTime(); if (DateTime.Now.Month <= 7) { sessionStartDate = new DateTime(DateTime.Now.Year - 1, 8, 1); sessionEndDate = new DateTime(DateTime.Now.Year, 7, 31); } else { sessionStartDate = new DateTime(DateTime.Now.Year, 8, 1); sessionEndDate = new DateTime(DateTime.Now.Year + 1, 7, 31); } List <SqlParameter> lstData = new List <SqlParameter>(); lstData.Add(new SqlParameter("@employeeId", Convert.ToInt32(Session["employeeId"]))); lstData.Add(new SqlParameter("@sessionStartDate", sessionStartDate)); lstData.Add(new SqlParameter("@sessionEndDate", sessionEndDate)); lstData.Add(new SqlParameter("@IsDeleted", Convert.ToInt32(0))); DataSet ds; int i = 0; string query = @"SELECT Id , LeaveTypeId , [Date] FROM tblLeave WHERE [Date] >= @sessionStartDate AND [Date] <= @sessionEndDate AND EmployeeId = @employeeId AND IsDeleted = @IsDeleted"; using (DBDataHelper objDDBDataHelper = new DBDataHelper()) { ds = objDDBDataHelper.GetDataSet(query, SQLTextType.Query, lstData); List <AssignLeaveViewModel> lstLeaves = new List <AssignLeaveViewModel>(); foreach (DataRow row in ds.Tables[0].Rows) { AssignLeaveViewModel objLeaves = new AssignLeaveViewModel(); int Id = Convert.ToInt32(ds.Tables[0].Rows[i][0]); int leaveId = Convert.ToInt32(ds.Tables[0].Rows[i][1]); Leaves objLeaves1 = new Leaves(); objMasterEntries.GetLeavesById(leaveId, out objLeaves1); objLeaves.leaveId = Id; objLeaves.Id = objLeaves1.Id; objLeaves.LeaveName = objLeaves1.LeaveName; objLeaves.EmployeeId = Convert.ToInt32(Session["employeeId"]); objLeaves.Date = (Convert.ToDateTime(ds.Tables[0].Rows[i][2])).Date; lstLeaves.Add(objLeaves); i++; } return(lstLeaves); } }
protected void lnkAddDepartment_Click(object sender, EventArgs e) { string department = txtDepartment.Text; MasterEntries objMasterEntry = new MasterEntries(); objMasterEntry.AddDepartment(department); grdDepartmentBind(); txtDepartment.Text = string.Empty; }
public void BindDropDown() { ddlShift.Items.Clear(); ddlShift.Items.Add("Select Shift"); MasterEntries objMasterEntries = new MasterEntries(); ddlShift.DataSource = objMasterEntries.GetAllShifts(); ddlShift.DataTextField = "Name"; ddlShift.DataValueField = "Id"; ddlShift.DataBind(); }
protected void lkbEditDepartment_Click(object sender, EventArgs e) { MasterEntries objMasterEntry = new MasterEntries(); LinkButton b = (LinkButton)sender; int Id = Convert.ToInt32(b.CommandArgument); string departmentName = objMasterEntry.GetDepartmentById(Id); txtEditDepartment.Text = departmentName; Session["departmentId"] = Id; popupEditDepartment.Show(); }
protected void btnUpdateLeave_Click(object sender, EventArgs e) { MasterEntries objMasterEntry = new MasterEntries(); string leaveName = txtEditLeave.Text; int Id = Convert.ToInt32(Session["LeaveId"]); objMasterEntry.UpdateLeave(Id, leaveName); grdLeaveBind(); popupEditLeave.Hide(); }
protected void btnUpdateRole_Click(object sender, EventArgs e) { MasterEntries objMasterEntry = new MasterEntries(); string roleName = txtEditRole.Text; int Id = Convert.ToInt32(Session["roleId"]); objMasterEntry.UpdateRole(Id, roleName); grdRoleBind(); popupEditRole.Hide(); }
public List<AssignLeaveViewModel> GetDataForGridview() { MasterEntries objMasterEntries = new MasterEntries(); DBDataHelper.ConnectionString = ConfigurationManager.ConnectionStrings["CSBiometricAttendance"].ConnectionString; DateTime sessionStartDate = new DateTime(); DateTime sessionEndDate = new DateTime(); if (DateTime.Now.Month <= 7) { sessionStartDate = new DateTime(DateTime.Now.Year - 1, 8, 1); sessionEndDate = new DateTime(DateTime.Now.Year, 7, 31); } else { sessionStartDate = new DateTime(DateTime.Now.Year, 8, 1); sessionEndDate = new DateTime(DateTime.Now.Year + 1, 7, 31); } List<SqlParameter> lstData = new List<SqlParameter>(); lstData.Add(new SqlParameter("@employeeId", Convert.ToInt32(Session["employeeId"]))); lstData.Add(new SqlParameter("@sessionStartDate", sessionStartDate)); lstData.Add(new SqlParameter("@sessionEndDate", sessionEndDate)); lstData.Add(new SqlParameter("@IsDeleted", Convert.ToInt32(0))); DataSet ds; int i = 0; string query = @"SELECT Id , LeaveTypeId , [Date] FROM tblLeave WHERE [Date] >= @sessionStartDate AND [Date] <= @sessionEndDate AND EmployeeId = @employeeId AND IsDeleted = @IsDeleted"; using (DBDataHelper objDDBDataHelper = new DBDataHelper()) { ds = objDDBDataHelper.GetDataSet(query, SQLTextType.Query, lstData); List<AssignLeaveViewModel> lstLeaves = new List<AssignLeaveViewModel>(); foreach (DataRow row in ds.Tables[0].Rows) { AssignLeaveViewModel objLeaves = new AssignLeaveViewModel(); int Id = Convert.ToInt32(ds.Tables[0].Rows[i][0]); int leaveId = Convert.ToInt32(ds.Tables[0].Rows[i][1]); Leaves objLeaves1 = new Leaves(); objMasterEntries.GetLeavesById(leaveId, out objLeaves1); objLeaves.leaveId = Id; objLeaves.Id = objLeaves1.Id; objLeaves.LeaveName = objLeaves1.LeaveName; objLeaves.EmployeeId = Convert.ToInt32(Session["employeeId"]); objLeaves.Date = (Convert.ToDateTime(ds.Tables[0].Rows[i][2])).Date; lstLeaves.Add(objLeaves); i++; } return lstLeaves; } }
protected void btnUpdate_Click(object sender, EventArgs e) { MasterEntries objMasterEntry = new MasterEntries(); int noOfLeaves = Convert.ToInt32(txtNoOfLeave.Text); // int isPromoted = Convert.ToInt32(ddlIsPromotedEdit.SelectedIndex); int Id = Convert.ToInt32(Session["Id"]); bool isPromoted = true; objMasterEntry.UpdateLeavesAssignedByRole(Id, noOfLeaves, isPromoted); grdLeaveAssignByRoleBind(); popupEditLeaveAssignedByRole.Hide(); }
protected void lkbEditLeave_Click(object sender, EventArgs e) { MasterEntries objMasterEntry = new MasterEntries(); List <Leaves> objListLeaves = new List <Leaves>(); LinkButton b = (LinkButton)sender; Leaves objLeaves = new Leaves(); int Id = Convert.ToInt32(b.CommandArgument); objMasterEntry.GetLeavesById(Id, out objLeaves); txtEditLeave.Text = objLeaves.LeaveName; Session["LeaveId"] = Id; popupEditLeave.Show(); }
protected void lnkAddLeaveAsssignedByRole_Click(object sender, EventArgs e) { int roleId = Convert.ToInt32(ddlRole.SelectedValue); int leaveId = Convert.ToInt32(ddlLeave.SelectedValue); int noOfLeaves = Convert.ToInt32(txtNoOfLeaves.Text); int isPromoted = Convert.ToInt32(ddlIsPromoted.SelectedValue); MasterEntries objMasterEntry = new MasterEntries(); int count = objMasterEntry.Count(roleId, leaveId); if (count == 0) { objMasterEntry.LeaveAssignedByRole(leaveId, roleId, noOfLeaves, isPromoted); } grdLeaveAssignByRoleBind(); }
protected void lnkbtnShifts_Click(object sender, EventArgs e) { MasterShifts objShift = new MasterShifts(); objShift.Name = txtName.Text; objShift.FirstHalfStart = TimeSpan.Parse(txtFirstHalfStart.Text); objShift.FirstHalfEnd = TimeSpan.Parse(txtFirstHalfEnd.Text); objShift.SecondHalfStart = TimeSpan.Parse(txtSecondHalfStart.Text); objShift.SecondHalfEnd = TimeSpan.Parse(txtSecondHalfEnd.Text); objShift.SHLDuration = TimeSpan.Parse(txtSLDuration.Text); MasterEntries objMasterEntry = new MasterEntries(); objMasterEntry.AddShift(objShift); grdShiftsBind(); }
protected void btnEditShifts_Click(object sender, EventArgs e) { MasterEntries objMasterEntry = new MasterEntries(); int Id = Convert.ToInt32(Session["shiftId"]); MasterShifts objShift = new MasterShifts(); objShift.Name = txtEditName.Text; objShift.FirstHalfStart = TimeSpan.Parse(txtEditFirstHalfStart.Text); objShift.FirstHalfEnd = TimeSpan.Parse(txtEditFirstHalfEnd.Text); objShift.SecondHalfStart = TimeSpan.Parse(txtEditSecondHalfStart.Text); objShift.SecondHalfEnd = TimeSpan.Parse(txtEditSecondHalfEnd.Text); objShift.SHLDuration = TimeSpan.Parse(txtEditSLDuration.Text); objMasterEntry.UpdateShifts(Id, objShift); grdShiftsBind(); popupEditShifts.Hide(); }
protected void lkbEditShift_Click(object sender, EventArgs e) { MasterEntries objMasterEntry = new MasterEntries(); LinkButton b = (LinkButton)sender; int Id = Convert.ToInt32(b.CommandArgument); MasterShifts objShift = new MasterShifts(); objMasterEntry.GetShiftsById(Id, out objShift); Session["shiftId"] = Id; txtEditName.Text = objShift.Name.ToString(); txtEditFirstHalfStart.Text = objShift.FirstHalfStart.ToString(); txtEditFirstHalfEnd.Text = objShift.FirstHalfEnd.ToString(); txtEditSecondHalfStart.Text = objShift.SecondHalfStart.ToString(); txtEditSecondHalfEnd.Text = objShift.SecondHalfEnd.ToString(); txtEditSLDuration.Text = objShift.SHLDuration.ToString(); popupEditShifts.Show(); }
protected int LeaveExists(DateTime date) { MasterEntries objMasterEntries = new MasterEntries(); DBDataHelper.ConnectionString = ConfigurationManager.ConnectionStrings["CSBiometricAttendance"].ConnectionString; List<SqlParameter> lstData = new List<SqlParameter>(); lstData.Add(new SqlParameter("@employeeId", Convert.ToInt32(Session["employeeId"]))); lstData.Add(new SqlParameter("@date", date)); lstData.Add(new SqlParameter("@IsDeleted", Convert.ToInt32(0))); DataSet ds; string query = @"SELECT Count(Id) FROM tblLeave WHERE [Date] = @date AND EmployeeId = @employeeId AND IsDeleted = @IsDeleted"; using (DBDataHelper objDDBDataHelper = new DBDataHelper()) { ds = objDDBDataHelper.GetDataSet(query, SQLTextType.Query, lstData); List<AssignLeaveViewModel> lstLeaves = new List<AssignLeaveViewModel>(); int number = Convert.ToInt32(ds.Tables[0].Rows[0][0]); return number; } }
protected void lkbEditLeave_Click(object sender, EventArgs e) { MasterEntries objMasterEntry = new MasterEntries(); List<Leaves> objListLeaves = new List<Leaves>(); LinkButton b = (LinkButton)sender; Leaves objLeaves = new Leaves(); int Id = Convert.ToInt32(b.CommandArgument); objMasterEntry.GetLeavesById(Id, out objLeaves); txtEditLeave.Text = objLeaves.LeaveName; Session["LeaveId"] = Id; popupEditLeave.Show(); }
protected List<Role> GiveAllRole() { MasterEntries objMasterEntries = new MasterEntries(); List<Role> lstRole = new List<Role>(); lstRole = objMasterEntries.GetAllRoles(); return lstRole; }
protected void lnkAddLeaveAsssignedByRole_Click(object sender, EventArgs e) { int roleId = Convert.ToInt32(ddlRole.SelectedValue); int leaveId = Convert.ToInt32(ddlLeave.SelectedValue); int noOfLeaves = Convert.ToInt32(txtNoOfLeaves.Text); int isPromoted = Convert.ToInt32(ddlIsPromoted.SelectedValue); MasterEntries objMasterEntry = new MasterEntries(); int count = objMasterEntry.Count(roleId, leaveId); if (count == 0) objMasterEntry.LeaveAssignedByRole(leaveId, roleId, noOfLeaves, isPromoted); grdLeaveAssignByRoleBind(); }
protected List<Leaves> GetAllLeaves() { MasterEntries objMasterEntries = new MasterEntries(); List<Leaves> lstLeaves = new List<Leaves>(); lstLeaves = objMasterEntries.GetAllTypeOfLeaves(); return lstLeaves; }
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; }
public void UpdateLeaveBalanceTable(DateTime OldSessionStartDate, DateTime OldSessionEndDate, DateTime NewSessionStartDate, DateTime NewSessionEndDate) { MasterEntries objMasterEntries = new MasterEntries(); List<Departments> lstDepartments = objMasterEntries.GetAllDepartments(); foreach (var item in lstDepartments) { //List<LeavesBalanceRecord> lst = GetDataForMonthlyLeaveBalanceTable(); } }