예제 #1
0
        //Метод для обновления существующего контрагента
        public void UpdateExistingContragent(string id, string shortname, string address, string telephone, string bin)
        {
            //Открываем соединение
            using (var db = new StoreModel())
            {
                try
                {
                    //Конвертируем строку в число и ищем по этому числу существующего контрагента
                    int         currentId         = Convert.ToInt32(id);
                    ContrAgents currentContragent = db.ContrAgents.Find(currentId);

                    //Вносим изменения
                    currentContragent.shortName = shortname;
                    currentContragent.address   = address;
                    currentContragent.telephone = telephone;
                    currentContragent.bin       = bin;

                    //Сохраняем изменения
                    db.SaveChanges();
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.InnerException.Message);
                }
            }
        }
예제 #2
0
        //Копировать
        public void _contragentsWindowView_CopyContragentClicked(object sender, EventArgs e)
        {
            //Сбрасываем значения
            ResetValues();

            //Устанавливаем значения с копируемой накладной, кроме Id
            ContrAgents contragent = (ContrAgents)_contragentsWindowView.SelectedContragents;

            _contragentsWindowView.StringOfName    = contragent.shortName;
            _contragentsWindowView.StringOfTel     = contragent.telephone;
            _contragentsWindowView.StringOfAddress = contragent.address;
            _contragentsWindowView.StringOfBin     = contragent.bin;
        }
예제 #3
0
        //Печать
        public void _contragentsWindowView_PrintContragentClicked(object sender, EventArgs e)
        {
            //Получаем товар из накладной
            ContrAgents contragent = (ContrAgents)_contragentsWindowView.SelectedContragents;

            //Создаём объект rep и загружаем в него нашу модель
            StiReport rep = new StiReport();

            rep.Load(AppDomain.CurrentDomain.BaseDirectory + "\\Temp\\ContragentPage.mrt");

            //Компилируем rep и вкладываем в него наши значения
            rep.Compile();
            rep["Id"]        = contragent.Id.ToString();
            rep["shortName"] = contragent.shortName;
            rep["telephone"] = contragent.telephone;
            rep["address"]   = contragent.address;
            rep["bin"]       = contragent.bin;

            //Отображаем
            rep.ShowWithWpf();
        }