示例#1
0
 /// <summary>
 /// Function for orderNo combobox
 /// </summary>
 public void OrderComboFill()
 {
     PurchaseMasterSP spPurchaseMaster = new PurchaseMasterSP();
     DataTable dtbl = new DataTable();
     try
     {
         if (cmbVoucherType.SelectedValue != null)
         {
             if (cmbVoucherType.SelectedValue.ToString() != "System.Data.DataRowView" && cmbVoucherType.Text != "System.Data.DataRowView")
             {
                 if (cmbCashOrParty.SelectedValue != null)
                 {
                     if (cmbCashOrParty.SelectedValue.ToString() != string.Empty && cmbCashOrParty.Text != string.Empty)
                     {
                         if (cmbPurchaseMode.Text == "Against PurchaseOrder")
                         {
                             dtbl = spPurchaseMaster.GetOrderNoCorrespondingtoLedgerByNotInCurrPI(Convert.ToDecimal(cmbCashOrParty.SelectedValue.ToString()), decPurchaseMasterId,
                                 Convert.ToDecimal(cmbVoucherType.SelectedValue.ToString()));
                             DataRow drow = dtbl.NewRow();
                             drow["purchaseOrderMasterId"] = 0;
                             drow["invoiceNo"] = string.Empty;
                             dtbl.Rows.InsertAt(drow, 0);
                             cmbOrderNo.DataSource = dtbl;
                             cmbOrderNo.ValueMember = "purchaseOrderMasterId";
                             cmbOrderNo.DisplayMember = "invoiceNo";
                         }
                         else if (cmbPurchaseMode.Text == "Against MaterialReceipt")
                         {
                             dtbl = spPurchaseMaster.GetMaterialReceiptNoCorrespondingtoLedgerByNotInCurrPI(Convert.ToDecimal(cmbCashOrParty.SelectedValue.ToString()), decPurchaseMasterId,
                                 Convert.ToDecimal(cmbVoucherType.SelectedValue.ToString()));
                             DataRow drow = dtbl.NewRow();
                             drow["materialReceiptMasterId"] = 0;
                             drow["invoiceNo"] = string.Empty;
                             dtbl.Rows.InsertAt(drow, 0);
                             cmbOrderNo.DataSource = dtbl;
                             cmbOrderNo.ValueMember = "materialReceiptMasterId";
                             cmbOrderNo.DisplayMember = "invoiceNo";
                         }
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PI9:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }