Esempio n. 1
0
    // [HideInInspector] public GameObject car;

    // Use this for initialization
    void Awake()
    {
        secondCanvas       = GameObject.Find("SecondCanvas");
        fireBackground     = GameObject.Find("FireBackground");
        fireStart          = GameObject.Find("FireStart");
        garage             = GameObject.FindObjectOfType <Garage>();
        taskMenu           = GameObject.FindObjectOfType <TaskMenu>();
        kaController       = GameObject.FindObjectOfType <KAController>();
        waitBackground     = GameObject.FindObjectOfType <WaitBackground>();
        mainScreen         = GameObject.FindObjectOfType <MainScreen>();
        bg                 = GameObject.Find("BG");
        carsInfo           = GetComponent <CarsInfo>();
        filling            = GameObject.FindObjectOfType <Filling>();
        carChanger         = GameObject.FindObjectOfType <CarChanger>();
        dustSmall          = GameObject.Find("DustSmall");
        windowWarning      = GameObject.FindObjectOfType <WindowWarning>();
        windowConfirmation = GameObject.FindObjectOfType <WindowConfirmation>();

        mainBonus = GetComponent <MainBonus>();

        dailyEvents = GetComponent <DailyEvents>();
        moneyBar    = GameObject.FindObjectOfType <MoneyBar>();

        boosterMenu = GameObject.FindObjectOfType <BoosterMenu>();

        dailyGiftMenu = GameObject.FindObjectOfType <DailyGiftMenu>();

        backMenuButton = GameObject.FindObjectOfType <BackMenuButton>();

        /*
         * car = garage.transform.Find("Car").gameObject;
         * if (car == null)
         *  CreateCar();    */
    }
Esempio n. 2
0
    // [HideInInspector] public GameObject car;
    // Use this for initialization
    void Awake()
    {
        secondCanvas = GameObject.Find("SecondCanvas");
        fireBackground = GameObject.Find("FireBackground");
        fireStart = GameObject.Find("FireStart");
        garage = GameObject.FindObjectOfType<Garage>();
        taskMenu = GameObject.FindObjectOfType<TaskMenu>();
        kaController = GameObject.FindObjectOfType<KAController>();
        waitBackground = GameObject.FindObjectOfType<WaitBackground>();
        mainScreen = GameObject.FindObjectOfType<MainScreen>();
        bg = GameObject.Find("BG");
        carsInfo = GetComponent<CarsInfo>();
        filling = GameObject.FindObjectOfType<Filling>();
        carChanger = GameObject.FindObjectOfType<CarChanger>();
        dustSmall = GameObject.Find("DustSmall");
        windowWarning = GameObject.FindObjectOfType<WindowWarning>();
        windowConfirmation = GameObject.FindObjectOfType<WindowConfirmation>();

        mainBonus = GetComponent<MainBonus>();

        dailyEvents = GetComponent<DailyEvents>();
        moneyBar = GameObject.FindObjectOfType<MoneyBar>();

        boosterMenu = GameObject.FindObjectOfType<BoosterMenu>();

        dailyGiftMenu = GameObject.FindObjectOfType<DailyGiftMenu>();

        backMenuButton = GameObject.FindObjectOfType<BackMenuButton>();
        /*
        car = garage.transform.Find("Car").gameObject;
        if (car == null)
            CreateCar();    */
    }
Esempio n. 3
0
    void OnTriggerEnter(Collider other)
    {
        Ball ball = other.GetComponent <Ball>();

        if (ball)
        {
            if (m_level == 0)
            {
                m_level                     = ball.level;
                m_filling                   = Instantiate(m_fillingPrefab);
                m_filling.m_material        = m_levels[m_level - 1];
                m_filling.m_radius          = m_radius;
                m_filling.m_thickness       = m_thickness;
                m_filling.m_triangle_number = m_triangle_number;

                m_filling.transform.SetParent(transform);
                m_filling.transform.localPosition = Vector3.zero;

                m_isFilling = true;

                //GetComponent<Alive>().SetColor(m_filling.m_material);
            }

            m_balls.Add(ball);
        }
    }
Esempio n. 4
0
    public async Task RemoveItem(string orderId, Filling filling)
    {
        var(cart, version) = await repository.Get(orderId);

        cart.Items.Remove(filling);
        await repository.Put(cart, version);
    }
        static void ClockwiseFilling(ref Filling spiral)
        {
            switch (spiral.i)
            {
            case -1:
                spiral.i = 0;
                spiral.j = 1;
                break;

            case 1:
                spiral.i = 0;
                spiral.j = -1;
                break;

            case 0:
                if (spiral.j > 0)
                {
                    spiral.i = 1;
                    spiral.j = 0;
                }
                else
                {
                    spiral.i = -1;
                    spiral.j = 0;
                }
                break;
            }
        }
Esempio n. 6
0
 /// <summary>
 /// Выводит в консоль результаты алгоритма на каждом шаге
 /// </summary>
 /// <param name="state">Состояние решения.</param>
 /// <param name="e">Значение функции оптимизации.</param>
 /// <param name="elapsedTime">Время работы алгоритма.</param>
 private static void ShowResult(State state, IList <Service> services, double e, TimeSpan elapsedTime)
 {
     Console.WriteLine(elapsedTime.TotalSeconds + " c");
     Console.WriteLine("Заполненность: " + Filling.Calculate(state.Servers, services));
     Console.WriteLine("Значение функции оптимизации:" + e);
     foreach (var server in state.Servers)
     {
         Console.Write("Сервер: " + server.Name +
                       ", HddFull: " + server.HddFull +
                       ", RamFull: " + server.RamFull +
                       ", HddFree: " + server.HddFree +
                       ", RamFree: " + server.RamFree +
                       ", CpuFree: " + server.CpuFree +
                       ", сервисы: ");
         Console.Write(" Заполненность Hdd: " + Math.Round(100 - (server.HddFree / server.HddFull * 100)) + "%");
         Console.Write(" Заполненность Ram: " + Math.Round(100 - (server.RamFree / server.RamFull * 100)) + "%");
         Console.Write(" Заполненность Cpu: " + Math.Round(100 - server.CpuFree) + "%");
         foreach (var service in server.Services)
         {
             Console.Write(service.Name + ", ");
         }
         Console.WriteLine();
         Console.WriteLine();
     }
 }
Esempio n. 7
0
        public frmCarsEdit(int?_nCarID)
        {
            if (_nCarID.HasValue)
            {
                nCarID = (int)_nCarID;
            }

            oCar = new Car();
            if (oCar.ErrorNumber != 0)
            {
                IsValid = false;
            }

            if (IsValid)
            {
                oDriver      = new Driver();
                oFilling     = new Filling();
                oPermitLevel = new PermitLevel();
                if (oDriver.ErrorNumber != 0 ||
                    oFilling.ErrorNumber != 0 ||
                    oPermitLevel.ErrorNumber != 0)
                {
                    IsValid = false;
                }
            }

            if (IsValid)
            {
                InitializeComponent();
            }
        }
Esempio n. 8
0
        public frmCars()
        {
            oCarList       = new Car();
            oCarCur        = new Car();
            oCarTypeList   = new CarType();
            oCarTypeCur    = new CarType();
            oTripList      = new Trip();
            oFillingList   = new Filling();
            oCarInTypeList = new Car();
            if (oCarList.ErrorNumber != 0 ||
                oCarCur.ErrorNumber != 0 ||
                oCarTypeList.ErrorNumber != 0 ||
                oCarTypeCur.ErrorNumber != 0 ||
                oTripList.ErrorNumber != 0 ||
                oFillingList.ErrorNumber != 0 ||
                oCarInTypeList.ErrorNumber != 0)
            {
                IsValid = false;
            }

            if (IsValid)
            {
                InitializeComponent();
            }
        }
        public ActionResult DeleteConfirmed(int id)
        {
            Filling filling = db.Fillings.Find(id);

            db.Fillings.Remove(filling);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 10
0
    public async Task AddItem(string orderId, Filling filling)
    {
        var(cart, version) = await repository.Get(orderId);

        if (!cart.Items.Contains(filling))
        {
            cart.Items.Add(filling);
        }
        await repository.Put(cart, version);
    }
 public ActionResult Edit([Bind(Include = "FillingId,FillingName")] Filling filling)
 {
     if (ModelState.IsValid)
     {
         db.Entry(filling).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(filling));
 }
Esempio n. 12
0
    public async Task AddItem(string customer, string orderId, Filling filling)
    {
        var(cart, version) = await repository.Get <ShoppingCart>(customer, orderId);

        if (!cart.Items.Contains(filling))
        {
            cart.Items.Add(filling);
        }
        await repository.Put(cart.Customer, (cart, version));
    }
Esempio n. 13
0
        public TableOccupation(IFillingData fillingData, ITableData tableData, Reservation reservation)
        {
            ReservationId = reservation.Id;
            TableId       = reservation.TableId;
            TableNumber   = tableData.Get(TableId).Number;
            StartTime     = reservation.StartTime;
            Filling filling = fillingData.Get(reservation.FillingId);

            Duration = filling.DurationMinutes + filling.BufferMinutes;
        }
Esempio n. 14
0
 /// <summary>
 /// Populates the page with content passed during navigation.  Any saved state is also
 /// provided when recreating a page from a prior session.
 /// </summary>
 /// <param name="sender">
 /// The source of the event; typically <see cref="NavigationHelper"/>
 /// </param>
 /// <param name="e">Event data that provides both the navigation parameter passed to
 /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and
 /// a dictionary of state preserved by this page during an earlier
 /// session.  The state will be null the first time a page is visited.</param>
 private void NavigationHelper_LoadState(object sender, LoadStateEventArgs e) {
     var filling = e.NavigationParameter as Filling;
     if(filling == null) {
         filling = new Filling();
     }
     this.DataContext = filling;
     DateField.Text = filling.Date.ToString("d");
     PriceField.Text = filling.Price.ToString();
     VolumeField.Text = filling.FilledVolume.ToString();
     OdometerField.Text = filling.Odometer.ToString();
 }
        public ActionResult Create([Bind(Include = "FillingId,FillingName")] Filling filling)
        {
            if (ModelState.IsValid)
            {
                db.Fillings.Add(filling);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(filling));
        }
Esempio n. 16
0
 public Chocolate(string name, double weight, double sugar, Filling filling = Filling.none, Covering chocolate = Covering.none)
 {
     if (name != null) { this.Name = name; }
     else
     {
         this.Name = "chocolate" + count;
         count++;
     }
     this.Weigth = weight;
     this.Sugar = sugar;
     this.FillingOfSweet = filling;
     this.Chocolate = chocolate;
 }
        // GET: Fillings/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Filling filling = db.Fillings.Find(id);

            if (filling == null)
            {
                return(HttpNotFound());
            }
            return(View(filling));
        }
Esempio n. 18
0
 private void ucSelectRecordID_FuelTypes_Restore()
 {
     if (ucSelectRecordID_FuelTypes.sourceData == null)
     {
         Filling oFilling = new Filling();
         if (Utilities.FillData_FuelTypes(oFilling))
         {
             ucSelectRecordID_FuelTypes.Restore(oFilling.TableFuelTypes);
         }
     }
     else
     {
         ucSelectRecordID_FuelTypes.Restore();
     }
 }
Esempio n. 19
0
        public frmWayBills()
        {
            // для основных таблиц
            oWayBillList = new WayBill();
            oWayBillCur  = new WayBill();
            oFillingList = new Filling();
            oFillingCur  = new Filling();
            if (oWayBillList.ErrorNumber != 0 ||
                oWayBillCur.ErrorNumber != 0 ||
                oFillingList.ErrorNumber != 0 ||
                oFillingCur.ErrorNumber != 0)
            {
                IsValid = false;
            }

            // для связанных таблиц
            if (IsValid)
            {
                oTripInWayBillList    = new Trip();
                oFillingInWayBillList = new Filling();
                if (oTripInWayBillList.ErrorNumber != 0 ||
                    oFillingInWayBillList.ErrorNumber != 0)
                {
                    IsValid = false;
                }
            }

            // для отображения таблиц
            if (IsValid)
            {
                oWayBillTemp = new WayBill();
                oTripTemp    = new Trip();
                if (oWayBillTemp.ErrorNumber != 0 ||
                    oTripTemp.ErrorNumber != 0)
                {
                    IsValid = false;
                }
            }

            if (IsValid)
            {
                InitializeComponent();
            }
        }
Esempio n. 20
0
        private void SelectedFillingType_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (!FillingSelected)
            {
                return;
            }
            FillingType fillingType = SelectedFillingType.SelectedItem as FillingType;
            Filling     filling     = SelectionEventHandler.SelectedNode as Filling;

            if (filling == null)
            {
                return;
            }
            if (!filling.Model.FillingType.Equals(fillingType))
            {
                filling.Model.FillingType = fillingType;
                filling.Repaint();
            }
        }
Esempio n. 21
0
        public frmFillingsEdit(int?_nFillingID, int?_nWayBillID)
        {
            if (_nFillingID.HasValue)
            {
                nFillingID = (int)_nFillingID;
            }
            if (_nWayBillID.HasValue)
            {
                nWayBillID = (int)_nWayBillID;
            }

            oFilling = new Filling();
            if (oFilling.ErrorNumber != 0)
            {
                IsValid = false;
            }

            if (IsValid)
            {
                oWayBill = new WayBill();
                if (oWayBill.ErrorNumber != 0)
                {
                    IsValid = false;
                }
            }

            if (IsValid)
            {
                oCar    = new Car();
                oDriver = new Driver();
                if (oCar.ErrorNumber != 0 ||
                    oDriver.ErrorNumber != 0)
                {
                    IsValid = false;
                }
            }

            if (IsValid)
            {
                InitializeComponent();
            }
        }
Esempio n. 22
0
 private void NerimanCombo_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (NerimanCombo.Text == "Tasting  250CC")
     {
         NerimanOrder.Text = "";
         Baverages tasting = new LeShokaladeNeriman();
         tasting           = new Tasting(tasting);
         NerimanOrder.Text = string.Format("Tadimlik Neriman-${0}", tasting.GetPrice() * Convert.ToDouble(NerimanUpdown.Value));
     }
     if (NerimanCombo.Text == "Filling  400CC")
     {
         NerimanOrder.Text = "";
         Baverages filling = new LeShokaladeNeriman();
         filling           = new Filling(filling);
         NerimanOrder.Text = string.Format("Filling Neriman-${0}", filling.GetPrice() * Convert.ToDouble(NerimanUpdown.Value));
     }
     if (NerimanCombo.SelectedIndex == 0)
     {
         NerimanOrder.Text = "";
     }
 }
Esempio n. 23
0
 private void SudeCombo_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (SudeCombo.Text == "Tasting  250CC")
     {
         SudeOrder.Text = "";
         Baverages tasting = new LeShokaladeSude();
         tasting        = new Tasting(tasting);
         SudeOrder.Text = string.Format("Tasting Sude-${0}", tasting.GetPrice() * Convert.ToDouble(SudeUpDown.Value));
     }
     if (SudeCombo.Text == "Filling  400CC")
     {
         SudeOrder.Text = "";
         Baverages filling = new LeShokaladeSude();
         filling        = new Filling(filling);
         SudeOrder.Text = string.Format("Filling Sude-${0}", filling.GetPrice() * Convert.ToDouble(SudeUpDown.Value));
     }
     if (SudeCombo.SelectedIndex == 0)
     {
         SudeOrder.Text = "";
     }
 }
Esempio n. 24
0
        private void SelectedIncludeIProfileTypeCheckBox_Click(object sender, RoutedEventArgs e)
        {
            if (!FillingSelected)
            {
                return;
            }
            ProfileType profileType = SelectedIProfileType.SelectedItem as ProfileType;
            Filling     filling     = SelectionEventHandler.SelectedNode as Filling;

            if (filling == null)
            {
                return;
            }
            if (SelectedIncludeIProfileTypeCheckBox.IsChecked.Value)
            {
                filling.Model.ProfileType = SelectedIProfileType.SelectedItem as ProfileType;
            }
            else
            {
                filling.Model.ProfileType = null;
            }
        }
Esempio n. 25
0
        public static Filling ToFilling(this IFilling item)
        {
            var val = new Filling();

            if (item.FillingType != null)
            {
                val.FillingType = item.FillingType;
            }
            if (item.Parent != null)
            {
                val.Parent = item.Parent;
            }
            if (item.Code != null)
            {
                val.Code = item.Code;
            }
            if (item.ProfileType != null)
            {
                val.ProfileType = item.ProfileType;
            }

            return(val);
        }
Esempio n. 26
0
 /// <summary>
 /// Обработка нажатия на вершину
 /// </summary>
 void OnMouseUp()
 {
     //Проверка: заблокирована ли кнопка для нажатия или нет
     if (fillingTime == 0 && Controller.shared.state == GameState.playing && !IsAnimationInProcess)
     {
         //Проверка: есть ли у вершины видимые ребра для поворота или у нее нет смежных ребер
         if (CheckForVisibleEdges() && !IsBlocked)
         {
             Controller.touchEvent = true;
             Controller.shared.GetTouch(Index);
             //Play sound
             this.transform.parent.GetComponent <Controller>().soundController.GetComponent <GameSoundController>().PopEffect2();
             //Время(_time) = расстояние необходимое для поворота (в данном случае 90 градусов) / скорость (speed)
             _rotationTime = Mathf.Abs(90 / rotationSpeed);
             //Блокировка кнопки на время анимации
             IsAnimationInProcess = true;
             //Разблокирование кнопки по истечению анимации
             Invoke("Prorogue", 0.6f);
             //Создание вершины - подложки для анимации
             Point.setFilledPoint(Index, IsBlocked);
             objectColor = Filling.GetComponent <SpriteRenderer> ().material.color;
             fillingTime = 0.5f;
         }
         else
         {
             if (IsBlocked)
             {
                 Point.setFilledPoint(Index, IsBlocked);
                 objectColor = Filling.GetComponent <SpriteRenderer> ().material.color;
                 fillingTime = 0.5f;
                 this.transform.parent.GetComponent <Controller>().soundController.GetComponent <GameSoundController>().BadClick();
             }
             Handheld.Vibrate();
         }
     }
 }
Esempio n. 27
0
        public static bool FillData_FuelTypes(Filling oFilling)
        {
            if (oFilling == null)
            {
                return(false);
            }

            RFMCursorWait.Set(true);
            if (!oFilling.FillTableFuelTypes() ||
                oFilling.ErrorNumber != 0 ||
                oFilling.TableFuelTypes == null)
            {
                RFMCursorWait.Set(false);
                RFMMessage.MessageBoxError("Ошибка при получении данных (типы топлива)...");
                return(false);
            }
            RFMCursorWait.Set(false);
            if (oFilling.TableFuelTypes.Rows.Count == 0)
            {
                RFMMessage.MessageBoxError("Нет данных (типы топлива)...");
                return(false);
            }
            return(true);
        }
Esempio n. 28
0
        public HabitViewModel(IDateTimeProvider dateTimeProvider, IHabitService habitService, INavigationService navigation, IHabitModel model)
            : this(dateTimeProvider, habitService)
        {
            _navigation = navigation;

            CreationDate = model.CreationDate;
            Id           = model.Id;
            _repeatType  = model.RepeatType;
            _description = model.Description;

            if (StartDate != null && StartDate <= habitService.DateTimeProvider.Now)
            {
                if (string.IsNullOrWhiteSpace(model.Filling))
                {
                    Filling = InitFilling();
                }
                else
                {
                    Filling = new ObservableDictionary <DateTime, int>(
                        JsonConvert.DeserializeObject <Dictionary <DateTime, int> >(model.Filling));
                }
            }
            else
            {
                Filling = new ObservableDictionary <DateTime, int>();
            }


            _habitType      = model.HabitType;
            _daysToRepeat   = model.DaysToRepeat;
            _startDate      = model.StartDate;
            _title          = model.Title;
            _repeatsToday   = Filling.ContainsKey(DateTime.Today) ? Filling[DateTime.Today] : 0;
            _isRecommended  = model.IsRecommended;
            _maxRepeatsADay = model.RepeatsADay;
        }
Esempio n. 29
0
 public Candy(TypeCandy type, Filling filling, string name, double weight, int gSugar) : base(name, weight, gSugar)
 {
     Type    = type;
     Filling = filling;
 }
Esempio n. 30
0
        private void MI_Filling_FromExcel_Click(object sender, RoutedEventArgs e)
        {
            DBSolom.Db db = new Db(Func.GetConnectionString);

            if (db.Lows.Include(i => i.Правовласник).FirstOrDefault(f => f.Видалено == false && f.Правовласник.Логін == Func.Login && f.Filling == true) is null)
            {
                MessageBox.Show("У вас відсутні права на виконання цієї операції!", "Maestro", MessageBoxButton.OK, MessageBoxImage.Stop);
            }
            else
            {
                if (MessageBox.Show("Увага!\nЦя операція є небезпечною, перевірте чи всі головні розпорядники є в базі, кекв та інші необхідні властивості.\nВи підтверджуєте виконання?", "Maestro", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes)
                {
                    OpenFileDialog openFileDialog = new OpenFileDialog();
                    openFileDialog.Filter = "Excel files (*.xlsx;*.xlsm;*.xls)|*.xlsx;*.xlsm;*.xls";
                    if (openFileDialog.ShowDialog() == true)
                    {
                        var Task = new Task(() =>
                        {
                            //Потому что Finally
                            Excel.Application application = null;
                            Excel.Workbook workbook       = null;
                            Excel.Worksheet worksheet     = null;
                            Excel.Range range             = null;
                            User user = db.Users.First(f => f.Видалено == false && f.Логін == Func.Login);
                            try
                            {
                                #region "Variables"
                                application = new Excel.Application();
                                application.AskToUpdateLinks = false;
                                application.DisplayAlerts    = false;
                                workbook             = application.Workbooks.Open(openFileDialog.FileName);
                                worksheet            = workbook.Worksheets["Maestro_Data"];
                                double[] months      = new double[12];
                                DateTime Проведено_Е = DateTime.Now;
                                int fond_code        = 0;
                                string main_manager  = null;
                                long kfk_code        = 0;
                                long kfb_code        = 0;
                                long kdb_code        = 0;
                                long kekv_code       = 0;
                                Foundation foundation;
                                Main_manager Main_Manager;
                                KFK kFK;
                                KFB kFB;
                                KDB kDB;
                                KEKB kEKB;
                                List <Filling> fillings = new List <Filling>();
                                #endregion

                                for (int i = 2; i <= application.WorksheetFunction.CountA(worksheet.Columns[1]); i++)
                                {
                                    #region "Variables"
                                    range       = worksheet.Cells[i, 1];
                                    Проведено_Е = Convert.ToDateTime(Convert.ToString(range.Value2));

                                    range      = worksheet.Cells[i, 2];
                                    fond_code  = Convert.ToInt32(Convert.ToString(range.Value2));
                                    foundation = db.Foundations.First(f => f.Видалено == false && f.Код == fond_code);

                                    range        = worksheet.Cells[i, 3];
                                    main_manager = (string)range.Value2;
                                    Main_Manager = db.Main_Managers.First(f => f.Видалено == false && f.Найменування == main_manager);

                                    range    = worksheet.Cells[i, 4];
                                    kfk_code = Convert.ToInt64(Convert.ToString(range.Value2));
                                    kFK      = db.KFKs.First(f => f.Видалено == false && f.Код == kfk_code);

                                    range    = worksheet.Cells[i, 5];
                                    kfb_code = Convert.ToInt64(Convert.ToString(range.Value2));
                                    kFB      = db.KFBs.First(f => f.Видалено == false && f.Код == kfb_code);

                                    range    = worksheet.Cells[i, 6];
                                    kdb_code = Convert.ToInt64(Convert.ToString(range.Value2));
                                    kDB      = db.KDBs.First(f => f.Видалено == false && f.Код == kdb_code);

                                    range     = worksheet.Cells[i, 7];
                                    kekv_code = Convert.ToInt64(Convert.ToString(range.Value2));
                                    kEKB      = db.KEKBs.First(f => f.Видалено == false && f.Код == kekv_code);

                                    #endregion

                                    for (int k = 1; k <= 12; k++)
                                    {
                                        range         = worksheet.Cells[i, 7 + k];
                                        months[k - 1] = Convert.ToDouble(Convert.ToString(range.Value2 ?? 0));
                                    }

                                    Filling filling = new Filling()
                                    {
                                        Створив   = user,
                                        Змінив    = user,
                                        Підписано = true,
                                        Проведено = Проведено_Е,

                                        Фонд = foundation,
                                        Головний_розпорядник = Main_Manager,
                                        КФК  = kFK,
                                        КФБ  = kFB,
                                        КДБ  = kDB,
                                        КЕКВ = kEKB,

                                        Січень   = months[0],
                                        Лютий    = months[1],
                                        Березень = months[2],
                                        Квітень  = months[3],
                                        Травень  = months[4],
                                        Червень  = months[5],
                                        Липень   = months[6],
                                        Серпень  = months[7],
                                        Вересень = months[8],
                                        Жовтень  = months[9],
                                        Листопад = months[10],
                                        Грудень  = months[11]
                                    };

                                    fillings.Add(filling);
                                }

                                List <string> errors = new List <string>();

                                foreach (var item in fillings)
                                {
                                    errors.AddRange(Func.ChangeFinDocIsAllow(db, item.Проведено, item.КФК, item.Головний_розпорядник, item.КЕКВ, item.Фонд));
                                    if (errors.Count == 0)
                                    {
                                        db.Fillings.Local.Add(item);
                                    }
                                    else
                                    {
                                        break;
                                    }
                                }

                                if (errors.Count == 0)
                                {
                                    db.SaveChanges();
                                    MessageBox.Show("Готово!", "Maestro", MessageBoxButton.OK, MessageBoxImage.Information);
                                }
                                else
                                {
                                    Dispatcher.Invoke(() =>
                                    {
                                        Maestro.Sys.Errors er = new Maestro.Sys.Errors(errors);
                                        er.Show();
                                    });
                                }
                            }
                            catch (Exception Exp)
                            {
                                MessageBox.Show(Exp.Message);
                            }
                            finally
                            {
                                if (workbook != null)
                                {
                                    workbook.Close(false);
                                }
                                if (application != null)
                                {
                                    application.Quit();
                                }
                                application    = null;
                                openFileDialog = null;
                                workbook       = null;
                                worksheet      = null;
                            }
                        });

                        Task.Start();
                    }
                    else
                    {
                        MessageBox.Show("Оберіть файл з листом Maestro_Data!", "Maestro", MessageBoxButton.OK, MessageBoxImage.Hand);
                    }
                }
            }
        }
Esempio n. 31
0
 private void GiveOrder_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(Customer.Text))
     {
         MessageBox.Show("Please specify a name!", "Warning!!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else
     {
         bool control = false;
         foreach (string choice in ProductList.CheckedItems)
         {
             string CustomerSent = Customer.Text;
             if (choice == "TastingSude")
             {
                 Baverages tasting = new LeShokaladeSude();
                 tasting = new Tasting(tasting);
                 DatabaseInsert insert = new DatabaseInsert();
                 insert.Connection();
                 insert.InsertTakeAway(CustomerSent, choice, tasting.GetPrice());
                 insert.Execute();
                 insert.Close();
                 control = true;
             }
             if (choice == "FillingSude")
             {
                 Baverages filling = new LeShokaladeSude();
                 filling = new Filling(filling);
                 DatabaseInsert insert = new DatabaseInsert();
                 insert.Connection();
                 insert.InsertTakeAway(CustomerSent, choice, filling.GetPrice());
                 insert.Execute();
                 insert.Close();
                 control = true;
             }
             if (choice == "TastingNeriman")
             {
                 Baverages tasting = new LeShokaladeNeriman();
                 tasting = new Tasting(tasting);
                 DatabaseInsert insert = new DatabaseInsert();
                 insert.Connection();
                 insert.InsertTakeAway(CustomerSent, choice, tasting.GetPrice());
                 insert.Execute();
                 insert.Close();
                 control = true;
             }
             if (choice == "FillingNeriman")
             {
                 Baverages filling = new LeShokaladeNeriman();
                 filling = new Filling(filling);
                 DatabaseInsert insert = new DatabaseInsert();
                 insert.Connection();
                 insert.InsertTakeAway(CustomerSent, choice, filling.GetPrice());
                 insert.Execute();
                 insert.Close();
                 control = true;
             }
             if (choice == "Lemonade")
             {
                 Baverages      bev    = new Lemonade();
                 DatabaseInsert insert = new DatabaseInsert();
                 insert.Connection();
                 insert.InsertTakeAway(CustomerSent, bev.GetDescription(), bev.GetPrice());
                 insert.Execute();
                 insert.Close();
                 control = true;
             }
             if (choice == "Americano")
             {
                 Baverages      bev    = new Americano();
                 DatabaseInsert insert = new DatabaseInsert();
                 insert.Connection();
                 insert.InsertTakeAway(CustomerSent, bev.GetDescription(), bev.GetPrice());
                 insert.Execute();
                 insert.Close();
                 control = true;
             }
             if (choice == "MilkyAmericano")
             {
                 Baverages bev = new Americano();
                 bev = new Milk(bev);
                 DatabaseInsert insert = new DatabaseInsert();
                 insert.Connection();
                 insert.InsertTakeAway(CustomerSent, bev.GetDescription(), bev.GetPrice());
                 insert.Execute();
                 insert.Close();
                 control = true;
             }
         }
         if (control)
         {
             MessageBox.Show("Your order has been received.", "Thank you :)");
             AbstractStore store = new LeShokaladeDukkan();
             Box.Text = store.OrderDessert("sude").Box();
             for (int i = 0; i < ProductList.Items.Count; i++)
             {
                 ProductList.SetItemChecked(i, false);
             }
             Orders.Text   = " ";
             Customer.Text = "Your Name";
         }
         else
         {
             MessageBox.Show("You did not choose any order!", "Warning!!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
 }
Esempio n. 32
0
 public OrderLine(Filling filling)
 {
     Filling = filling;
 }
Esempio n. 33
0
 public Sandwich(Filling filling)
 {
 }