示例#1
0
        private void btnStartPacking_Click(object sender, EventArgs e)
        {
            if (DataValidation.Is3DecimalPointNumber(txtPackingQty.Text))
            {
                try
                {
                    DialogResult dr = MessageBox.Show(this, "Do you want to add a new Packing Batch to " + objBatch.BatchID + "from  " + cmbFinishedProduct.SelectedValue.ToString(), "Confirmation", MessageBoxButtons.YesNo);
                    long         i;

                    if (dr == DialogResult.Yes)
                    {
                        if (Convert.ToDecimal(dgvBatchList.CurrentRow.Cells["Remaining"].Value) > 0)
                        {
                            string ActMethod = "";
                            if (chkOutsource.Checked == true)
                            {
                                ActMethod = "Outsource";
                            }
                            else
                            {
                                ActMethod = "Normal";
                            }
                            i = objBatchActivity_DL.Add_Packing_Secondary(objBatch.BatchID, Convert.ToInt32(Batch.Status.Packing), (int)BatchActivity.Status.Finished,
                                                                          (int)BatchActivity.Status.SecondaryPacking, dgvBatchList.CurrentRow.Cells["OutputProduct"].Value.ToString(), cmbFinishedProduct.SelectedValue.ToString()
                                                                          , Convert.ToDecimal(txtPackingQty.Text), CurrentUser.EmployeeID, ActMethod, Convert.ToInt32(dgvBatchList.CurrentRow.Cells["pBatchActID"].Value));


                            if (i == 0)
                            {
                                MessageBox.Show(this, "Quantity you are trying to packing is not a realistic Value", "Wrong Attempt", MessageBoxButtons.OK);
                            }
                            else
                            {
                                Load_SecondaryActivityList();
                                Load_Batch_List();
                            }
                        }
                        else
                        {
                            MessageBox.Show(this, "Invalid Qty", "Wrong Attempt", MessageBoxButtons.OK);
                        }
                    }


                    txtPackingQty.Text = "";
                    cmbFinishedProduct.Select();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message.ToString());
                }
            }
            else
            {
                MessageBox.Show(this, "please enter valid quantity", "MRP System", MessageBoxButtons.OK);
            }
        }