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

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

                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = MDBloodGroupEntity.FLD_NAME_BloodGroupID + " " + SQLConstants.SORT_ORDER_DESCENDING;
                }

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

                mDBloodGroupEntityList = FCCMDBloodGroup.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression);

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

            return(mDBloodGroupEntityList ?? new List <MDBloodGroupEntity>());
        }
Exemplo n.º 2
0
        private void SaveMDBloodGroupEntity()
        {
            if (IsValid)
            {
                try
                {
                    MDBloodGroupEntity mDBloodGroupEntity = BuildMDBloodGroupEntity();

                    Int64 result = -1;

                    if (mDBloodGroupEntity.IsNew)
                    {
                        result = FCCMDBloodGroup.GetFacadeCreate().Add(mDBloodGroupEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(MDBloodGroupEntity.FLD_NAME_BloodGroupID, mDBloodGroupEntity.BloodGroupID.ToString(), SQLMatchType.Equal);
                        result = FCCMDBloodGroup.GetFacadeCreate().Update(mDBloodGroupEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        _BloodGroupID       = 0;
                        _MDBloodGroupEntity = new MDBloodGroupEntity();
                        PrepareInitialView();
                        BindMDBloodGroupList();

                        if (mDBloodGroupEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Blood Group Information has been added successfully.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Blood Group Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (mDBloodGroupEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add Blood Group Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update Blood Group Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
Exemplo n.º 3
0
        protected void lvMDBloodGroup_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 BloodGroupID;

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

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

                    PrepareEditView();

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

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(MDBloodGroupEntity.FLD_NAME_BloodGroupID, BloodGroupID.ToString(), SQLMatchType.Equal);

                        MDBloodGroupEntity mDBloodGroupEntity = new MDBloodGroupEntity();


                        result = FCCMDBloodGroup.GetFacadeCreate().Delete(mDBloodGroupEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _BloodGroupID       = 0;
                            _MDBloodGroupEntity = new MDBloodGroupEntity();
                            PrepareInitialView();
                            BindMDBloodGroupList();

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

            try
            {
                mDBloodGroupEntityList = FCCMDBloodGroup.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load);

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

            return(mDBloodGroupEntityList ?? new List <MDBloodGroupEntity>());
        }