public HomePageModel(string login) { this.login = "******" + login; ceqacc = new TAXIEntities(); var userInfo = ceqacc.Login.Where(x => x.name == login).First(); if (userInfo.role_id == 0 || userInfo.role_id == 1) { var userInfoTable = ceqacc.Admin.Where(x => x.admin_id == userInfo.id).First(); this.fullname = userInfoTable.full_name; if (userInfo.role_id == 0) { this.role = "Роль: Адміністратор"; } else if (userInfo.role_id == 1) { this.role = "Роль: Диспетчер"; } } else if (userInfo.role_id == 2) //водій { var userInfoTable = ceqacc.Driver.Where(x => x.id_driver == userInfo.id).First(); this.fullname = userInfoTable.last_name; this.role = "Роль: Водій"; } this.name = "Повне ім'я: " + this.fullname; }
public viewUserInfo(object obj, string operation, string admin) { InitializeComponent(); this.obj = obj; this.operation = operation; this.admin = admin; ceqacc = new TAXIEntities(); rolesBox.ItemsSource = (from r in ceqacc.Role select r.role_name).ToList(); if (operation == "edit") { editCommand(); } else if (operation == "new") { createCommand(); } this.DataContext = this; }
public Software(string logins) { InitializeComponent(); this.login = logins; ceqacc = new TAXIEntities(); try { myDataGrid.ItemsSource = (from obj in ceqacc.Car select new { model = obj.Brand.model_car, obj.state_number, obj.cod_car, obj.color, obj.graduation_year, obj.technical_condition }).ToList(); } catch { MessageBox.Show("Сталась помилка в роботі із базою, спробуйте ще раз. "); return; } this.DataContext = this; }
public viewObject(object obj, string operation, string admin) { InitializeComponent(); this.obj = obj; this.operation = operation; this.admin = admin; ceqacc = new TAXIEntities(); warrantyList = new List <string>(); warrantyList.Add("Так, повна"); warrantyList.Add("Так, неповна"); warrantyList.Add("Ні"); if (operation == "edit") { editCommand(); } else if (operation == "new") { createCommand(); } this.DataContext = this; }
private void Onload(object sender, EventArgs e) { //виконується при загрузці форми try { my_DataBase = new TAXIEntities(); statusConnect.Text = "Статус: З'єднано з сервером"; st.Background = Brushes.LightGreen; } catch (SqlException ex) { statusConnect.Text = "Статус: Нема з'єднання"; MessageBox.Show(Convert.ToString(ex)); st.Background = Brushes.Red; } }
public Users(string logins) { InitializeComponent(); ceqacc = new TAXIEntities(); login = logins; try { var query = (from user in ceqacc.Login where user.role_id != 2 select new { user.uid, user.name, fullName = user.Admin.full_name, userRole = user.Role.role_name } ).ToList(); myDataGrid.ItemsSource = query; var query2 = (from user in ceqacc.Login where user.role_id == 2 select new { user.uid, user.name, fullName = user.Driver.last_name, userRole = user.Role.role_name } ).ToList(); myDataGrid2.ItemsSource = query2; } catch { MessageBox.Show("Сталась помилка в роботі із базою, спробуйте ще раз. "); return; } this.DataContext = this; }
public accountant(string login) { InitializeComponent(); this.login = "******" + login; ceqacc = new TAXIEntities(); var userInfo = ceqacc.Login.Where(x => x.name == login).First(); this.name = "Повне ім'я: " + userInfo.password; this.role = "Роль: " + userInfo.role_id; var query = (from t3 in ceqacc.Admin from t2 in ceqacc.Admin select new { NameS = t3.full_name, Price = t3.full_name, } ).ToList(); var query2 = (from t3 in ceqacc.Login from t2 in ceqacc.Driver select new { NameS = t2.Login, Price = t2.last_name } ).ToList(); myDataGrid.ItemsSource = query; myDataGrid.ItemsSource = query2; this.DataContext = this; }
public Purchase(string logins) { InitializeComponent(); this.login = logins; ceqacc = new TAXIEntities(); try { myDataGrid.ItemsSource = (from user in ceqacc.Tariffs select new { user.name_param, user.price }).ToList(); } catch { MessageBox.Show("Сталась помилка в роботі із базою, спробуйте ще раз. "); return; } }
public Objects(string logins) { InitializeComponent(); this.login = logins; ceqacc = new TAXIEntities(); try { myDataGrid.ItemsSource = (from obj in ceqacc.Request select new { obj.code_request, obj.status, Tarif = obj.Discount_card.type_discount, obj.date, }).ToList(); } catch { MessageBox.Show("Сталась помилка в роботі із базою, спробуйте ще раз. "); return; } this.DataContext = this; }
public ControllerPanel() { ceqacc = new TAXIEntities(); }