Пример #1
0
 void PopulateCustomer()
 {
     //try
     //{
     string value = string.IsNullOrEmpty(cbCustomer.ValueMember) ? string.Empty : cbCustomer.SelectedItem == null ? string.Empty : Convert.ToString(((DataRowView)(cbCustomer.SelectedItem)).Row[cbCustomer.ValueMember]);//Convert.ToString(cbCustomer.SelectedValue);
     string text = Convert.ToString(cbCustomer.Text);
     if (value != text)
     {
         int customerId = 0;
         int.TryParse(string.IsNullOrEmpty(cbCustomer.ValueMember) ? string.Empty : cbCustomer.SelectedItem == null ? string.Empty : Convert.ToString(((DataRowView)(cbCustomer.SelectedItem)).Row[cbCustomer.ValueMember]), out customerId);
         if (customerId == 0)
             customerId = 1;
         Customer customer = new Customer();
         DataTable dt = customer.SelectCustomerById(customerId.ToString());
         if (dt != null)
         {
             lblCustomerName.Text = Convert.ToString(dt.Rows[0]["CustomerName"]);
             lblAddress.Text = Convert.ToString(dt.Rows[0]["Address"]);
             lblCustomerBalance.Text = Convert.ToDouble(dt.Rows[0]["CustomerBalance"]).ToString("#0.00");
         }
     }
     //}
     //catch (Exception ex)
     //{
     //    ExceptionLog.LogException(Modules.POS, "PopulateCustomer", ex);
     //}
 }