Ejemplo n.º 1
0
        public LoadFrozen(int Year)
        {
            int[] Value = new int[19];

            MainProgram.Self.FrozenView.Clear();

            var Lista = FrozenController.Load_year(Year);

            if (Lista.Count() == 0)
            {
                return;
            }

            Value[0]  = Lista.First().BU;
            Value[1]  = Lista.First().EA1;
            Value[2]  = Lista.First().EA2;
            Value[3]  = Lista.First().EA3;
            Value[4]  = Lista.First().January;
            Value[5]  = Lista.First().February;
            Value[6]  = Lista.First().March;
            Value[7]  = Lista.First().April;
            Value[8]  = Lista.First().May;
            Value[9]  = Lista.First().June;
            Value[10] = Lista.First().July;
            Value[11] = Lista.First().August;
            Value[12] = Lista.First().September;
            Value[13] = Lista.First().October;
            Value[14] = Lista.First().November;
            Value[15] = Lista.First().December;
            Value[16] = Lista.First().ElectronicApprove;
            Value[17] = Lista.First().MechanicApprove;
            Value[18] = Lista.First().NVRApprove;

            MainProgram.Self.FrozenView.SetValue(Value);
        }
Ejemplo n.º 2
0
        private void But_Frozen_Click(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            var Table = MainProgram.Self.adminTableView.ReturnDataGridView();

            Table.DataSource = FrozenController.Load();
            Cursor.Current   = Cursors.Default;
        }
Ejemplo n.º 3
0
        public SaveFrozen(int YearToSave, int[] Data)
        {
            IEnumerable <FrozenDB> Frozen = FrozenController.Load_year(YearToSave);

            if (Frozen.Count() == 0)
            {
                var NewRow = new FrozenDB();
                PrepareData(NewRow, Data);
                NewRow.Year = YearToSave;
                FrozenController.AddValue(NewRow);
            }
            else
            {
                PrepareData(Frozen.First(), Data);
                FrozenController.UpdateValue(Frozen.First());
            }
        }
Ejemplo n.º 4
0
        private bool CheckIfCanCalculate()
        {
            IEnumerable <FrozenDB> Year = FrozenController.Load_year(Convert.ToInt32(MainProgram.Self.actionView.stateView.GetYear()));

            if (Year.Count() == 1)
            {
                foreach (FrozenDB CalcYear in Year)
                {
                    FrozenYear = CalcYear;
                    CalcRow    = 0;
                    if (CalcYear.BU == 1)
                    {
                        StartCalc  = 1;
                        FinishCalc = 12;
                        CalcRow    = 4;
                        return(true);
                    }
                    if (CalcYear.EA1 == 1)
                    {
                        StartCalc  = 3;
                        FinishCalc = 12;
                        CalcRow    = 3;
                        return(true);
                    }
                    if (CalcYear.EA2 == 1)
                    {
                        StartCalc  = 6;
                        FinishCalc = 12;
                        CalcRow    = 2;
                        return(true);
                    }
                    if (CalcYear.EA3 == 1)
                    {
                        StartCalc  = 9;
                        FinishCalc = 12;
                        CalcRow    = 1;
                        return(true);
                    }
                    if (CalcYear.January == 1)
                    {
                        StartCalc  = 1;
                        FinishCalc = 1;
                        return(true);
                    }
                    if (CalcYear.February == 1)
                    {
                        StartCalc  = 2;
                        FinishCalc = 2;
                        return(true);
                    }
                    if (CalcYear.March == 1)
                    {
                        StartCalc  = 3;
                        FinishCalc = 3;
                        return(true);
                    }
                    if (CalcYear.April == 1)
                    {
                        StartCalc  = 4;
                        FinishCalc = 4;
                        return(true);
                    }
                    if (CalcYear.May == 1)
                    {
                        StartCalc  = 5;
                        FinishCalc = 5;
                        return(true);
                    }
                    if (CalcYear.June == 1)
                    {
                        StartCalc  = 6;
                        FinishCalc = 6;
                        return(true);
                    }
                    if (CalcYear.July == 1)
                    {
                        StartCalc  = 7;
                        FinishCalc = 7;
                        return(true);
                    }
                    if (CalcYear.August == 1)
                    {
                        StartCalc  = 8;
                        FinishCalc = 8;
                        return(true);
                    }
                    if (CalcYear.September == 1)
                    {
                        StartCalc  = 9;
                        FinishCalc = 9;
                        return(true);
                    }
                    if (CalcYear.November == 1)
                    {
                        StartCalc  = 10;
                        FinishCalc = 10;
                        return(true);
                    }
                    if (CalcYear.October == 1)
                    {
                        StartCalc  = 11;
                        FinishCalc = 11;
                        return(true);
                    }
                    if (CalcYear.December == 1)
                    {
                        StartCalc  = 12;
                        FinishCalc = 12;
                        return(true);
                    }
                }
                StartCalc  = 0;
                FinishCalc = 0;
                return(false);
            }
            else
            {
                FrozenYear = null;
                StartCalc  = 0;
                FinishCalc = 0;
                return(false);
            }
        }