Exemplo n.º 1
0
 private void CustomersGrid_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     using (OrdersDBEntities db = new OrdersDBEntities())
     {
         if (textOperator.Words.Count != 0)
         {
             textOperator.Words.Clear();
         }
         var properties = db.Customers.EntitySet.ElementType.Properties;
         for (int i = 0; i < CustomersGrid.ColumnCount; i++)
         {
             if (CustomersGrid[i, e.RowIndex].Value != null)
             {
                 textOperator.Words.Add(properties[i].Name, CustomersGrid[i, e.RowIndex].Value.ToString());
             }
         }
         try //получить директора
         {
             textOperator.Head = db.People.Where(person => person.PositionId == "Директор").First();
         }
         catch
         {
             MessageBox.Show("Warning: Head not found");
             textOperator.Head = null;
         }
     }
     TableIsReady = true;
 }
Exemplo n.º 2
0
 public MyForm()
 {
     InitializeComponent();
     TableIsReady = TemplateIsReady = false;
     textOperator = new TextOperator();
     try
     {
         using (OrdersDBEntities db = new OrdersDBEntities())
         {
             CustomersGrid.DataSource = db.Customers;
             MessageBox.Show("Choose customer and template");
         }
     }
     catch
     {
         MessageBox.Show("Database not found");
         System.Environment.Exit(0);
     }
 }
Exemplo n.º 3
0
        public MyForm()
        {
            InitializeComponent();
            TableIsReady = TemplateIsReady = false;
            textOperator = new TextOperator();
            try
            {
                using (OrdersDBEntities db = new OrdersDBEntities())
                {
                    CustomersGrid.DataSource = db.Customers;
                    MessageBox.Show("Choose customer and template");
                }
            }
            catch
            {
                MessageBox.Show("Database not found");
                System.Environment.Exit(0);
            }
            

        }
Exemplo n.º 4
0
 private void CustomersGrid_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     using (OrdersDBEntities db = new OrdersDBEntities())
     {
         if (textOperator.Words.Count != 0) textOperator.Words.Clear();
         var properties = db.Customers.EntitySet.ElementType.Properties;
         for (int i = 0; i < CustomersGrid.ColumnCount; i++)
         {
             if (CustomersGrid[i, e.RowIndex].Value != null)
                 textOperator.Words.Add(properties[i].Name, CustomersGrid[i, e.RowIndex].Value.ToString());
         }
         try //получить директора
         {
             textOperator.Head = db.People.Where(person => person.PositionId == "Директор").First();
         }
         catch
         {
             MessageBox.Show("Warning: Head not found");
             textOperator.Head = null;                  
         }
     }
     TableIsReady = true;
 }