コード例 #1
0
        private void AddItem()
        {
            try
            {
                ValidateAdd();
                StringBuilder sbError;
                sbError = GenerateAddError();
                if (sbError.ToString().Trim().Equals(string.Empty))
                {
                    DialogResult saveResult = MessageBox.Show(Common.GetMessage("5010", "Add"), Common.GetMessage("10001"), MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (saveResult == DialogResult.Yes)
                    {
                        GrnBatchDetail batch = new GrnBatchDetail();
                        batch.ManufacturerBatchNumber = txtManuBatchNo.Text.Trim();
                        batch.ExpiryDate        = dtpExpiryDate.Value.ToShortDateString();
                        batch.GRNNo             = m_CurrentGRNDetail.GRNNo;
                        batch.ItemId            = m_CurrentGRNDetail.ItemId;
                        batch.ManufacturingDate = dtpMfgDate.Value.ToShortDateString();
                        batch.MRP         = Convert.ToDouble(txtMRP.Text.Trim());
                        batch.ReceivedQty = Convert.ToDouble(txtReceivedQty.Text.Trim());
                        batch.SerialNo    = m_SerialNo++;

                        if (m_CurrentGRNDetail.GRNBatchDetailList == null)
                        {
                            m_CurrentGRNDetail.GRNBatchDetailList = new List <GrnBatchDetail>();
                        }

                        m_CurrentGRNDetail.GRNBatchDetailList.Add(batch);
                        m_CurrentGRNDetail.ChallanQty = m_CurrentGRNDetail.ReceivedQty;
                        m_CurrentGRNDetail.InvoiceQty = m_CurrentGRNDetail.ReceivedQty;

                        ResetGrid();
                        m_ParentGridView.Refresh();
                        ClearItem();
                        MessageBox.Show(Common.GetMessage("INF0055", "Batch", "Added"), Common.GetMessage("10001"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                else
                {
                    MessageBox.Show(sbError.ToString(), Common.GetMessage("30007"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #2
0
 private void dgvBatchDetails_SelectionChanged(object sender, EventArgs e)
 {
     try
     {
         if (dgvBatchDetails.SelectedRows.Count > 0)
         {
             errorAdd.Clear();
             m_CurrentBatch = m_CurrentGRNDetail.GRNBatchDetailList[dgvBatchDetails.SelectedRows[0].Index];
             GrnBatchDetail batch = CopyObject(m_CurrentBatch);
             ResetValues(batch);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(Common.GetMessage("10002"), Common.GetMessage("30007"), MessageBoxButtons.OK, MessageBoxIcon.Error);
         Common.LogException(ex);
     }
 }
コード例 #3
0
 private GrnBatchDetail CopyObject(GrnBatchDetail objbatch)
 {
     try
     {
         GrnBatchDetail batch = new GrnBatchDetail();
         batch.BatchNumber             = objbatch.BatchNumber;
         batch.ExpiryDate              = objbatch.ExpiryDate;
         batch.GRNNo                   = objbatch.GRNNo;
         batch.ItemId                  = objbatch.ItemId;
         batch.ManufacturerBatchNumber = objbatch.ManufacturerBatchNumber;
         batch.ManufacturingDate       = objbatch.ManufacturingDate;
         batch.MRP         = objbatch.MRP;
         batch.ReceivedQty = objbatch.ReceivedQty;
         batch.SerialNo    = objbatch.SerialNo;
         return(batch);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #4
0
        private void ClearItem()
        {
            try
            {
                errorAdd.Clear();
                txtManuBatchNo.Text = string.Empty;
                txtMRP.Text         = EnableControl? m_MRP.ToString():string.Empty;
                txtReceivedQty.Text = string.Empty;
                //dtpExpiryDate.Value = DateTime.Today.AddDays(1);

                //dt. 12-04-2012 Nitin has changed as per the requirement
                //dtpExpiryDate.Value = DateTime.Today.AddMonths(m_expiryMonth);
                dtpExpiryDate.Value = Convert.ToDateTime("01-01-1900");
                dtpMfgDate.Value    = DateTime.Today;
                btnAdd.Text         = BTN_ADD;
                dgvBatchDetails.ClearSelection();
                m_CurrentBatch = null;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #5
0
 private void ResetValues(GrnBatchDetail batch)
 {
     try
     {
         if (batch != null)
         {
             txtManuBatchNo.Text = batch.ManufacturerBatchNumber.ToString();
             txtMRP.Text         = batch.DisplayMRP.ToString();
             txtReceivedQty.Text = batch.DisplayReceivedQty.ToString();
             dtpExpiryDate.Value = Convert.ToDateTime(batch.ExpiryDate);
             dtpMfgDate.Value    = Convert.ToDateTime(batch.ManufacturingDate);
             btnAdd.Text         = BTN_EDIT;
         }
         else
         {
             ClearItem();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }