Esempio n. 1
0
 public int AddPartRequest(PartRequest request)
 {
     {
         String       now = DateTime.Now.ToString();
         OleDbCommand cmd = new OleDbCommand();
         if (request.mContactId < 1)
         {
             cmd.CommandText = "INSERT INTO " + REQUESTTABLE + " ([Requestor], [RequestedOn], [PartNumber], [Instructions], [PO], [SerialNumber], " +
                               "[Quantity], [Hot], [CR Ready], [Cage], [Bulk], [Description]) " +
                               "VALUES (@requestor, @requestedOn, @part, @instructions, @po,  @serial, @qty, @hot, @cr, @cage, @bulk, @desc)";
         }
         else
         {
             cmd.CommandText = "INSERT INTO " + REQUESTTABLE + " ([Contact], [Requestor], [RequestedOn], [PartNumber], [Instructions], [PO], [SerialNumber], " +
                               "[Quantity], [Hot],  [CR Ready], [Cage], [Bulk], [Description]) " +
                               "VALUES (@contact, @requestor, @requestedOn, @part, @instructions, @po,  @serial, @qty, @hot, @cr, @cage, @bulk, @desc)";
             cmd.Parameters.AddWithValue("@contact", request.mContactId);
         }
         cmd.Parameters.AddWithValue("@requestor", request.mRequestor);
         cmd.Parameters.AddWithValue("@requestedOn", now);
         cmd.Parameters.AddWithValue("@part", request.mPart);
         cmd.Parameters.AddWithValue("@instructions", request.mInstructions);
         cmd.Parameters.AddWithValue("@po", request.mPO);
         cmd.Parameters.AddWithValue("@serial", request.mSerial);
         cmd.Parameters.AddWithValue("@qty", request.mQty);
         cmd.Parameters.AddWithValue("@hot", request.mHot);
         cmd.Parameters.AddWithValue("@cr", request.mCleanroomReady);
         cmd.Parameters.AddWithValue("@cage", request.mCage);
         cmd.Parameters.AddWithValue("@bulk", request.mBulk);
         cmd.Parameters.AddWithValue("@desc", request.mDescription);
         return(requestDB.AddReturnID(cmd));
     }
 }
Esempio n. 2
0
 private void AddPart(PartRequest req)
 {
     mProgress                           = new ProgressBarForm();
     bGWorkerAddPart                     = new BackgroundWorker();
     bGWorkerAddPart.DoWork             += new DoWorkEventHandler(bGWorkerAddPart_DoWork);
     bGWorkerAddPart.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bGWorkerAddPart_RunWorkerCompleted);
     bGWorkerAddPart.RunWorkerAsync(req);
     mProgress.ShowDialog();
 }
Esempio n. 3
0
        private void btnPartCleanRequest_Click(object sender, EventArgs e)
        {
            errorProviderPartRequestForm.Clear();
            mPartRequest = new PartRequest();
            bool submittable = true;

            // Requestor Empty
            if (textBoxRequestor.Text.Trim() == "" || textBoxRequestor.Text == null)
            {
                errorProviderPartRequestForm.SetError(textBoxRequestor, "Enter Your Name");
                textBoxRequestor.Text = "";
                submittable           = false;
            }
            // Requestor Not empty
            else
            {
                mPartRequest.mRequestor = textBoxRequestor.Text.Trim().ToString();
            }
            // Standard
            if (rBtnStandard.Checked)
            {
                //No Part Selected
                if (comboBoxPart.SelectedIndex == -1)
                {
                    errorProviderPartRequestForm.SetError(comboBoxPart, "Enter Part Number");
                    submittable = false;
                }
                //Part Selected
                else
                {
                    int index = comboBoxPart.FindString(comboBoxPart.Text);
                    if (index < 0)
                    {
                        errorProviderPartRequestForm.SetError(comboBoxPart, "Part Number Not Found");
                        submittable = false;
                    }
                    else
                    {
                        mPartRequest.mPart = comboBoxPart.SelectedValue.ToString();
                        foreach (DataRow row in mPartTable.Rows)
                        {
                            if (mPartRequest.mPart == row["Part"].ToString())
                            {
                                if (!(row["Description"].ToString() == "" | row["Description"].Equals(null)))
                                {
                                    mPartRequest.mDescription = row["Description"].ToString();
                                }
                                else
                                {
                                    mPartRequest.mDescription = "";
                                }
                            }
                        }
                    }
                }
            }
            //Non Standard
            else
            {
                if (!(textBoxDescription.Text.Trim() == "" || textBoxDescription.Text == null))
                {
                    mPartRequest.mPart        = "Non - Standard";
                    mPartRequest.mDescription = textBoxDescription.Text.Trim();
                }
                else
                {
                    errorProviderPartRequestForm.SetError(textBoxDescription, "Enter Description for Non Standard Part");
                    submittable = false;
                }
            }

            if (!(textBoxInstructions.Text.Trim() == "" || textBoxInstructions.Text.ToString() == null))
            {
                mPartRequest.mInstructions = textBoxInstructions.Text.Trim().ToString();
            }
            else
            {
                if (rBtnNonStandard.Checked)
                {
                    errorProviderPartRequestForm.SetError(textBoxInstructions, "Instructions required for Non-Standard Part");
                    submittable = false;
                }
                else
                {
                    mPartRequest.mInstructions = "";
                }
            }

            if (comboBoxContact.SelectedIndex == 0)
            {
                mPartRequest.mContactId = 1;
            }
            else
            {
                mPartRequest.mContactId = int.Parse(comboBoxContact.SelectedValue.ToString());
            }

            if (!(textBoxPO.Text.ToString() == "" || textBoxPO.Text.ToString() == null))
            {
                mPartRequest.mPO = textBoxPO.Text.Trim().ToString();
            }
            else
            {
                mPartRequest.mPO = "";
            }
            if (!(textBoxSerialNumber.Text.Trim().ToString() == "" || textBoxSerialNumber.Text.Trim().ToString() == null))
            {
                mPartRequest.mSerial = textBoxSerialNumber.Text.Trim().ToString();
            }
            else
            {
                mPartRequest.mSerial = "";
            }

            mPartRequest.mQty = (int)numericUpDownQty.Value;

            if (checkBoxHot.Checked)
            {
                mPartRequest.mHot = true;
            }
            else
            {
                mPartRequest.mHot = false;
            }

            if (radioButtonCRYes.Checked == true || radioButtonCRNo.Checked == true)
            {
                if (radioButtonCRYes.Checked == true)
                {
                    mPartRequest.mCleanroomReady = true;
                    if (radioButtonCage.Checked == true || radioButtonBulk.Checked == true)
                    {
                        if (radioButtonCage.Checked == true)
                        {
                            mPartRequest.mCage = true;
                        }
                        else
                        {
                            mPartRequest.mBulk = true;
                        }
                    }
                    else
                    {
                        errorProviderPartRequestForm.SetError(gBoxStockLocation, "Cage or Bulk");
                        submittable = false;
                    }
                }
                else
                {
                    mPartRequest.mCleanroomReady = false;
                }
            }
            else
            {
                errorProviderPartRequestForm.SetError(radioButtonCRNo, "Cleanroom Ready, Yes or No");
                submittable = false;
            }

            if (submittable)
            {
                AddPart(mPartRequest);
            }
        }