public IList <HRWorkingDayEntity> GetPagedData(Int32 startRowIndex, Int32 pageSize, String sortExpression)
        {
            IList <HRWorkingDayEntity> hRWorkingDayEntityList = new List <HRWorkingDayEntity>();

            try
            {
                if (pageSize == -1)
                {
                    pageSize = 1000000000;
                }

                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = HRWorkingDayEntity.FLD_NAME_WorkingDayID + " " + SQLConstants.SORT_ORDER_DESCENDING;
                }

                startRowIndex = Convert.ToInt32(startRowIndex / pageSize) + 1;

                hRWorkingDayEntityList = FCCHRWorkingDay.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression);

                if (hRWorkingDayEntityList != null && hRWorkingDayEntityList.Count > 0)
                {
                    totalRowCount = hRWorkingDayEntityList[0].TotalRowCount;
                }
            }
            catch (Exception ex)
            {
            }

            return(hRWorkingDayEntityList ?? new List <HRWorkingDayEntity>());
        }
Пример #2
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);
                }
            }
        }
Пример #3
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);
                    }
                }
            }
        }
        public IList <HRWorkingDayEntity> GetData()
        {
            IList <HRWorkingDayEntity> hRWorkingDayEntityList = new List <HRWorkingDayEntity>();

            try
            {
                hRWorkingDayEntityList = FCCHRWorkingDay.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load);

                if (hRWorkingDayEntityList != null && hRWorkingDayEntityList.Count > 0)
                {
                    totalRowCount = hRWorkingDayEntityList[0].TotalRowCount;
                }
            }
            catch (Exception ex)
            {
            }

            return(hRWorkingDayEntityList ?? new List <HRWorkingDayEntity>());
        }
Пример #5
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);
            }
        }
Пример #6
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();
                }
            }
        }