示例#1
0
 public int AddGunRequest(GunRequest request)
 {
     {
         String       now = DateTime.Now.ToString();
         OleDbCommand cmd = new OleDbCommand();
         if (request.mContactId < 1)
         {
             cmd.CommandText = "INSERT INTO " + REQUESTTABLE + " ([Requestor], [RequestedOn], [PartNumber], [Instructions], [SerialNumber], [Hot], [Quantity], [Description]) " +
                               "VALUES (@requestor, @requestedOn, @type, @instructions, @serial, @hot, @qty, @desc)";
         }
         else
         {
             cmd.CommandText = "INSERT INTO " + REQUESTTABLE + " ([Contact], [Requestor], [RequestedOn], [PartNumber], [Instructions], [SerialNumber], [Hot], [Quantity], [Description]) " +
                               "VALUES (@contact, @requestor, @requestedOn, @type, @instructions,  @serial, @hot, @qty, @desc)";
             cmd.Parameters.AddWithValue("@contact", request.mContactId);
         }
         cmd.Parameters.AddWithValue("@requestor", request.mRequestor);
         cmd.Parameters.AddWithValue("@requestedOn", now);
         cmd.Parameters.AddWithValue("@type", request.mType);
         cmd.Parameters.AddWithValue("@instructions", request.mInstructions);
         cmd.Parameters.AddWithValue("@serial", request.mSerial);
         cmd.Parameters.AddWithValue("@hot", request.mHot);
         cmd.Parameters.AddWithValue("@qty", request.mQty);
         cmd.Parameters.AddWithValue("@desc", request.mDescription);
         return(requestDB.AddReturnID(cmd));
     }
 }
示例#2
0
 private void AddColumn(GunRequest req)
 {
     mProgress                             = new ProgressBarForm();
     bGWorkerAddColumn                     = new BackgroundWorker();
     bGWorkerAddColumn.DoWork             += new DoWorkEventHandler(bGWorkerAddColumn_DoWork);
     bGWorkerAddColumn.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bGWorkerAddColumn_RunWorkerCompleted);
     bGWorkerAddColumn.RunWorkerAsync(req);
     mProgress.ShowDialog();
 }
示例#3
0
        private void btnColumnCleanRequest_Click(object sender, EventArgs e)
        {
            errorProviderColumnRequestForm.Clear();
            mColumnRequest = new GunRequest();
            bool submittable = true;

            if (textBoxRequestor.Text == "" || textBoxRequestor.Text == null)
            {
                errorProviderColumnRequestForm.SetError(textBoxRequestor, "Enter Your Name");
                submittable = false;
            }
            else
            {
                mColumnRequest.mRequestor = textBoxRequestor.Text.Trim().ToString();
            }

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

            if (!(textBoxComment.Text.ToString() == "" || textBoxComment.Text.ToString() == null))
            {
                mColumnRequest.mInstructions = textBoxComment.Text.Trim().ToString();
            }
            else
            {
                mColumnRequest.mInstructions = "";
            }

            if (!(textBoxColumnSerial.Text.Trim().ToString() == "" || textBoxColumnSerial.Text.Trim().ToString() == null))
            {
                mColumnRequest.mSerial = textBoxColumnSerial.Text.Trim().ToString();
            }
            else
            {
                mColumnRequest.mSerial = "";
            }

            if (checkBoxColumnHot.Checked)
            {
                mColumnRequest.mHot = true;
            }
            else
            {
                mColumnRequest.mHot = false;
            }

            mColumnRequest.mType        = comboBoxColumn.SelectedValue.ToString();
            mColumnRequest.mDescription = lblDescription.Text;
            mColumnRequest.mQty         = 1;

            if (submittable)
            {
                //save request
                AddColumn(mColumnRequest);
            }
        }