示例#1
0
 private void btnSearch_Click(object sender, EventArgs e)
 {
     try
     {
         if (!System.Text.RegularExpressions.Regex.IsMatch(txtSearchInvNo.Text, "^[0-9]*$") || txtSearchInvNo.Text == string.Empty)
         {
             txtSearchInvNo.Text = string.Empty;
             return;
         }
         else
         {
             long    InvoiceNo = Convert.ToInt64(txtSearchInvNo.Text);
             DataSet dsInvoice = _repoInvoice.GetInVoiceDetails(InvoiceNo);
             if (dsInvoice != null && dsInvoice.Tables[0].Rows.Count == 0)
             {
                 MyMessageBox.ShowBox("No reocords found!", "Alert!");
                 txtSearchInvNo.Clear();
                 txtSearchInvNo.Focus();
             }
             else
             {
                 EnableSearchButtons();
                 BIndInvoiceDetialsForInvoiceNo(dsInvoice);
                 if (lblIsActiveValue.Text == "Canceled" || lblIsReturnedValue.Text == "Returned")
                 {
                     btnReturnOrder.Visible = false;
                     btnCancelorder.Visible = false;
                 }
                 else if (lblIsReturnedValue.Text == "")
                 {
                     btnReturnOrder.Visible = true;
                     btnCancelorder.Visible = true;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         _errorLogs.LogErrors("frmInvoice", "btnSearch_Click", ex.Message);
     }
 }