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

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

                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = HRHolidayEntity.FLD_NAME_HolidayID + " " + SQLConstants.SORT_ORDER_DESCENDING;
                }

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

                hRHolidayEntityList = FCCHRHoliday.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression);

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

            return(hRHolidayEntityList ?? new List <HRHolidayEntity>());
        }
示例#2
0
        private void SaveHRHolidayEntity()
        {
            if (IsValid)
            {
                try
                {
                    HRHolidayEntity hRHolidayEntity = BuildHRHolidayEntity();

                    Int64 result = -1;

                    if (hRHolidayEntity.IsNew)
                    {
                        result = FCCHRHoliday.GetFacadeCreate().Add(hRHolidayEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(HRHolidayEntity.FLD_NAME_HolidayID, hRHolidayEntity.HolidayID.ToString(), SQLMatchType.Equal);
                        result = FCCHRHoliday.GetFacadeCreate().Update(hRHolidayEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        _HolidayID       = 0;
                        _HRHolidayEntity = new HRHolidayEntity();
                        PrepareInitialView();
                        BindHRHolidayList();

                        if (hRHolidayEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Holiday Information has been added successfully.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Holiday Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (hRHolidayEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add Holiday Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update Holiday Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
示例#3
0
        protected void lvHRHoliday_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 HolidayID;

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

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

                    PrepareEditView();

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

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(HRHolidayEntity.FLD_NAME_HolidayID, HolidayID.ToString(), SQLMatchType.Equal);

                        HRHolidayEntity hRHolidayEntity = new HRHolidayEntity();


                        result = FCCHRHoliday.GetFacadeCreate().Delete(hRHolidayEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _HolidayID       = 0;
                            _HRHolidayEntity = new HRHolidayEntity();
                            PrepareInitialView();
                            BindHRHolidayList();

                            MiscUtil.ShowMessage(lblMessage, "Holiday has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete Holiday.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
        public IList <HRHolidayEntity> GetData()
        {
            IList <HRHolidayEntity> hRHolidayEntityList = new List <HRHolidayEntity>();

            try
            {
                hRHolidayEntityList = FCCHRHoliday.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load);

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

            return(hRHolidayEntityList ?? new List <HRHolidayEntity>());
        }