private void RefreshBatchList()
 {
     try
     {
         _batchcollection = new AutoCompleteStringCollection();
         if (m_LocationID > 0 && m_ItemID > 0)
         {
             string               errorMessage = string.Empty;
             CIBatchDetail        batch        = new CIBatchDetail();
             List <CIBatchDetail> Lists        = batch.GetBatchDetail(string.Empty, m_ItemID, m_LocationID, ref errorMessage);
             if (Lists != null)
             {
                 for (int j = 0; j < Lists.Count; j++)
                 {
                     _batchcollection.Add(Lists[j].BatchNo);
                 }
             }
         }
         txtBatchNo.AutoCompleteMode         = AutoCompleteMode.SuggestAppend;
         txtBatchNo.AutoCompleteSource       = AutoCompleteSource.CustomSource;
         txtBatchNo.AutoCompleteCustomSource = _batchcollection;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        private bool ValidateBatchNo()
        {
            string errorMessage       = string.Empty;
            List <CIBatchDetail> List = m_CurrentBatch.GetBatchDetail(txtBatchNo.Text.Trim(), m_ItemID, m_LocationID, ref errorMessage);

            if (List != null && List.Count > 0 && errorMessage.Trim().Equals(string.Empty))
            {
                //m_CurrentBatch = List[0];
                return(true);
            }
            else
            {
                return(false);
            }
        }
        private void txtBatchNo_Validating(object sender, CancelEventArgs e)
        {
            try
            {
                // m_ItemID = m_CurrentBatch.ItemId;
                m_CurrentBatch = new CIBatchDetail();

                string errorMessage = string.Empty;
                if (txtBatchNo.Text.Trim().Equals(string.Empty))
                {
                    return;
                }
                List <CIBatchDetail> List = m_CurrentBatch.GetBatchDetail(txtBatchNo.Text.Trim(), m_ItemID, m_LocationID, ref errorMessage);
                if (List != null && List.Count > 0 && errorMessage.Trim().Equals(string.Empty))
                {
                    m_CurrentBatch               = List[0];
                    m_CurrentBatch.ItemId        = m_ItemID;
                    m_CurrentBatch.ItemCode      = m_itemCode;
                    m_CurrentBatch.RecordNo      = m_Recordno;
                    m_CurrentBatch.TotalQuantity = m_TotalQty;
                    m_CurrentBatch.AvailableQty  = GetAvailableQty(m_CurrentBatch);
                }
                else
                {
                    m_CurrentBatch.BatchNo = txtBatchNo.Text.Trim();
                }

                // m_CurrentBatch.ItemCode = txtItemCode.Text.Trim();
                m_CurrentBatch.Quantity = txtInvoiceQty.Text.Trim() == string.Empty?0:Convert.ToDecimal(txtInvoiceQty.Text.Trim());
                SetBatchDetails();
            }
            catch (Exception ex)
            {
                MessageBox.Show(Common.GetMessage("10002"), Common.GetMessage("30007"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                Common.LogException(ex);
            }
        }