Ejemplo n.º 1
0
        public string SentToList()
        {
            string    PersonList = "";
            DataTable Access     = new DataTable();

            _Import.Load_TxtToDataTable2(ref Access, "Access");

            foreach (DataRow Person in Access.Rows)
            {
                if (_Electronic && Person["Role"].ToString() == "EleMenager")
                {
                    PersonList += Person["Mail"].ToString() + ",";
                }
                if (_Mechanic && Person["Role"].ToString() == "MechMenager")
                {
                    PersonList += Person["Mail"].ToString() + ",";
                }
                if (_NVR && Person["Role"].ToString() == "NVRMenager")
                {
                    PersonList += Person["Mail"].ToString() + ",";
                }
                if (_PC && Person["Role"].ToString() == "PCMenager")
                {
                    PersonList += Person["Mail"].ToString() + ",";
                }
            }
            if (PersonList.Length > 0)
            {
                PersonList = PersonList.Substring(0, PersonList.Length - 1);
            }

            return(PersonList);
        }
Ejemplo n.º 2
0
        private DataTable ActualValue(string Structure, string Instalation, bool Estymacja)
        {
            DataTable SumPNC = new DataTable();
            DataTable ActualAllRow;
            DataRow   Actual;

            //string Name;

            if (Estymacja)
            {
                _Import.Load_TxtToDataTable2(ref SumPNC, "SumPNCBU");
            }
            else
            {
                _Import.Load_TxtToDataTable2(ref SumPNC, "SumPNC");
            }

            ActualAllRow = SumPNC.Clone();

            if (Structure == Instalation)
            {
                Actual = SumPNC.Select(string.Format("PNC LIKE '%{0}%'", "All")).First();
                ActualAllRow.Rows.Add(Actual.ItemArray);
            }
            else
            {
                if (Instalation == "All")
                {
                    Actual = SumPNC.Select(string.Format("PNC LIKE '%{0}%'", Structure)).First();
                    ActualAllRow.Rows.Add(Actual.ItemArray);
                }
                else if (Structure == "All")
                {
                    Actual = SumPNC.Select(string.Format("PNC LIKE '%{0}%'", "DMD_" + Instalation)).First();
                    ActualAllRow.Rows.Add(Actual.ItemArray);
                    Actual = SumPNC.Select(string.Format("PNC LIKE '%{0}%'", "D45_" + Instalation)).First();
                    ActualAllRow.Rows.Add(Actual.ItemArray);
                }
                else
                {
                    Actual = SumPNC.Select(string.Format("PNC LIKE '%{0}%'", Structure + "_" + Instalation)).First();
                    ActualAllRow.Rows.Add(Actual.ItemArray);
                }
            }

            return(ActualAllRow);
        }
Ejemplo n.º 3
0
        private void LoadData_DM()
        {
            DataGridView DM   = (DataGridView)MainProgram.Self.TabControl.Controls.Find("DGV_StatisticDM", true).First();
            decimal      Year = ((NumericUpDown)MainProgram.Self.TabControl.Controls.Find("num_StatisticYearOption", true).First()).Value;
            decimal      Kurs;

            DataTable Table = new DataTable();
            DataRow   Data  = null;

            _Import.Load_TxtToDataTable2(ref Table, "Kurs");

            ClearDGVForDM(DM);

            Data = Table.Select(string.Format("Year LIKE '%{0}%'", Year.ToString())).FirstOrDefault();

            if (Data != null)
            {
                Kurs = CheckExchangeRate(Data);

                if (Kurs == 0)
                {
                    return;
                }

                string[] DMRevision = Data["DM"].ToString().Split('/');

                if (DMRevision[0] != "")
                {
                    DM.Rows[0].Cells["DM"].Value = Math.Round(decimal.Parse(DMRevision[0]) / Kurs, 0, MidpointRounding.AwayFromZero);
                }
                if (DMRevision[1] != "")
                {
                    DM.Rows[1].Cells["DM"].Value = Math.Round(decimal.Parse(DMRevision[1]) / Kurs, 0, MidpointRounding.AwayFromZero);
                }
                if (DMRevision[2] != "")
                {
                    DM.Rows[2].Cells["DM"].Value = Math.Round(decimal.Parse(DMRevision[2]) / Kurs, 0, MidpointRounding.AwayFromZero);
                }
                if (DMRevision[3] != "")
                {
                    DM.Rows[3].Cells["DM"].Value = Math.Round(decimal.Parse(DMRevision[3]) / Kurs, 0, MidpointRounding.AwayFromZero);
                }
                if (DMRevision[4] != "")
                {
                    DM.Rows[4].Cells["DM"].Value = Math.Round(decimal.Parse(DMRevision[4]) / Kurs, 0, MidpointRounding.AwayFromZero);
                }

                CalcDelta(DM);
            }
        }
Ejemplo n.º 4
0
        private void LoadData_Quantity()
        {
            DataGridView Quantity = (DataGridView)MainProgram.Self.TabControl.Controls.Find("DGV_StatisticQuantity", true).First();
            decimal      Year     = ((NumericUpDown)MainProgram.Self.TabControl.Controls.Find("num_StatisticYearOption", true).First()).Value;
            decimal      BU       = 0;
            decimal      EA1      = 0;
            decimal      EA2      = 0;
            decimal      EA3      = 0;
            decimal      EA4      = 0;

            DataTable QuantityBU     = new DataTable();
            DataTable QuantityActual = new DataTable();
            DataRow   BUData         = null;
            DataRow   Actual         = null;

            _Import.Load_TxtToDataTable2(ref QuantityBU, "SumPNCBU");
            _Import.Load_TxtToDataTable2(ref QuantityActual, "SumPNC");

            ClearDGVForQuantity(Quantity);

            BUData = QuantityBU.Select(string.Format("PNC LIKE '%{0}%'", "All")).First();
            Actual = QuantityActual.Select(string.Format("PNC LIKE '%{0}%'", "All")).First();

            if (Actual != null)
            {
                for (int counter = 1; counter <= 12; counter++)
                {
                    if (QuantityActual.Columns.Contains(counter.ToString() + "/" + Year.ToString()))
                    {
                        decimal Help = decimal.Parse(Actual[counter.ToString() + "/" + Year.ToString()].ToString());

                        EA4 += Help;

                        if (counter < 3)
                        {
                            EA1 += Help;
                        }
                        if (counter < 6)
                        {
                            EA2 += Help;
                        }
                        if (counter < 9)
                        {
                            EA3 += Help;
                        }
                    }
                }
            }

            if (BUData != null)
            {
                if (QuantityBU.Columns.Contains("BU/1/" + Year.ToString()))
                {
                    for (int counter = 1; counter <= 12; counter++)
                    {
                        BU += decimal.Parse(BUData["BU/" + counter.ToString() + "/" + Year.ToString()].ToString());
                    }
                    Quantity.Rows[0].Cells["Q"].Value = BU;
                }
                if (QuantityBU.Columns.Contains("EA1/3/" + Year.ToString()))
                {
                    for (int counter = 3; counter <= 12; counter++)
                    {
                        EA1 += decimal.Parse(BUData["EA1/" + counter.ToString() + "/" + Year.ToString()].ToString());
                    }
                    Quantity.Rows[1].Cells["Q"].Value = EA1;
                }
                if (QuantityBU.Columns.Contains("EA2/6/" + Year.ToString()))
                {
                    for (int counter = 6; counter <= 12; counter++)
                    {
                        EA2 += decimal.Parse(BUData["EA2/" + counter.ToString() + "/" + Year.ToString()].ToString());
                    }
                    Quantity.Rows[2].Cells["Q"].Value = EA2;
                }
                if (QuantityBU.Columns.Contains("EA3/9/" + Year.ToString()))
                {
                    for (int counter = 9; counter <= 12; counter++)
                    {
                        EA3 += decimal.Parse(BUData["EA3/" + counter.ToString() + "/" + Year.ToString()].ToString());
                    }
                    Quantity.Rows[3].Cells["Q"].Value = EA3;
                }
                if (EA4 != 0)
                {
                    Quantity.Rows[4].Cells["Q"].Value = EA4;
                }
                CalcDelta(Quantity);
            }
        }