Beispiel #1
0
        /// <summary>
        /// 保存数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSaveData_Click(object sender, EventArgs e)
        {
            VerifyRecode recode = new VerifyRecode();

            if (!NotIsNull(labArrivalCount.Text, labPurchaseQuantity.Text, txtQualified.Text, txtNoQualified.Text))
            {
                // 条码
                recode.Barcode = barcode;
                // 处理结果0:合格 1:退货 2:返修 3:让步处理
                recode.VerifResult         = cmbControl.SelectedIndex;
                recode.MaterialName        = labMaterialName.Text;
                recode.InvoceNumber        = txtCode.Text.Trim();
                recode.RecodeTime          = DateTime.Now;
                recode.Remark              = txtRemark.Text;
                recode.ArrivalQuantity     = Convert.ToDecimal(labArrivalCount.Text);
                recode.MaterialCoding      = (string)cmbMaterial.SelectedItem;
                recode.PurchaseQuantity    = Convert.ToDecimal(labPurchaseQuantity.Text);
                recode.Qualifiedquantity   = Convert.ToDecimal(txtQualified.Text);
                recode.UnqualifiedQuantity = Convert.ToDecimal(txtNoQualified.Text);
                recode.SupplierName        = labSupplier.Text;
                recode.Batch = labBatch.Text;
                if (test.SaveTestData(recode) == 1)
                {
                    MessageBox.Show("保存成功", "消息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }

                else
                {
                    MessageBox.Show("保存失败", "消息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
Beispiel #2
0
        public int SaveTestData(VerifyRecode recode)
        {
            int num = 0;

            using (StoreAccess access = new StoreAccess(true))
            {
                try
                {
                    access.Open();
                    access.BeginTransaction();
                    num = access.Insert(recode);
                    access.Commit();
                }
                catch (Exception ex)
                {
                    access.RollBack();
                    access.Close();
                    LogBusiness.RecordLog(name, ex.Message + "异常", "保存检测结果");
                    MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            return(num);
        }