Beispiel #1
0
        public IList <CMConsultantWorkAreaEntity> GetPagedData(Int32 startRowIndex, Int32 pageSize, String sortExpression)
        {
            IList <CMConsultantWorkAreaEntity> cMConsultantWorkAreaEntityList = new List <CMConsultantWorkAreaEntity>();

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

                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = CMConsultantWorkAreaEntity.FLD_NAME_ConsultantWorkAreaID + " " + SQLConstants.SORT_ORDER_DESCENDING;
                }

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

                cMConsultantWorkAreaEntityList = FCCCMConsultantWorkArea.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression);

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

            return(cMConsultantWorkAreaEntityList ?? new List <CMConsultantWorkAreaEntity>());
        }
        private void SaveCMConsultantWorkAreaEntity()
        {
            if (IsValid)
            {
                try
                {
                    CMConsultantWorkAreaEntity cMConsultantWorkAreaEntity = BuildCMConsultantWorkAreaEntity();

                    Int64 result = -1;

                    if (cMConsultantWorkAreaEntity.IsNew)
                    {
                        result = FCCCMConsultantWorkArea.GetFacadeCreate().Add(cMConsultantWorkAreaEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(CMConsultantWorkAreaEntity.FLD_NAME_ConsultantWorkAreaID, cMConsultantWorkAreaEntity.ConsultantWorkAreaID.ToString(), SQLMatchType.Equal);
                        result = FCCCMConsultantWorkArea.GetFacadeCreate().Update(cMConsultantWorkAreaEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        _ConsultantWorkAreaID       = 0;
                        _CMConsultantWorkAreaEntity = new CMConsultantWorkAreaEntity();
                        PrepareInitialView();
                        BindCMConsultantWorkAreaList();

                        if (cMConsultantWorkAreaEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Consultant Work Area Information has been added successfully.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Consultant Work Area Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (cMConsultantWorkAreaEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add Consultant Work Area Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update Consultant Work Area Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
        protected void lvCMConsultantWorkArea_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 ConsultantWorkAreaID;

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

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

                    PrepareEditView();

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

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(CMConsultantWorkAreaEntity.FLD_NAME_ConsultantWorkAreaID, ConsultantWorkAreaID.ToString(), SQLMatchType.Equal);

                        CMConsultantWorkAreaEntity cMConsultantWorkAreaEntity = new CMConsultantWorkAreaEntity();


                        result = FCCCMConsultantWorkArea.GetFacadeCreate().Delete(cMConsultantWorkAreaEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _ConsultantWorkAreaID       = 0;
                            _CMConsultantWorkAreaEntity = new CMConsultantWorkAreaEntity();
                            PrepareInitialView();
                            BindCMConsultantWorkAreaList();

                            MiscUtil.ShowMessage(lblMessage, "Consultant Work Area has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete Consultant Work Area.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
Beispiel #4
0
        public IList <CMConsultantWorkAreaEntity> GetData()
        {
            IList <CMConsultantWorkAreaEntity> cMConsultantWorkAreaEntityList = new List <CMConsultantWorkAreaEntity>();

            try
            {
                cMConsultantWorkAreaEntityList = FCCCMConsultantWorkArea.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load);

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

            return(cMConsultantWorkAreaEntityList ?? new List <CMConsultantWorkAreaEntity>());
        }