Ejemplo n.º 1
0
        /// <summary>
        /// Создание подключения
        /// </summary>
        /// <returns>Успех подключения</returns>
        private bool CreateConnection()
        {
            //Определение пути до БД
            try
            {
                //Чтение пути до БД из файла
                string way = File.ReadAllLines("db.txt", Encoding.GetEncoding(1251))[0];
                if (way != "")
                {
                    BDWay = way;
                }
            }
            catch { }

            //Подключение к БД
            try
            {
                UsAc = new UsingAccess(BDWay, null, null, null);
                return(true);
            }
            catch
            {
                try
                {
                    UsAc = new UsingAccess(BDWay, null, null, "install");
                    return(true);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Не удалось подключится к базе данных, пожалуйста, обратитесь к администратору \n\n" + ex.ToString(), "Ошибка подклчения к БД");
                    this.Close();
                    return(false);
                }
            }
        }
Ejemplo n.º 2
0
        public CreatePassword(string User, UsingAccess UsAc)
        {
            this.UsAc  = UsAc;
            this.login = User;

            InitializeComponent();
        }
Ejemplo n.º 3
0
        public Report(UsingAccess UsAc, DataView table, string Application)
        {
            InitializeComponent();
            this.UsAc = UsAc;

            this.table = table;
            if (table.Count == 0)
            {
                F_ApplicationCount.Text            = "Число записей: 0";
                F_ButtonApplicationCount.IsEnabled = false;
            }
            else
            {
                F_ApplicationCount.Text = $"Число записей: {table.Count.ToString()}";
            }

            this.Application = Application;
            if (Application == null)
            {
                F_ApplicationID.Text          = "Заявка не выбрана";
                F_ButtonApplication.IsEnabled = false;
            }
            else
            {
                F_ApplicationID.Text = $"Заявка №: {Application}";
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Окно авторизации
 /// </summary>
 /// <param name="usingAccess">Соеденение с Access для проверки Логина/Пароля</param>
 public LoginPassword(UsingAccess usingAccess)
 {
     System.Console.WriteLine("Запуск окна авторизации");
     InitializeComponent();
     UsAc = usingAccess;
     F_Login.Focus();
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Хранит все таблицы для проекта CourseProject
        /// </summary>
        /// <param name="UsAc">Для обновления содержимого таблиц</param>
        public Tables(UsingAccess UsAc)
        {
            this.UsAc = UsAc;

            Deal            = new UsingDataView(UsAc, "Номер_дела AS [Номер дела], Дата_введения_на_хранение AS [Введено на хранение], Причина_открытия AS [Причина открытия], Заверитель", "Дело", null, null);
            Document        = new UsingDataView(UsAc, "Номер_документа as [Номер], Название_документа as [Название], Число_страниц as [Число страниц]", "Документ", null, null);
            DocumentContent = new UsingDataView(UsAc, "*", "Содержимое_документа", null, null);
            Users           = new UsingDataView(UsAc, "*", "Пользователи", null, null);
        }
Ejemplo n.º 6
0
        public AddToHandbook(string TitleForWindow, UsingAccess UsAc, string from)
        {
            InitializeComponent();
            this.Title = TitleForWindow;
            this.from  = from;
            this.UsAc  = UsAc;
            this.table = UsAc.Execute("SELECT * FROM " + from);

            CreateFields();
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Попытка подключиться к БД
 /// </summary>
 /// <param name="DataSource">Путь к БД</param>
 /// <returns>Результат подключения</returns>
 private bool CreateConnection(string DataSource)
 {
     try
     {
         UsAc = new UsingAccess(DataSource);
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Ejemplo n.º 8
0
        public ToReport(UsingAccess UsAc, string Deal)
        {
            InitializeComponent();

            this.UsAc = UsAc;
            report    = new Report(UsAc);

            if (Deal == null)
            {
                F_Grid_Word.IsEnabled = false;
            }
            else
            {
                F_TextBlock_Deal.Text = Deal;
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Хранит все таблицы для проекта UZNRKT
        /// </summary>
        /// <param name="UsAc">Для обновления содержимого таблиц</param>
        public Tables(UsingAccess UsAc)
        {
            this.UsAc = UsAc;

            Neispravnosti = new UsingDataView(UsAc, "Neispravnosti.Naimenovanie AS Неисправность", "Neispravnosti");
            Izgotovitel   = new UsingDataView(UsAc, "Izgotovitel.Nazvanie_Izgotovitel AS Название", "Izgotovitel");
            Services      = new UsingDataView(UsAc, "Services.Nazvanie_Services AS Название, Services.Stoimost_Services AS Стоимость", "Services");
            Statys        = new UsingDataView(UsAc, "Statys.Statys_Statys AS Статус", "Statys");
            TypeTehniki   = new UsingDataView(UsAc, " TypeTehniki.Type_TypeTehniki AS Тип", "TypeTehniki");
            Oborudovanie  = new UsingDataView(UsAc, " Oborudovanie.Model AS Модель, Oborudovanie.SerNomer AS[Серийный номер], Oborudovanie.Komplektaciya AS Комплектация, Oborudovanie.Primechaniya AS Примечания", "Oborudovanie");
            Doljnosti     = new UsingDataView(UsAc, " Doljnosti.Nazvanie_Doljnost AS Должность", "Doljnosti");

            Zayavki = new UsingDataView(
                UsAc
                , "Zayavki.ID_Zayavki AS [ID заявки], Zayavki.Date_Zayavki AS [Дата заявки], Sotrudniki.FIO_Master AS [ФИО мастера], Clients.FIO_Client AS [ФИО клиента], Neispravnosti.Naimenovanie AS [Тип неисправности], TypeTehniki.Type_TypeTehniki AS [Тип техники], Izgotovitel.Nazvanie_Izgotovitel AS Изготовитель, Oborudovanie.Model AS Модель, Services.Nazvanie_Services AS [Название услуги], Zayavki.KolvoServ AS [Кол-во деталей], TMC.Nazvanie_TMC AS Деталь, Statys.Statys_Statys AS [Статус выполнения], Zayavki.Date_okonchaniya_Zayavki AS [Дата окончания], Zayavki.Summa AS Сумма"
                , "TypeTehniki RIGHT JOIN (TMC RIGHT JOIN (Statys RIGHT JOIN (Services RIGHT JOIN (Oborudovanie RIGHT JOIN (Neispravnosti RIGHT JOIN (Sotrudniki RIGHT JOIN (Izgotovitel RIGHT JOIN (Clients RIGHT JOIN Zayavki ON Clients.ID_Client = Zayavki.Client) ON Izgotovitel.ID_Izgotovitel = Zayavki.Izgotovitel) ON Sotrudniki.ID_Master = Zayavki.Master) ON Neispravnosti.ID_Neispravnosti = Zayavki.Neispravnost_Zayavki) ON Oborudovanie.ID_Oborudovaniya = Zayavki.ID_Oborudovaniya) ON Services.ID_Services = Zayavki.Services) ON Statys.ID_Statys = Zayavki.Statys) ON TMC.ID_TMC = Zayavki.Materiali) ON TypeTehniki.ID_TypeTehniki = Zayavki.Type_Tehniki_Zayavki");

            AutorizationTime = new UsingDataView(
                UsAc
                , "Users.Login_User AS Пользователь, Log_avtorizatcii.Time_in AS [Время входа], Log_avtorizatcii.Time_out AS [Время выхода]"
                , "Users Users RIGHT JOIN Log_avtorizatcii ON Users.ID_User = Log_avtorizatcii.ID_User");

            Sotrudniki = new UsingDataView(
                UsAc
                , "Sotrudniki.FIO_Master AS [ФИО Мастера], Doljnosti.Nazvanie_Doljnost AS Должность, Sotrudniki.DateOfBirth_Master AS [Дата рождения], Sotrudniki.Phone_Master AS Телефон, Sotrudniki.Adress_Master AS Адрес, Sotrudniki.Email_Master AS Emali"
                , "Doljnosti RIGHT JOIN Sotrudniki ON Doljnosti.ID_Doljnost = Sotrudniki.Doljnost_Master");

            Clients = new UsingDataView(
                UsAc
                , "Clients.ID_Client AS ID, Clients.FIO_Client AS ФИО, Clients.Phone_Client AS Телефон, Clients.Adress_Client AS Адрес, Clients.Email_Client AS Email"
                , "Clients");

            DogovorOPostavke = new UsingDataView(
                UsAc
                , "Postavchiki.Nazvanie_Postavchik AS Поставщик, DogovorOPostavke.DateZakaza AS [Дата заказа], DogovorOPostavke.NazvanieMateriala AS Материал, DogovorOPostavke.CenaZaEd AS [Цена заказа], DogovorOPostavke.Kolichestvo AS Количество, DogovorOPostavke.DatePostavki AS [Дата поставки], DogovorOPostavke.SummaZakaza AS [Сумма заказа]"
                , "Postavchiki RIGHT JOIN DogovorOPostavke ON Postavchiki.ID_Postavchik = DogovorOPostavke.Postavchik");

            Users = new UsingDataView(
                UsAc
                , "Users.ID_User AS [# ID], Users.Login_User AS Логин, Sotrudniki.FIO_Master AS ФИО, Doljnosti.Nazvanie_Doljnost AS Должность, Roles.Role_Role AS Роль"
                , "(Roles RIGHT JOIN Users ON Roles.ID_Role = Users.Role) LEFT JOIN (Doljnosti RIGHT JOIN Sotrudniki ON Doljnosti.ID_Doljnost = Sotrudniki.Doljnost_Master) ON Users.ID_User = Sotrudniki.IDUsera");

            TMC = new UsingDataView(
                UsAc
                , "TMC.ID_TMC AS ID, TMC.Nazvanie_TMC AS Название, TMC.Kolichestvo_TMC AS Количество, Postavchiki.Nazvanie_Postavchik AS Поставщик"
                , "Postavchiki RIGHT JOIN TMC ON Postavchiki.ID_Postavchik = TMC.Postavchik_TMC");
        }
Ejemplo n.º 10
0
        public UserControl(UsingAccess UsAc, string ID_User)
        {
            InitializeComponent();

            this.UsAc = UsAc;
            LoadComboBox();

            if (ID_User != null)
            {
                //SetValue(ID_User);
                F_Button_AddEdit.Content = "Сохранить";
                Title = "Редактирование пользователя с # ID " + ID_User;
            }
            else
            {
                F_Button_AddEdit.Content = "Добавить";
                Title = "Добавление пользователя";
            }
        }
Ejemplo n.º 11
0
        public ComponentControl(UsingAccess UsAc, string ID_TMC)
        {
            InitializeComponent();

            this.UsAc   = UsAc;
            this.ID_TMC = ID_TMC;

            LoadComboBox("Nazvanie_Postavchik", "Postavchiki", F_Postav);

            if (ID_TMC == null)
            {
            }
            else
            {
                F_Name.IsEnabled         = false;
                F_Postav.IsEnabled       = false;
                F_Button_AddEdit.Content = "Изменить";

                SetValue(ID_TMC);
            }
        }
Ejemplo n.º 12
0
        public AddApplication(UsingAccess UsAc, string IdZayavki)
        {
            InitializeComponent();

            this.UsAc = UsAc;

            LoadAllComboBox();

            if (IdZayavki != null)
            {
                this.ID = IdZayavki;
                SetValue(IdZayavki);
                F_Button_AddEdit.Content = "Сохранить";
                Title = "Редактирования заявки №" + IdZayavki;
            }
            else
            {
                F_DataZayavki.Text       = DateTime.Now.ToShortDateString();
                F_Button_AddEdit.Content = "Добавить";
                Title = "Создание заявки";
            }
        }