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

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

                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = MDSupplierItemCategoryEntity.FLD_NAME_SupplierItemCategoryID + " " + SQLConstants.SORT_ORDER_DESCENDING;
                }

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

                mDSupplierItemCategoryEntityList = FCCMDSupplierItemCategory.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression);

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

            return(mDSupplierItemCategoryEntityList ?? new List <MDSupplierItemCategoryEntity>());
        }
        private void BindPRMSupplierItemCategoryMapList()
        {
            IList <MDSupplierItemCategoryEntity> supplierItemCategoryList = FCCMDSupplierItemCategory.GetFacadeCreate().GetIL(null, null, String.Empty, String.Empty, DatabaseOperationType.Load);

            chbxItemCategory.DataSource     = supplierItemCategoryList;
            chbxItemCategory.DataTextField  = "Name";
            chbxItemCategory.DataValueField = "SupplierItemCategoryID";
            chbxItemCategory.DataBind();

            if (chbxItemCategory != null && chbxItemCategory.Items.Count > 0)
            {
                String fe = SqlExpressionBuilder.PrepareFilterExpression(PRMSupplierItemCategoryMapEntity.FLD_NAME_SupplierID, this.OverviewSupplierID.ToString(), SQLMatchType.Equal);
                IList <PRMSupplierItemCategoryMapEntity> supplierItemCategoryMapList = FCCPRMSupplierItemCategoryMap.GetFacadeCreate().GetIL(null, null, String.Empty, fe, DatabaseOperationType.LoadWithFilterExpression);

                if (supplierItemCategoryMapList != null && supplierItemCategoryMapList.Count > 0)
                {
                    _CurrentSupplierItemCategoryList = supplierItemCategoryMapList;

                    foreach (PRMSupplierItemCategoryMapEntity ent in supplierItemCategoryMapList)
                    {
                        foreach (ListItem chbxItem in chbxItemCategory.Items)
                        {
                            if (ent.SupplierItemCategoryID.ToString() == chbxItem.Value.ToString())
                            {
                                chbxItem.Selected = true;
                                break;
                            }
                        }
                    }
                }
            }
        }
        private void SaveMDSupplierItemCategoryEntity()
        {
            if (IsValid)
            {
                try
                {
                    MDSupplierItemCategoryEntity mDSupplierItemCategoryEntity = BuildMDSupplierItemCategoryEntity();

                    Int64 result = -1;

                    if (mDSupplierItemCategoryEntity.IsNew)
                    {
                        result = FCCMDSupplierItemCategory.GetFacadeCreate().Add(mDSupplierItemCategoryEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(MDSupplierItemCategoryEntity.FLD_NAME_SupplierItemCategoryID, mDSupplierItemCategoryEntity.SupplierItemCategoryID.ToString(), SQLMatchType.Equal);
                        result = FCCMDSupplierItemCategory.GetFacadeCreate().Update(mDSupplierItemCategoryEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        _SupplierItemCategoryID       = 0;
                        _MDSupplierItemCategoryEntity = new MDSupplierItemCategoryEntity();
                        PrepareInitialView();
                        BindMDSupplierItemCategoryList();

                        if (mDSupplierItemCategoryEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Vendor Item Category Information has been added successfully.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Vendor Item Category Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (mDSupplierItemCategoryEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add Vendor Item Category Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update Vendor Item Category Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
        protected void lvMDSupplierItemCategory_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 SupplierItemCategoryID;

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

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

                    PrepareEditView();

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

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(MDSupplierItemCategoryEntity.FLD_NAME_SupplierItemCategoryID, SupplierItemCategoryID.ToString(), SQLMatchType.Equal);

                        MDSupplierItemCategoryEntity mDSupplierItemCategoryEntity = new MDSupplierItemCategoryEntity();


                        result = FCCMDSupplierItemCategory.GetFacadeCreate().Delete(mDSupplierItemCategoryEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _SupplierItemCategoryID       = 0;
                            _MDSupplierItemCategoryEntity = new MDSupplierItemCategoryEntity();
                            PrepareInitialView();
                            BindMDSupplierItemCategoryList();

                            MiscUtil.ShowMessage(lblMessage, "Vendor Item Category has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete Vendor Item Category.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
Esempio n. 5
0
        public IList <MDSupplierItemCategoryEntity> GetData()
        {
            IList <MDSupplierItemCategoryEntity> mDSupplierItemCategoryEntityList = new List <MDSupplierItemCategoryEntity>();

            try
            {
                mDSupplierItemCategoryEntityList = FCCMDSupplierItemCategory.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load);

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

            return(mDSupplierItemCategoryEntityList ?? new List <MDSupplierItemCategoryEntity>());
        }