示例#1
0
        /// <summary>
        /// Function to save batch
        /// </summary>
        public void BatchTableFill()
        {

            try
            {
                BatchSP spBatch = new BatchSP();
                BatchInfo infoBatch = new BatchInfo();
                for (int inI = 0; inI < dgvProductCreation.RowCount - 1; inI++)
                {
                    infoBatch.ManufacturingDate = Convert.ToDateTime(dgvProductCreation.Rows[inI].Cells["dgvtxManfDate"].Value);
                    infoBatch.ExpiryDate = Convert.ToDateTime(dgvProductCreation.Rows[inI].Cells["dgvtxtExpDate"].Value);
                    infoBatch.BatchNo = dgvProductCreation.Rows[inI].Cells["dgvtxtbatch"].Value.ToString();
                    infoBatch.barcode = Convert.ToString(spBatch.AutomaticBarcodeGeneration());
                    if (btnSave.Text == "Update")
                    {
                        infoBatch.ProductId = decProductIdForEdit;
                    }
                    else
                    {
                        infoBatch.ProductId = decSaveProduct;
                    }
                    infoBatch.Extra1 = string.Empty;
                    infoBatch.Extra2 = string.Empty;
                    infoBatch.ExtraDate = DateTime.Now;
                    infoBatch.narration = string.Empty;
                    decBatchId = spBatch.BatchAddAndDelete(infoBatch, decProductIdForEdit);
                    dgvProductCreation.Rows[inI].Cells["dgvtxtbatchId"].Value = decBatchId;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("PC:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }