private void LoadHolidayList()
        {
            int holidayProfileId = 0;

            Business.HR.HolidayProfile objEmployeeHolidayProfileMapping = new Business.HR.HolidayProfile();
            DataTable dtEmployeeHolidayProfileMapping = objEmployeeHolidayProfileMapping.EmployeeHolidayProfileMapping_GetAll(new Entity.HR.EmployeeHolidayProfileMapping());

            if (dtEmployeeHolidayProfileMapping != null &&
                dtEmployeeHolidayProfileMapping.AsEnumerable().Any() &&
                dtEmployeeHolidayProfileMapping.Select("EmployeeMasterId = " + HttpContext.Current.User.Identity.Name).Any())
            {
                holidayProfileId = Convert.ToInt32(dtEmployeeHolidayProfileMapping
                                                   .Select("EmployeeMasterId = " + HttpContext.Current.User.Identity.Name).CopyToDataTable()
                                                   .Rows[0]["HolidayProfileId"].ToString());
            }

            Business.HR.Holiday objHoliday = new Business.HR.Holiday();

            DataTable dt = objHoliday.Holiday_GetAll(new Entity.HR.Holiday()
            {
                HolidayYear      = DateTime.Now.Year,
                HolidayProfileId = holidayProfileId
            });

            if (dt != null)
            {
                gvHoliday.DataSource = dt.Select("Show = 1").CopyToDataTable();
                gvHoliday.DataBind();
            }
        }
示例#2
0
        private void LoadHolidayList()
        {
            Business.HR.Holiday objHoliday = new Business.HR.Holiday();
            DataTable           dt         = objHoliday.Holiday_GetAll(new Entity.HR.Holiday());

            if (dt != null)
            {
                gvHoliday.DataSource = dt;
                gvHoliday.DataBind();
            }
        }
        private List <Models.HolidayModel> LoadHolidayList(int employeeId)
        {
            List <Models.HolidayModel> model          = new List <Models.HolidayModel>();
            int       holidayProfileId                = 0;
            DataTable dtEmployeeHolidayProfileMapping = new Business.HR.HolidayProfile().EmployeeHolidayProfileMapping_GetByEmployeeId(employeeId);

            if (dtEmployeeHolidayProfileMapping != null &&
                dtEmployeeHolidayProfileMapping.AsEnumerable().Any())
            {
                holidayProfileId = Convert.ToInt32(dtEmployeeHolidayProfileMapping.Rows[0]["HolidayProfileId"].ToString());
            }

            Business.HR.Holiday objHoliday = new Business.HR.Holiday();

            DataTable dt = objHoliday.Holiday_GetAll(new Entity.HR.Holiday()
            {
                HolidayYear      = DateTime.Now.Year,
                HolidayProfileId = holidayProfileId
            });

            if (dt != null)
            {
                dt = dt.Select("Show = 1").CopyToDataTable();
                dt.AcceptChanges();

                foreach (DataRow dr in dt.Rows)
                {
                    model.Add(new Models.HolidayModel
                    {
                        HolidayName = dr["HolidayName"].ToString(),
                        HolidayDate = dr["HolidayDate"].ToString()
                    });
                }
            }
            return(model);
        }