public ArrayList GetBonusEmpName(int userId, string connectionString, DateTime businessDate) { DataBaseUtility db = new DataBaseUtility(); SqlConnection con = null; ArrayList list = new ArrayList(); DateTime weekStartDate = GetActualWeekStartDate(businessDate); DateTime secondDate = weekStartDate.AddDays(1); DateTime thirdDate = weekStartDate.AddDays(2); DateTime fourDate = weekStartDate.AddDays(3); DateTime fiveDate = weekStartDate.AddDays(4); DateTime sixDate = weekStartDate.AddDays(5); DateTime sevenDate = weekStartDate.AddDays(6); ArrayList DateList = new ArrayList(); DateList.Add(weekStartDate); DateList.Add(secondDate); DateList.Add(thirdDate); DateList.Add(fourDate); DateList.Add(fiveDate); DateList.Add(sixDate); DateList.Add(sevenDate); try { string query = null; con = db.OpenConnection(); foreach (DateTime date in DateList) { query = " select EmployeeId, FirstName,LastName,BusinessDate from dbo.EmployeeBonus where StoreId in (select StoreId from dbo.StoreUser where UserId =" + SQLUtility.getInteger(userId) + ") and BusinessDate='" + date.ToString("yyyy/MM/dd") + "'"; SqlCommand comm = db.getSQLCommand(query, con); SqlDataReader reader = comm.ExecuteReader(); while (reader.Read()) { int emoId = ValidationUtility.ToInteger(reader[0].ToString()); string firstName = reader[1].ToString(); string lastName = reader[2].ToString(); EmpBonusDTO dto = new EmpBonusDTO { EmployeeId = emoId, FirstName = firstName, LastName = lastName, BusinessDateStringType = date.ToString("MM/dd/yyyy") }; list.Add(dto); } reader.Close(); comm.Dispose(); } } catch (Exception ex) { log.Error("Exception in GetPerdaySales method ", ex); } finally { db.CloseConnection(con); } return list; }
// This method is use for get Employee Information from client store public ArrayList GetEmpInfo(string connectionString, DateTime bussinessDate) { StoreRemoteDataBaseUitility remoteDataBase = new StoreRemoteDataBaseUitility(connectionString); SqlConnection con = null; ArrayList list = new ArrayList(); try { //string query = " select e.EmployeeId, er.EmployeeRoleId , e.FirstName,e.LastName from dbo.Employees e ,dbo.EmployeeRoles er " // + " where er.EmployeeRoleId = e.EmployeeId and (er.EmployeeRoleId=5 or er.EmployeeRoleId=6) and e.EmployeeId " // + " in (select EmployeeId from dbo.UserClocking where OpeningInformationId in(select OpeningInformationId from dbo.OpeningInformation where BusinessDate='" + bussinessDate.ToString("yyyy/MM/dd") + "'))"; string query = "select e.EmployeeId,ere.EmployeeRole_Id,e.FirstName,e.LastName from dbo.Employees e ,dbo.EmployeeRoleEmployees ere " + " where ere.Employee_Id = e.EmployeeId and ere.EmployeeRole_Id in (5,6) and ere.Employee_Id " + " in (select EmployeeId from dbo.UserClocking where OpeningInformationId in(select OpeningInformationId from dbo.OpeningInformation where BusinessDate='" + bussinessDate.ToString("yyyy/MM/dd") + "'))"; con = remoteDataBase.OpenConnection(); SqlCommand comm = remoteDataBase.getSQLCommand(query, con); SqlDataReader reader = comm.ExecuteReader(); while (reader.Read()) { EmpBonusDTO dto = new EmpBonusDTO(); dto.EmployeeId = ValidationUtility.ToInteger(reader[0].ToString()); dto.EmployeeRoleId = ValidationUtility.ToInteger(reader[1].ToString()); dto.FirstName = reader[2].ToString(); dto.LastName = reader[3].ToString(); dto.BusinessDate = bussinessDate; list.Add(dto); } reader.Close(); comm.Dispose(); } catch (Exception ex) { log.Error("Exception in GetPerDaySalesAmount method ", ex); } finally { remoteDataBase.CloseConnection(con); } return list; }