Esempio n. 1
0
        public IActionResult TabelWork(int?id)
        {
            Tabel tb = db.Tabels.Find(id);

            TempData["Id"] = id;
            //TempData["Tabel"] = tb;
            int[] year = new int[21];
            for (int i = 0; i < 21; i++)
            {
                year[i] = (DateTime.Now.Year - 10) + i;
            }
            SelectList tab = new SelectList(db.Tabels, "Id", "NumDataMaking");
            SelectList fio = new SelectList(db.Employees, "Id", "Fio");
            SelectList app = new SelectList(db.Appoints, "Id", "AppName");

            ViewBag.Tab   = tb.NumDataMaking;
            ViewBag.Fio   = fio;
            ViewBag.App   = app;
            ViewBag.Month = new SelectList(new string[]
                                           { "январь", "февраль", "март", "апрель", "май", "июнь", "июль", "август", "сентябрь", "октябрь", "ноябрь", "декабрь" });
            SelectList years = new SelectList(year);

            ViewBag.Year = years;
            return(View());
        }
Esempio n. 2
0
        void CreateSlips(OrderInfo[] orderInfos)
        {
            var slip = new Slipcs {
                VisitTime = DateTime.Now, TableName = this.TableId, Remaining = this.remaining, Status = "在席"
            };

            _slip.SaveSlipcs(slip);
            int slipId = _slip.GetSlipId(this.TableId);


            int tId   = _table.GetId(this.TableId);
            var table = new Tabel {
                Id = tId, Name = this.TableId, Use = true
            };

            _table.SaveTable(table);


            foreach (OrderInfo oi in orderInfos)
            {
                var user = new Gest {
                    Name = oi.GuestId, TableId = this.TableId, SlipId = slipId, InsertDate = DateTime.Now
                };
                _gest.SaveGest(user);

                var set   = _set.FindOne(oi.MenuId);
                var order = new OrderInfo {
                    SlipId = slipId.ToString(), GuestId = oi.GuestId, MenuId = set.Name, Count = 1, Back = oi.Back, TargetId = oi.TargetId, Sum = set.Price
                };
                _order.SaveOrderInfo(order);
            }
        }
Esempio n. 3
0
        public override void TestConnection(LoggerForm logger, string connectionString, string login, string password)
        {
            try
            {
                logger.DefaultBoldText("Тестовое подключение к базе 1С через WEB сервис.\r\n\r\n");
                logger.DefaultText("Инициализация сервиса запросов...");
                using Tabel tabel = new Tabel
                      {
                          Url         = connectionString,
                          SoapVersion = System.Web.Services.Protocols.SoapProtocolVersion.Soap12,
                          Credentials = new NetworkCredential(Utf8ToWin1251(login), Utf8ToWin1251(password))
                      };
                logger.SuccessText(" ✓ ВЫПОЛНЕНО\r\n");

                logger.DefaultText("Отправка тестового запроса...");
                tabel.GetTabel("", "20200101", "20200101");
                logger.SuccessText(" ✓ ВЫПОЛНЕНО\r\n");

                logger.DefaultBoldText("\r\nТестирование успешно завершено!");
            }
            catch (Exception ex)
            {
                logger.ExceptionText(ex);
                ConnectionStatus = ConnectionStatus.Disconnected;
            }
            finally
            {
                logger.Complete();
            }
        }
Esempio n. 4
0
        public void StartImport()
        {
            TabelList tabelList = TabelList.GetInstance();

            string[] files = Directory.GetFiles(FilePath, "*.txt");

            foreach (var file in files)
            {
                string date  = file.Split('_')[2].Split('.')[0];
                int    month = Convert.ToInt32(string.Concat(date[0], date[1]));
                int    year  = Convert.ToInt32(string.Concat("20", date[2], date[3]));

                string[] lines = File.ReadAllLines(file);

                for (int i = 1; i < lines.Count(); i++)
                {
                    string[] fields = lines[i].Split(';');

                    for (int j = 2; j < fields.Count(); j++)
                    {
                        if ((fields[j] == "Я") || (fields[j] == "Я/Н"))
                        {
                            Tabel tabel = new Tabel(fields[0], new DateTime(year, month, j - 1));
                            tabel.Save();
                        }
                    }
                }

                File.Move(file, FilePath + @"\processed\" + DateTime.Today.ToShortDateString() + " " + Path.GetFileName(file));
            }
        }
Esempio n. 5
0
        public void Add(Tabel tabel)
        {
            if (_list.Exists(item => item == tabel))
            {
                return;
            }

            _list.Add(tabel);
        }
Esempio n. 6
0
        protected override void LoadFromSql()
        {
            DataTable dt = Provider.Select("Tabel");

            foreach (DataRow row in dt.Rows)
            {
                Tabel tabel = new Tabel(row);
                Add(tabel);
            }
        }
Esempio n. 7
0
 public IActionResult TabNew(Tabel tab)
 {
     if (ModelState.IsValid)
     {
         tab.NumDataMaking = "№ " + tab.Number + " от " + tab.DateMaking.ToShortDateString();
         db.Tabels.Add(tab);
         db.SaveChanges();
         return(View(db.Tabels.Include("Structure").AsEnumerable().LastOrDefault()));
     }
     return(View(tab));
 }
Esempio n. 8
0
 public int SaveTable(Tabel table)
 {
     lock (Locker)
     {
         if (table.Id != 0)
         {
             _db.Update(table);
             return(table.Id);
         }
         return(_db.Insert(table));
     }
 }
Esempio n. 9
0
        public IActionResult TabelWorkResult(int?id)
        {
            int i = 1;

            ViewBag.Count = i;
            //int id = (int)TempData["Id"];
            TempData["Id"] = id;
            Tabel tbw = db.Tabels.Find(id);

            //var tabid = id;
            ViewBag.Tab = tbw;
            return(View(db.TabelWorks.Where(p => p.TabelId == id).Include("Employee").Include("Appoint").Include("Tabel").ToList()));
        }
        public async Task <ActionResult <DashboardUserVM> > GetDashboardUserVM()
        {
            DashboardUserVM vm = new DashboardUserVM();

            List <Tabel>   tabellen         = new List <Tabel>();
            List <Persoon> personen         = new List <Persoon>();
            Melding        recentsteMelding = null;

            personen = await _context.Personen
                       .Include(p => p.Type)
                       .Include(p => p.Meldingen).ThenInclude(p => p.Plaats)
                       .ToListAsync();

            foreach (var persoon in personen)
            {
                Tabel tabel = new Tabel();
                if (persoon.Meldingen != null && persoon.Meldingen.Count() != 0)
                {
                    foreach (var melding in persoon.Meldingen)
                    {
                        if (recentsteMelding == null)
                        {
                            recentsteMelding = melding;
                        }
                        if (melding.Tijdstip > recentsteMelding.Tijdstip)
                        {
                            recentsteMelding = melding;
                        }
                    }
                }



                tabel.Naam          = persoon.Naam;
                tabel.Voornaam      = persoon.Voornaam;
                tabel.Type          = persoon.Type.Functie;
                tabel.Overtredingen = persoon.Meldingen.Count();
                if (recentsteMelding != null)
                {
                    tabel.Recentste = recentsteMelding.Tijdstip;
                    tabel.Locatie   = recentsteMelding.Plaats.Naam;
                }
                tabel.Tagnummer = persoon.PersoonID;

                tabellen.Add(tabel);
            }

            vm.tabellen = tabellen;

            return(vm);
        }
        /* Excel не загружает, если из планировщика */
        //public void StartImportExcel()
        //{
        //    try
        //    {
        //        using (ExcelDoc excel = new ExcelDoc(FilePath))
        //        {
        //            int i = 2;

        //            string curCell = "C" + i;
        //            while (excel.getValue(curCell) != null)
        //            {
        //                curCell = "A" + i;
        //                if ((excel.getValue(curCell) == null) ||
        //                    ((excel.getValue(curCell).ToString().ToUpper() != "AM") && (excel.getValue(curCell).ToString().ToUpper() != "АМ")))
        //                {
        //                    curCell = "C" + i;
        //                    i++;
        //                    continue;
        //                }

        //                curCell = "C" + i;
        //                string number = excel.getValue(curCell).ToString();

        //                curCell = "D" + i;
        //                DateTime dateBegin;
        //                DateTime.TryParse(excel.getValue1(curCell).ToString(), out dateBegin);

        //                curCell = "E" + i;
        //                DateTime dateEnd;
        //                DateTime.TryParse(excel.getValue1(curCell).ToString(), out dateEnd);

        //                for (DateTime date = dateBegin; date <= dateEnd; date = date.AddDays(1))
        //                {
        //                    Tabel tabel = new Tabel(number, date) { Comment = "businessTrip" };
        //                    tabel.Save();
        //                }

        //                curCell = "C" + i;
        //                i++;
        //            }
        //        }
        //    }
        //    catch (NullReferenceException ex)
        //    {
        //        LogManager.Logger.Error(ex, "Error in file {file}", FilePath);
        //    }
        //    catch (COMException ex)
        //    {
        //        LogManager.Logger.Error(ex, "Error in file {file}", FilePath);
        //    }
        //}

        /* txt формат предыдущего файла */
        public void StartImport()
        {
            try
            {
                string[] files = Directory.GetFiles(FilePath, "VygruzkaAvto_Braun_КК1.txt");


                string[] lines = File.ReadAllLines(files[0]);

                for (int i = 1; i < lines.Count(); i++)
                {
                    string[] fields = lines[i].Split(';');

                    if (fields[0] != "АМ")
                    {
                        continue;
                    }

                    string number = fields[2]; //табельный номер

                    DateTime dateBegin;
                    DateTime.TryParse(fields[3], out dateBegin);
                    DateTime dateEnd;
                    DateTime.TryParse(fields[4], out dateEnd);

                    for (DateTime date = dateBegin; date <= dateEnd; date = date.AddDays(1))
                    {
                        Tabel tabel = new Tabel(number, date)
                        {
                            Comment = "businessTrip"
                        };
                        tabel.Save();
                    }
                }

                File.Move(files[0], FilePath + @"\processed\" + DateTime.Today.ToShortDateString() + " " + Path.GetFileName(files[0]));
            }
            catch
            {
            }
        }
Esempio n. 12
0
 private void setColor(Tabel tab)
 {
     if (tab.Equals(Tabel.SpectacolTabel))
     {
         foreach (DataGridViewRow row in spectacolTable.Rows)
         {
             if (row.Cells[2].Value.Equals(0))
             {
                 row.DefaultCellStyle.BackColor = Color.Red;
             }
         }
     }
     else
     {
         foreach (DataGridViewRow row in cautaTable.Rows)
         {
             if (row.Cells[2].Value.Equals(0))
             {
                 row.DefaultCellStyle.BackColor = Color.Red;
             }
         }
     }
 }
Esempio n. 13
0
        void PayMaster()
        {
            //伝票をSave
            this.detail.Save = true;
            _slip.SaveSlipcs(this.detail);

            //履歴にSaveとして登録
            var hist = new SaveSlip {
                EndTime = DateTime.Now, SlipId = this.detail.Id, Save = true
            };

            _history.SaveSSlip(hist);

            //オーダー情報をSave
            var orderList = _order.GetSlipId(this.detail.Id);

            foreach (OrderInfo oi in orderList)
            {
                oi.Save = true;
                _order.SaveOrderInfo(oi);
            }

            //ゲストをDelete
            var guestList = _guest.getGests(this.detail.TableName);

            foreach (Gest g in guestList)
            {
                g.Delete = true;
                _guest.SaveGest(g);
            }

            //卓のUSE解除
            Tabel table = _table.FindOne(this.detail.TableName);

            table.Use = false;
            _table.SaveTable(table);
        }
Esempio n. 14
0
        void DeleteSlip(Slipcs slip)
        {
            //伝票をDelete
            slip.Delete = true;
            _slip.SaveSlipcs(slip);

            //履歴にDeleteとして登録
            var hist = new SaveSlip {
                EndTime = DateTime.Now, SlipId = slip.Id, Delete = true
            };

            _history.SaveSSlip(hist);

            //オーダー情報をDelete
            var orderList = _order.GetSlipId(slip.Id);

            foreach (OrderInfo oi in orderList)
            {
                oi.Delete = true;
                _order.SaveOrderInfo(oi);
            }

            //ゲストをDelete
            var guestList = _guest.getGests(slip.TableName);

            foreach (Gest g in guestList)
            {
                g.Delete = true;
                _guest.SaveGest(g);
            }

            //卓のUSE解除
            Tabel table = _table.FindOne(slip.TableName);

            table.Use = false;
            _table.SaveTable(table);
        }
Esempio n. 15
0
        public TableSettingView()
        {
            var listview = new ListView
            {
                ItemsSource  = _db.FindAll(),
                ItemTemplate = new DataTemplate(typeof(TextCell))
            };

            listview.ItemTemplate.SetBinding(TextCell.TextProperty, "Name");
            listview.ItemTemplate.SetBinding(TextCell.DetailProperty, new Binding("CreateDay", stringFormat: "{0:yyy/mm/dd hh:mm}"));

            listview.ItemTapped += async(s, e) =>
            {
                var item = (Tabel)e.Item;
                if (await DisplayAlert("削除しますか?", item.Name, "OK", "キャンセル"))
                {
                    item.Delete = true;
                    _db.SaveTable(item);
                    listview.ItemsSource = _db.FindAll();
                }
            };
            var entry = new Entry
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                BackgroundColor   = Color.White
            };
            var buttonAdd = new Button
            {
                WidthRequest = 60,
                TextColor    = Color.White,
                Text         = "Add"
            };

            buttonAdd.Clicked += (s, e) =>
            {
                if (!string.IsNullOrEmpty(entry.Text))
                {
                    var item = new Tabel {
                        Name = entry.Text, CreateDay = DateTime.Now, Delete = false
                    };
                    _db.SaveTable(item);
                    listview.ItemsSource = _db.GetTabels();
                    entry.Text           = "";
                }
            };


            var backButton = new Button
            {
                Text         = "戻る",
                WidthRequest = 60,
                TextColor    = Color.White,
            };

            backButton.Clicked += (s, e) =>
            {
                Navigation.PopModalAsync();
            };

            Content = new StackLayout
            {
                Padding  = new Thickness(0, Device.OnPlatform(20, 0, 0), 0, 0),
                Children =
                {
                    new StackLayout
                    {
                        BackgroundColor = Color.Navy,
                        Padding         = 5,
                        Orientation     = StackOrientation.Horizontal,
                        Children        = { entry, buttonAdd }
                    },
                    listview,
                    backButton
                }
            };
        }
Esempio n. 16
0
        public IActionResult TabResult(Tabel tab)
        {
            int id = tab.Id;

            return(View(db.Tabels.Where(p => p.Id == tab.Id).Include("Structure").FirstOrDefault()));
        }