コード例 #1
0
        private bool SaveChanges()
        {
            int selectedID = -1;

            if (m_CurrentPoolID.Oid == -1)
            {
            }
            else
            {
                selectedID = poolSearchGridView.FocusedRowHandle;
            }

            if (ItemPoolBLL.ValidateRecord(codeTextEdit.Text, (int?)customerLookUpEdit.EditValue))
            {
                m_CurrentPoolID.PoolCode        = codeTextEdit.Text;
                m_CurrentPoolID.PoolDescription = descriptionMemoEdit.Text;
                m_CurrentPoolID.PoolCustomerID  = CustomersBLL.GetCustomer(Convert.ToInt32(customerLookUpEdit.EditValue), m_ItemPoolSession);
                m_CurrentPoolID.PoolType        = "BP";
            }
            else
            {
                MessageBox.Show("You must provide a Pool Code, and Customer name before saving the record.");
                return(false);
            }

            try
            {
                m_CurrentPoolID.Save();
            }
            catch (ApplicationException ex)
            {
                MessageBox.Show(ex.Message, "Error Encountered", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }

            //Save the details here
            foreach (ItemPoolDetails poolDetail in poolDetailsXpCollection)
            {
                if (poolDetail.ItemPoolID == null || poolDetail.ItemPoolID.Oid == -1)
                {
                    poolDetail.ItemPoolID = m_CurrentPoolID;
                }
                poolDetail.Save();
            }

            BindPoolSearch();
            BindPoolControls(m_CurrentPoolID.Oid);
            poolSearchGridView.FocusedRowHandle = selectedID;
            return(true);
        }
コード例 #2
0
        private void deleteBarButtonItem_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (MessageBox.Show("Are you sure you want to delete this item pool.", "Delete Item Pool", MessageBoxButtons.YesNo, MessageBoxIcon.Hand) == DialogResult.No)
            {
                return;
            }

            if (ItemPoolBLL.DeleteItemPool(m_CurrentPoolID.Oid) != true)
            {
                MessageBox.Show("The item pool was not deleted.", "Error Encountered", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            else
            {
                BindPoolSearch();
            }
        }