Beispiel #1
0
        private void LoadMaterialList()
        {
            try
            {
                if (cmbBatchNo.SelectedValue != null)
                {
                    DepID = objBasicProductDL.Get_Department(objBatch_DL.Get(cmbBatchNo.SelectedValue.ToString()).StandardBatch.STDBatchBasicProduct.BasicProductCode, "Manf");

                    if (cmbPart.Text != "")
                    {
                        if (objBatch_DL.GetMaterialRequisitionStatus_ByPart(cmbBatchNo.SelectedValue.ToString(), cmbPart.Text) == 0)
                        {
                            btnAdd.Enabled    = false;
                            btnSendMR.Enabled = false;
                            btnRemove.Enabled = false;
                        }
                        else
                        {
                            btnAdd.Enabled    = true;
                            btnSendMR.Enabled = true;
                            btnRemove.Enabled = true;
                        }
                    }
                }

                BatchFormulaMaterial_DL objBatchFormulaMaterial_DL = new BatchFormulaMaterial_DL(ConnectionStringClass.GetConnection());

                if ((cmbBatchNo.SelectedValue != null) && (cmbPart.Text != ""))
                {
                    DataTable dt = objBatchFormulaMaterial_DL.GetView(cmbBatchNo.SelectedValue.ToString(), cmbPart.Text);

                    dgvItemList.AutoGenerateColumns  = false;
                    objSourceMaterialList.DataSource = dt;
                    dgvItemList.DataSource           = objSourceMaterialList;
                    objSourceMaterialList.ResetBindings(true);

                    DataTable dtRequested = objMRMaterialDL.Get_RequestedMaterial(cmbBatchNo.SelectedValue.ToString(), cmbPart.Text);

                    dgvItemRequested.AutoGenerateColumns = false;
                    objsourceRequested.DataSource        = dtRequested;
                    dgvItemRequested.DataSource          = objsourceRequested;
                    objsourceRequested.ResetBindings(true);
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }