コード例 #1
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     try
     {
         string uname = Application.Current.Properties["username"].ToString();
         if (uname.Equals("Admin"))
         {
             btnDelete.Visibility = Visibility.Visible;
         }
         else
         {
             BuyerName = Application.Current.Properties["BuyerName"].ToString();
             btnAddToCart.Visibility = Visibility.Visible;
         }
         propList = propertyBL.GetAllPropertyBL();
         dgViewAllData.DataContext = propList;
     }
     catch (EasyHousingSolutionException ex)
     {
         MessageBox.Show("Error: " + ex);
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error: " + ex);
     }
 }
コード例 #2
0
ファイル: Search.xaml.cs プロジェクト: kavijayk/M5-PLP
 private void btnSearch_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         string          propName = txtPropertyName.Text;
         List <Property> prop     = propertyBL.GetAllPropertyBL();
         if (prop == null && prop.Count <= 0)
         {
             sb.Append("Enter valid property name");
         }
         List <Property> pr = prop.Where(p => p.PropertyName == propName).ToList();
         dgSearchProperty.DataContext = pr;
     }
     catch (EasyHousingSolutionException ex)
     {
         MessageBox.Show("Error: " + sb.ToString() + ex.Message);
     }
 }