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

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

                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = HREmployeeEmergencyContactInfoEntity.FLD_NAME_EmployeeEmergencyContactInfoID + " " + SQLConstants.SORT_ORDER_DESCENDING;
                }

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

                hREmployeeEmergencyContactInfoEntityList = FCCHREmployeeEmergencyContactInfo.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression);

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

            return(hREmployeeEmergencyContactInfoEntityList ?? new List <HREmployeeEmergencyContactInfoEntity>());
        }
        private void SaveHREmployeeEmergencyContactInfoEntity()
        {
            if (IsValid)
            {
                try
                {
                    HREmployeeEmergencyContactInfoEntity hREmployeeEmergencyContactInfoEntity = BuildHREmployeeEmergencyContactInfoEntity();

                    Int64 result = -1;

                    if (hREmployeeEmergencyContactInfoEntity.IsNew)
                    {
                        result = FCCHREmployeeEmergencyContactInfo.GetFacadeCreate().Add(hREmployeeEmergencyContactInfoEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(HREmployeeEmergencyContactInfoEntity.FLD_NAME_EmployeeEmergencyContactInfoID, hREmployeeEmergencyContactInfoEntity.EmployeeEmergencyContactInfoID.ToString(), SQLMatchType.Equal);
                        result = FCCHREmployeeEmergencyContactInfo.GetFacadeCreate().Update(hREmployeeEmergencyContactInfoEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        _EmployeeEmergencyContactInfoID       = 0;
                        _HREmployeeEmergencyContactInfoEntity = new HREmployeeEmergencyContactInfoEntity();
                        PrepareInitialView();
                        BindHREmployeeEmergencyContactInfoList();
                        GetSelectedContactPersonInfo();

                        if (hREmployeeEmergencyContactInfoEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Employee Emergency Contact Info Information has been added successfully.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Employee Emergency Contact Info Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (hREmployeeEmergencyContactInfoEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add Employee Emergency Contact Info Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update Employee Emergency Contact Info Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
        protected void lvHREmployeeEmergencyContactInfo_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 EmployeeEmergencyContactInfoID;

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

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

                    PrepareEditView();

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

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(HREmployeeEmergencyContactInfoEntity.FLD_NAME_EmployeeEmergencyContactInfoID, EmployeeEmergencyContactInfoID.ToString(), SQLMatchType.Equal);

                        HREmployeeEmergencyContactInfoEntity hREmployeeEmergencyContactInfoEntity = new HREmployeeEmergencyContactInfoEntity();


                        result = FCCHREmployeeEmergencyContactInfo.GetFacadeCreate().Delete(hREmployeeEmergencyContactInfoEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _EmployeeEmergencyContactInfoID       = 0;
                            _HREmployeeEmergencyContactInfoEntity = new HREmployeeEmergencyContactInfoEntity();
                            PrepareInitialView();
                            BindHREmployeeEmergencyContactInfoList();
                            GetSelectedContactPersonInfo();

                            MiscUtil.ShowMessage(lblMessage, "Employee Emergency Contact Info has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete Employee Emergency Contact Info.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
        public IList <HREmployeeEmergencyContactInfoEntity> GetData()
        {
            IList <HREmployeeEmergencyContactInfoEntity> hREmployeeEmergencyContactInfoEntityList = new List <HREmployeeEmergencyContactInfoEntity>();

            try
            {
                hREmployeeEmergencyContactInfoEntityList = FCCHREmployeeEmergencyContactInfo.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load);

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

            return(hREmployeeEmergencyContactInfoEntityList ?? new List <HREmployeeEmergencyContactInfoEntity>());
        }