Esempio n. 1
0
        public IList <MDDrivingLicenseCategoryEntity> GetPagedData(Int32 startRowIndex, Int32 pageSize, String sortExpression)
        {
            IList <MDDrivingLicenseCategoryEntity> mDDrivingLicenseCategoryEntityList = new List <MDDrivingLicenseCategoryEntity>();

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

                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = MDDrivingLicenseCategoryEntity.FLD_NAME_DrivingLicenseCategoryID + " " + SQLConstants.SORT_ORDER_DESCENDING;
                }

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

                mDDrivingLicenseCategoryEntityList = FCCMDDrivingLicenseCategory.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression);

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

            return(mDDrivingLicenseCategoryEntityList ?? new List <MDDrivingLicenseCategoryEntity>());
        }
        private void SaveMDDrivingLicenseCategoryEntity()
        {
            if (IsValid)
            {
                try
                {
                    MDDrivingLicenseCategoryEntity mDDrivingLicenseCategoryEntity = BuildMDDrivingLicenseCategoryEntity();

                    Int64 result = -1;

                    if (mDDrivingLicenseCategoryEntity.IsNew)
                    {
                        result = FCCMDDrivingLicenseCategory.GetFacadeCreate().Add(mDDrivingLicenseCategoryEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(MDDrivingLicenseCategoryEntity.FLD_NAME_DrivingLicenseCategoryID, mDDrivingLicenseCategoryEntity.DrivingLicenseCategoryID.ToString(), SQLMatchType.Equal);
                        result = FCCMDDrivingLicenseCategory.GetFacadeCreate().Update(mDDrivingLicenseCategoryEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        _DrivingLicenseCategoryID       = 0;
                        _MDDrivingLicenseCategoryEntity = new MDDrivingLicenseCategoryEntity();
                        PrepareInitialView();
                        BindMDDrivingLicenseCategoryList();

                        if (mDDrivingLicenseCategoryEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Driving License Category Information has been added successfully.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Driving License Category Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (mDDrivingLicenseCategoryEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add Driving License Category Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update Driving License Category Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
        protected void lvMDDrivingLicenseCategory_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 DrivingLicenseCategoryID;

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

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

                    PrepareEditView();

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

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(MDDrivingLicenseCategoryEntity.FLD_NAME_DrivingLicenseCategoryID, DrivingLicenseCategoryID.ToString(), SQLMatchType.Equal);

                        MDDrivingLicenseCategoryEntity mDDrivingLicenseCategoryEntity = new MDDrivingLicenseCategoryEntity();


                        result = FCCMDDrivingLicenseCategory.GetFacadeCreate().Delete(mDDrivingLicenseCategoryEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _DrivingLicenseCategoryID       = 0;
                            _MDDrivingLicenseCategoryEntity = new MDDrivingLicenseCategoryEntity();
                            PrepareInitialView();
                            BindMDDrivingLicenseCategoryList();

                            MiscUtil.ShowMessage(lblMessage, "Driving License Category has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete Driving License Category.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
Esempio n. 4
0
        public IList <MDDrivingLicenseCategoryEntity> GetData()
        {
            IList <MDDrivingLicenseCategoryEntity> mDDrivingLicenseCategoryEntityList = new List <MDDrivingLicenseCategoryEntity>();

            try
            {
                mDDrivingLicenseCategoryEntityList = FCCMDDrivingLicenseCategory.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load);

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

            return(mDDrivingLicenseCategoryEntityList ?? new List <MDDrivingLicenseCategoryEntity>());
        }