public int GetDaysPerMonthByEmployeeFormullaID(int employeePayrollFormulaID, int month, int year) { try { DataSet ds = dal.GetAllObject(); List <HRTimesheetConfigsInfo> list = (List <HRTimesheetConfigsInfo>)GetListFromDataSet(ds); HRTimesheetConfigsInfo objTimesheetConfigsInfo = list.Where(p => p.FK_HREmployeePayrollFormulaID == employeePayrollFormulaID && p.HRTimesheetConfigYear.Year == year).FirstOrDefault(); string[] str = new string[] { "HRTimesheetConfigJan", "HRTimesheetConfigFeb", "HRTimesheetConfigMar", "HRTimesheetConfigApr", "HRTimesheetConfigMay", "HRTimesheetConfigJun", "HRTimesheetConfigJul", "HRTimesheetConfigAug", "HRTimesheetConfigSep", "HRTimesheetConfigOct", "HRTimesheetConfigNov", "HRTimesheetConfigDec" }; if (objTimesheetConfigsInfo != null) { BusinessObject obj = (BusinessObject)objTimesheetConfigsInfo; VinaDbUtil util = new VinaDbUtil(); object o = util.GetPropertyValue(objTimesheetConfigsInfo, str[month - 1]); return(int.Parse(o.ToString())); } return(0); } catch (Exception) { return(0); } }
public override IList GetListFromDataSet(DataSet ds) { List <HRTimesheetConfigsInfo> list = new List <HRTimesheetConfigsInfo>(); if (ds.Tables.Count > 0) { foreach (DataRow row in ds.Tables[0].Rows) { HRTimesheetConfigsInfo obj = (HRTimesheetConfigsInfo)GetObjectFromDataRow(row); list.Add(obj); } } return(list); }