コード例 #1
0
        private HRWorkingDayEntity BuildHRWorkingDayEntity()
        {
            HRWorkingDayEntity hRWorkingDayEntity = CurrentHRWorkingDayEntity;

            if (ddlFiscalYearID.Items.Count > 0)
            {
                if (ddlFiscalYearID.SelectedValue == "0")
                {
                }
                else
                {
                    hRWorkingDayEntity.FiscalYearID = Int64.Parse(ddlFiscalYearID.SelectedValue);
                }
            }

            if (ddlSalarySessionID.Items.Count > 0)
            {
                if (ddlSalarySessionID.SelectedValue == "0")
                {
                }
                else
                {
                    hRWorkingDayEntity.SalarySessionID = Int64.Parse(ddlSalarySessionID.SelectedValue);
                }
            }

            return(hRWorkingDayEntity);
        }
コード例 #2
0
        Int64 IHRWorkingDayDataAccess.Add(HRWorkingDayEntity hRWorkingDayEntity, DatabaseOperationType option, TransactionRequired reqTran)
        {
            try
            {
                long retValues = -99;

                switch (reqTran)
                {
                case TransactionRequired.No:
                {
                    retValues = Add(hRWorkingDayEntity, option);
                    break;
                }

                case TransactionRequired.Yes:
                {
                    retValues = AddTran(hRWorkingDayEntity, option);
                    break;
                }

                default:
                {
                    retValues = -99;
                    break;
                }
                }

                return(retValues);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #3
0
        private void BuildAttendanceLeaveAndHolidayCategoryDropDownList()
        {
            IList <ListViewDataItem> list = lvHRWorkingDay.Items;

            if (list != null && list.Count > 0)
            {
                foreach (ListViewDataItem lvdi in list)
                {
                    HRWorkingDayEntity hRWorkingDayEntity = new HRWorkingDayEntity();
                    DropDownList       ddlAttendanceLeaveAndHolidayCategoryID = (DropDownList)lvdi.FindControl("ddlAttendanceLeaveAndHolidayCategoryID");
                    Label   lblAttendanceLeaveAndHolidayCategoryIDLV          = (Label)lvdi.FindControl("lblAttendanceLeaveAndHolidayCategoryIDLV");
                    TextBox txtRemarksLV    = (TextBox)lvdi.FindControl("txtRemarksLV");
                    Label   lblWorkingDayLV = (Label)lvdi.FindControl("lblWorkingDayLV");
                    //HtmlTableCell abc = (HtmlTableCell)lvdi.FindControl("_itemrow");
                    HtmlTableRow abc = (HtmlTableRow)lvdi.FindControl("_itemrow") as HtmlTableRow;

                    hRWorkingDayEntity.AttendanceLeaveAndHolidayCategoryID = Int64.Parse(lblAttendanceLeaveAndHolidayCategoryIDLV.Text);
                    if (hRWorkingDayEntity.AttendanceLeaveAndHolidayCategoryID == 3)
                    {
                        abc.BgColor = "Red";
                    }
                    else if (hRWorkingDayEntity.AttendanceLeaveAndHolidayCategoryID == 1)
                    {
                        abc.BgColor = "Green";
                    }
                    MiscUtil.PopulateMDAttendanceLeaveAndHolidayCategory(ddlAttendanceLeaveAndHolidayCategoryID, false, hRWorkingDayEntity.AttendanceLeaveAndHolidayCategoryID);
                }
            }
        }
コード例 #4
0
        private Int64 AddTran(HRWorkingDayEntity hRWorkingDayEntity, DatabaseOperationType option)
        {
            long         returnCode = -99;
            const string SP         = "dbo.HRWorkingDay_SET";

            Database db = DatabaseFactory.CreateDatabase();

            using (DbCommand cmd = db.GetStoredProcCommand(SP))
            {
                AddOptionParameter(cmd, option, db);
                AddOutputParameter(cmd, db);
                AddNullPrimaryKeyParameter(cmd, "WorkingDayID", db);

                db.AddInParameter(cmd, "@FiscalYearID", DbType.Int64, hRWorkingDayEntity.FiscalYearID);
                db.AddInParameter(cmd, "@SalarySessionID", DbType.Int64, hRWorkingDayEntity.SalarySessionID);
                db.AddInParameter(cmd, "@AttendanceLeaveAndHolidayCategoryID", DbType.Int64, hRWorkingDayEntity.AttendanceLeaveAndHolidayCategoryID);
                db.AddInParameter(cmd, "@Note", DbType.String, hRWorkingDayEntity.Note);
                db.AddInParameter(cmd, "@WorkingDay", DbType.DateTime, hRWorkingDayEntity.WorkingDay);
                db.AddInParameter(cmd, "@Year", DbType.Int32, hRWorkingDayEntity.Year);
                db.AddInParameter(cmd, "@Month", DbType.Int32, hRWorkingDayEntity.Month);
                db.AddInParameter(cmd, "@Day", DbType.Int32, hRWorkingDayEntity.Day);
                db.AddInParameter(cmd, "@Remarks", DbType.String, hRWorkingDayEntity.Remarks);
                db.AddInParameter(cmd, "@Date", DbType.DateTime, hRWorkingDayEntity.Date);
                db.AddInParameter(cmd, "@IsRemoved", DbType.Boolean, hRWorkingDayEntity.IsRemoved);

                DbConnection connection = db.CreateConnection();
                connection.Open();
                DbTransaction transaction = connection.BeginTransaction();

                try
                {
                    returnCode = db.ExecuteNonQuery(cmd, transaction);

                    returnCode = GetReturnCodeFromParameter(cmd, db);

                    if (returnCode > 0)
                    {
                        transaction.Commit();
                    }
                    else
                    {
                        throw new ArgumentException("Error Code." + returnCode.ToString());
                    }
                }
                catch (Exception ex)
                {
                    transaction.Rollback();
                    throw ex;
                }
                finally
                {
                    transaction.Dispose();
                    connection.Close();
                    connection = null;
                }
            }

            return(returnCode);
        }
コード例 #5
0
        private void ReGenerateWorkingDays()
        {
            if (ddlSalarySessionID != null && ddlSalarySessionID.Items.Count > 0)
            {
                MDSalarySessionEntity mDSalarySessionEntity = FCCMDSalarySession.GetFacadeCreate().GetByID(Int64.Parse(ddlSalarySessionID.SelectedValue));

                if (mDSalarySessionEntity != null && mDSalarySessionEntity.SalarySessionID > 0)
                {
                    TimeSpan dt        = mDSalarySessionEntity.SessionEndDate - mDSalarySessionEntity.SessionStartDate;
                    Double   totalDays = dt.TotalDays + 1;
                    Double   holiDay   = 0.0;
                    Double   workDay   = 0.0;

                    IList <HRWorkingDayEntity> lst = new List <HRWorkingDayEntity>();

                    for (Int32 i = 0; i < totalDays; i++)
                    {
                        HRWorkingDayEntity ent = new HRWorkingDayEntity();

                        ent.Date            = mDSalarySessionEntity.SessionStartDate.AddDays(i);
                        ent.FiscalYearID    = mDSalarySessionEntity.FiscalYearID;
                        ent.SalarySessionID = mDSalarySessionEntity.SalarySessionID;
                        ent.WorkingDay      = mDSalarySessionEntity.SessionStartDate.AddDays(i);

                        switch (ent.Date.DayOfWeek)
                        {
                        //Default Weekend
                        case DayOfWeek.Friday:
                            ent.AttendanceLeaveAndHolidayCategoryID = MasterDataConstants.MDAttendanceLeaveAndHolidayCategory.HOLIDAY;
                            holiDay++;
                            break;

                        //Others Holiday will come here.
                        default:
                            ent.AttendanceLeaveAndHolidayCategoryID = MasterDataConstants.MDAttendanceLeaveAndHolidayCategory.WORK_DAY;
                            workDay++;
                            break;
                        }

                        ent.Note      = String.Empty;
                        ent.Year      = ent.Date.Year;
                        ent.Month     = ent.Date.Month;
                        ent.Day       = ent.Date.Day;
                        ent.IsRemoved = false;

                        lst.Add(ent);
                    }

                    lblTotalDay.Text   = totalDays.ToString().Trim();
                    lblHoliday.Text    = holiDay.ToString().Trim();
                    lblWorkingDay.Text = workDay.ToString().Trim();


                    lvHRWorkingDay.DataSource = lst;
                    lvHRWorkingDay.DataBind();
                    BuildAttendanceLeaveAndHolidayCategoryDropDownList();
                }
            }
        }
コード例 #6
0
        private void SaveHRWorkingDayEntity()
        {
            if (IsValid)
            {
                try
                {
                    HRWorkingDayEntity hRWorkingDayEntity = BuildHRWorkingDayEntity();

                    Int64 result = -1;

                    if (hRWorkingDayEntity.IsNew)
                    {
                        result = FCCHRWorkingDay.GetFacadeCreate().Add(hRWorkingDayEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(HRWorkingDayEntity.FLD_NAME_WorkingDayID, hRWorkingDayEntity.WorkingDayID.ToString(), SQLMatchType.Equal);
                        result = FCCHRWorkingDay.GetFacadeCreate().Update(hRWorkingDayEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        _WorkingDayID       = 0;
                        _HRWorkingDayEntity = new HRWorkingDayEntity();
                        PrepareInitialView();
                        BindHRWorkingDayList();

                        if (hRWorkingDayEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Working Day Information has been added successfully.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Working Day Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (hRWorkingDayEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add Working Day Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update Working Day Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
コード例 #7
0
        private Int64 DeleteTran(HRWorkingDayEntity hRWorkingDayEntity, String filterExpression, DatabaseOperationType option)
        {
            long         returnCode = -99;
            const string SP         = "dbo.HRWorkingDay_SET";

            Database db = DatabaseFactory.CreateDatabase();


            using (DbCommand cmd = db.GetStoredProcCommand(SP))
            {
                AddOptionParameter(cmd, option);
                AddOutputParameter(cmd, db);
                AddFilterExpressionParameter(cmd, filterExpression, db);


                DbConnection connection = db.CreateConnection();
                connection.Open();
                DbTransaction transaction = connection.BeginTransaction();

                try
                {
                    using (IDataReader reader = db.ExecuteReader(cmd, transaction))
                    {
                        returnCode = GetReturnCodeFromParameter(cmd);
                    }

                    if (returnCode >= 0)
                    {
                        transaction.Commit();
                    }
                    else
                    {
                        throw new ArgumentException("Error Code." + returnCode.ToString());
                    }
                }
                catch (Exception ex)
                {
                    transaction.Rollback();
                    throw ex;
                }
                finally
                {
                    transaction.Dispose();
                    connection.Close();
                    connection = null;
                }
            }

            return(returnCode);
        }
コード例 #8
0
        private Int64 Update(HRWorkingDayEntity hRWorkingDayEntity, String filterExpression, DatabaseOperationType option)
        {
            long         returnCode = -99;
            const string SP         = "dbo.HRWorkingDay_SET";

            using (DbCommand cmd = Database.GetStoredProcCommand(SP))
            {
                AddOptionParameter(cmd, option);
                AddOutputParameter(cmd);
                AddFilterExpressionParameter(cmd, filterExpression);

                Database.AddInParameter(cmd, "@WorkingDayID", DbType.Int64, hRWorkingDayEntity.WorkingDayID);
                Database.AddInParameter(cmd, "@FiscalYearID", DbType.Int64, hRWorkingDayEntity.FiscalYearID);
                Database.AddInParameter(cmd, "@SalarySessionID", DbType.Int64, hRWorkingDayEntity.SalarySessionID);
                Database.AddInParameter(cmd, "@AttendanceLeaveAndHolidayCategoryID", DbType.Int64, hRWorkingDayEntity.AttendanceLeaveAndHolidayCategoryID);
                Database.AddInParameter(cmd, "@Note", DbType.String, hRWorkingDayEntity.Note);
                Database.AddInParameter(cmd, "@WorkingDay", DbType.DateTime, hRWorkingDayEntity.WorkingDay);
                Database.AddInParameter(cmd, "@Year", DbType.Int32, hRWorkingDayEntity.Year);
                Database.AddInParameter(cmd, "@Month", DbType.Int32, hRWorkingDayEntity.Month);
                Database.AddInParameter(cmd, "@Day", DbType.Int32, hRWorkingDayEntity.Day);
                Database.AddInParameter(cmd, "@Remarks", DbType.String, hRWorkingDayEntity.Remarks);
                Database.AddInParameter(cmd, "@Date", DbType.DateTime, hRWorkingDayEntity.Date);
                Database.AddInParameter(cmd, "@IsRemoved", DbType.Boolean, hRWorkingDayEntity.IsRemoved);

                using (IDataReader reader = Database.ExecuteReader(cmd))
                {
                    returnCode = GetReturnCodeFromParameter(cmd);

                    switch (returnCode)
                    {
                    case SqlConstants.DB_STATUS_CODE_DATAALREADYEXIST:
                    {
                        throw new ArgumentException("HRWorkingDayEntity already exists. Please specify another HRWorkingDayEntity.");
                    }

                    case SqlConstants.DB_STATUS_CODE_DATAUPDATEDFROMOTHERSESSION:
                    {
                        throw new ArgumentException("HRWorkingDayEntity data already updated from different session.");
                    }

                    case SqlConstants.DB_STATUS_CODE_FAIL_OPERATION:
                    {
                        throw new ArgumentException("HRWorkingDayEntity already exists. Please specify another HRWorkingDayEntity.");
                    }
                    }
                }
            }

            return(returnCode);
        }
コード例 #9
0
        protected void lvHRWorkingDay_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 WorkingDayID;

            Int64.TryParse(e.CommandArgument.ToString(), out WorkingDayID);

            if (WorkingDayID > 0)
            {
                if (string.Equals(e.CommandName, "EditItem"))
                {
                    _WorkingDayID = WorkingDayID;

                    PrepareEditView();
                }
                else if (string.Equals(e.CommandName, "DeleteItem"))
                {
                    try
                    {
                        Int64 result = -1;

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(HRWorkingDayEntity.FLD_NAME_WorkingDayID, WorkingDayID.ToString(), SQLMatchType.Equal);

                        HRWorkingDayEntity hRWorkingDayEntity = new HRWorkingDayEntity();


                        result = FCCHRWorkingDay.GetFacadeCreate().Delete(hRWorkingDayEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _WorkingDayID       = 0;
                            _HRWorkingDayEntity = new HRWorkingDayEntity();
                            PrepareInitialView();
                            BindHRWorkingDayList();

                            MiscUtil.ShowMessage(lblMessage, "Working Day has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete Working Day.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
コード例 #10
0
        private void PrepareEditView()
        {
            HRWorkingDayEntity hRWorkingDayEntity = CurrentHRWorkingDayEntity;


            if (!hRWorkingDayEntity.IsNew)
            {
                if (ddlFiscalYearID.Items.Count > 0 && hRWorkingDayEntity.FiscalYearID != null)
                {
                    ddlFiscalYearID.SelectedValue = hRWorkingDayEntity.FiscalYearID.ToString();
                }

                if (ddlSalarySessionID.Items.Count > 0 && hRWorkingDayEntity.SalarySessionID != null)
                {
                    ddlSalarySessionID.SelectedValue = hRWorkingDayEntity.SalarySessionID.ToString();
                }

                btnSubmit.Text = "Save";
            }
        }
コード例 #11
0
        private Int64 Delete(HRWorkingDayEntity hRWorkingDayEntity, String filterExpression, DatabaseOperationType option)
        {
            long         returnCode = -99;
            const string SP         = "dbo.HRWorkingDay_SET";

            using (DbCommand cmd = Database.GetStoredProcCommand(SP))
            {
                AddOptionParameter(cmd, option);
                AddOutputParameter(cmd);
                AddFilterExpressionParameter(cmd, filterExpression);


                using (IDataReader reader = Database.ExecuteReader(cmd))
                {
                    returnCode = GetReturnCodeFromParameter(cmd);

                    switch (returnCode)
                    {
                    case SqlConstants.DB_STATUS_CODE_DATAALREADYEXIST:
                    {
                        throw new ArgumentException("HRWorkingDayEntity already exists. Please specify another HRWorkingDayEntity.");
                    }

                    case SqlConstants.DB_STATUS_CODE_DATAUPDATEDFROMOTHERSESSION:
                    {
                        throw new ArgumentException("HRWorkingDayEntity data already updated from different session.");
                    }

                    case SqlConstants.DB_STATUS_CODE_FAIL_OPERATION:
                    {
                        throw new ArgumentException("HRWorkingDayEntity already exists. Please specify another HRWorkingDayEntity.");
                    }
                    }
                }
            }

            return(returnCode);
        }
コード例 #12
0
 Int64 IHRWorkingDayFacade.Delete(HRWorkingDayEntity hRWorkingDayEntity, String filterExpression, DatabaseOperationType option, TransactionRequired reqTran)
 {
     return(DataAccessFactory.CreateHRWorkingDayDataAccess().Delete(hRWorkingDayEntity, filterExpression, option, reqTran));
 }
コード例 #13
0
 Int64 IHRWorkingDayFacade.Add(HRWorkingDayEntity hRWorkingDayEntity, DatabaseOperationType option, TransactionRequired reqTran)
 {
     return(DataAccessFactory.CreateHRWorkingDayDataAccess().Add(hRWorkingDayEntity, option, reqTran));
 }
コード例 #14
0
 protected void btnAddNew_Click(object sender, EventArgs e)
 {
     _WorkingDayID       = 0;
     _HRWorkingDayEntity = new HRWorkingDayEntity();
     PrepareInitialView();
 }
コード例 #15
0
        private void UpdateBOQInfo()
        {
            try
            {
                IList <ListViewDataItem> list = lvHRWorkingDay.Items;

                if (list != null && list.Count > 0)
                {
                    foreach (ListViewDataItem lvdi in list)
                    {
                        HRWorkingDayEntity hRWorkingDayEntity = new HRWorkingDayEntity();
                        Label        lblFiscalYearIDLV        = (Label)lvdi.FindControl("lblFiscalYearIDLV");
                        Label        lblSalarySessionIDLV     = (Label)lvdi.FindControl("lblSalarySessionIDLV");
                        Label        lblYearLV   = (Label)lvdi.FindControl("lblYearLV");
                        Label        lblMonthLV  = (Label)lvdi.FindControl("lblMonthLV");
                        Label        lblDayLV    = (Label)lvdi.FindControl("lblDayLV");
                        Label        lblDateLV   = (Label)lvdi.FindControl("lblDateLV");
                        Label        lblNoteIDLV = (Label)lvdi.FindControl("lblNoteIDLV");
                        Label        lblAttendanceLeaveAndHolidayCategoryIDLV = (Label)lvdi.FindControl("lblAttendanceLeaveAndHolidayCategoryIDLV");
                        Label        lblWorkingDayLV = (Label)lvdi.FindControl("lblWorkingDayLV");
                        TextBox      txtRemarksLV    = (TextBox)lvdi.FindControl("txtRemarksLV");
                        DropDownList ddlAttendanceLeaveAndHolidayCategoryID = (DropDownList)lvdi.FindControl("ddlAttendanceLeaveAndHolidayCategoryID");


                        hRWorkingDayEntity.FiscalYearID    = Int64.Parse(lblFiscalYearIDLV.Text);
                        hRWorkingDayEntity.SalarySessionID = Int64.Parse(lblSalarySessionIDLV.Text);
                        hRWorkingDayEntity.SalarySessionID = Int64.Parse(lblSalarySessionIDLV.Text);
                        hRWorkingDayEntity.Date            = MiscUtil.ParseToDateTime(lblDateLV.Text);
                        hRWorkingDayEntity.WorkingDay      = MiscUtil.ParseToDateTime(lblWorkingDayLV.Text);
                        //hRWorkingDayEntity.AttendanceLeaveAndHolidayCategoryID = Int64.Parse(lblAttendanceLeaveAndHolidayCategoryIDLV.Text);
                        hRWorkingDayEntity.AttendanceLeaveAndHolidayCategoryID = Int64.Parse(ddlAttendanceLeaveAndHolidayCategoryID.SelectedValue);
                        hRWorkingDayEntity.Note      = String.Empty;
                        hRWorkingDayEntity.Year      = Int32.Parse(lblYearLV.Text);
                        hRWorkingDayEntity.Month     = Int32.Parse(lblMonthLV.Text);
                        hRWorkingDayEntity.Day       = Int32.Parse(lblDayLV.Text);
                        hRWorkingDayEntity.Remarks   = txtRemarksLV.Text;
                        hRWorkingDayEntity.IsRemoved = false;

                        #region Check for update
                        Boolean isSaveFlag = true;

                        String fe = "FiscalYearID = " + hRWorkingDayEntity.FiscalYearID + " and SalarySessionID=" + hRWorkingDayEntity.SalarySessionID + " and WorkingDay='" + hRWorkingDayEntity.WorkingDay + "'";
                        IList <HRWorkingDayEntity> hRWorkingDayList = FCCHRWorkingDay.GetFacadeCreate().GetIL(1000, 1, String.Empty, fe, DatabaseOperationType.LoadWithFilterExpression);
                        if (hRWorkingDayList != null && hRWorkingDayList.Count > 0)
                        {
                            isSaveFlag = false;
                        }

                        #endregion
                        if (isSaveFlag)
                        {
                            FCCHRWorkingDay.GetFacadeCreate().Add(hRWorkingDayEntity, DatabaseOperationType.Add, TransactionRequired.No);
                        }
                        else
                        {
                            String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(HRWorkingDayEntity.FLD_NAME_WorkingDayID, hRWorkingDayList[0].WorkingDayID.ToString(), SQLMatchType.Equal);
                            FCCHRWorkingDay.GetFacadeCreate().Update(hRWorkingDayEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                        }
                    }

                    MiscUtil.ShowMessage(lblMessage, "Working Day has been saved successfully.", false);
                    GenerateWorkingDays();
                }
            }
            catch (Exception ex)
            {
                MiscUtil.ShowMessage(lblMessage, "Failed to Save Project Cost Information.", true);
            }
        }
コード例 #16
0
        private void GenerateWorkingDays()
        {
            if (ddlSalarySessionID != null && ddlSalarySessionID.Items.Count > 0)
            {
                MDSalarySessionEntity mDSalarySessionEntity = FCCMDSalarySession.GetFacadeCreate().GetByID(Int64.Parse(ddlSalarySessionID.SelectedValue));

                if (mDSalarySessionEntity != null && mDSalarySessionEntity.SalarySessionID > 0)
                {
                    TimeSpan dt        = mDSalarySessionEntity.SessionEndDate - mDSalarySessionEntity.SessionStartDate;
                    Double   totalDays = dt.TotalDays + 1;
                    Double   holiDay   = 0.0;
                    Double   workDay   = 0.0;

                    IList <HRWorkingDayEntity> lst = new List <HRWorkingDayEntity>();

                    for (Int32 i = 0; i < totalDays; i++)
                    {
                        HRWorkingDayEntity ent = new HRWorkingDayEntity();

                        ent.Date            = mDSalarySessionEntity.SessionStartDate.AddDays(i);
                        ent.FiscalYearID    = mDSalarySessionEntity.FiscalYearID;
                        ent.SalarySessionID = mDSalarySessionEntity.SalarySessionID;
                        ent.WorkingDay      = mDSalarySessionEntity.SessionStartDate.AddDays(i);

                        switch (ent.Date.DayOfWeek)
                        {
                        //Default Weekend
                        case DayOfWeek.Friday:
                            ent.AttendanceLeaveAndHolidayCategoryID = MasterDataConstants.MDAttendanceLeaveAndHolidayCategory.HOLIDAY;
                            holiDay++;
                            break;

                        //Others Holiday will come here.
                        default:
                            ent.AttendanceLeaveAndHolidayCategoryID = MasterDataConstants.MDAttendanceLeaveAndHolidayCategory.WORK_DAY;
                            workDay++;
                            break;
                        }

                        ent.Note      = String.Empty;
                        ent.Year      = ent.Date.Year;
                        ent.Month     = ent.Date.Month;
                        ent.Day       = ent.Date.Day;
                        ent.IsRemoved = false;

                        lst.Add(ent);
                    }

                    btnReGenerate.Enabled = false;

                    #region HasList

                    String fe = "FiscalYearID = " + Int64.Parse(ddlFiscalYearID.SelectedValue) + " and SalarySessionID=" + Int64.Parse(ddlSalarySessionID.SelectedValue) + "";
                    IList <HRWorkingDayEntity> hRWorkingDayList = FCCHRWorkingDay.GetFacadeCreate().GetIL(1000, 1, String.Empty, fe, DatabaseOperationType.LoadWithFilterExpression);
                    if (hRWorkingDayList != null && hRWorkingDayList.Count > 0)
                    {
                        lst     = hRWorkingDayList;
                        holiDay = 0.0;
                        workDay = 0.0;
                        foreach (HRWorkingDayEntity entity in hRWorkingDayList)
                        {
                            if (entity.AttendanceLeaveAndHolidayCategoryID == MasterDataConstants.MDAttendanceLeaveAndHolidayCategory.HOLIDAY)
                            {
                                holiDay++;
                            }
                            else if (entity.AttendanceLeaveAndHolidayCategoryID == MasterDataConstants.MDAttendanceLeaveAndHolidayCategory.WORK_DAY)
                            {
                                workDay++;
                            }
                        }

                        btnSubmit.Text        = "Update";
                        btnReGenerate.Enabled = true;
                    }

                    #endregion
                    lblTotalDay.Text   = totalDays.ToString().Trim();
                    lblHoliday.Text    = holiDay.ToString().Trim();
                    lblWorkingDay.Text = workDay.ToString().Trim();


                    lvHRWorkingDay.DataSource = lst;
                    lvHRWorkingDay.DataBind();
                    BuildAttendanceLeaveAndHolidayCategoryDropDownList();
                }
            }
        }