コード例 #1
0
    public bool ReceiveFromInput(Code code, int value)
    {
            Modul2Property hp = new Modul2Property();
            m_CollectionDescription = new CollectionDescription();
            m_CollectionDescription.Id = (int)((DateTime.Now.Ticks / 10) % 1000000000);


            hp.Code = code;
            hp.Modul2Value = value;

            m_CollectionDescription.m_HistoricalCollection.m_Modul2Property[0] = hp;

            Codes codes = new Codes();
            m_CollectionDescription.Dataset = codes.GetDataset(code);

            if (ValidationCheck(m_CollectionDescription.m_HistoricalCollection.m_Modul2Property[0].Code, m_CollectionDescription.Dataset))
            {
                Logger.Log("ReceiveFromInput u Modulu2 je konvertovala primljene podatke u CollectionDescription");
                Logger.Log("CD : " + m_CollectionDescription + "\n");
                Serialize(m_CollectionDescription);
            }
            else
            {
                Logger.Log("Validacija Dataset-a u Modulu2 nije prosla.\n");
                return false;
            }
            return true;
        }
コード例 #2
0
ファイル: Modul1.cs プロジェクト: projekatRES/projekat
    public bool ReceiveFromInput(Code code, int value)
    {
        foreach (Description d in m_ListDescription.m_Description) // prolazi kroz lista deskriptiona koja se sastoji od klase deskription
        {
            foreach (Modul1Property dpp in d._m1Property)          // prolazi kroz listu modul1propertyja koja se sastoji od modul1prorpertija,coda i value
            {
                if (dpp.Code == code)                              // ako postoji code vec u listi onda ce uzeti prosledjenu vrednost
                {
                    dpp.Value = value;
                    check     = true;
                }
            }
        }
        if (check == false)
        {
            Modul1Property dp = new Modul1Property();
            dp.Code  = code;
            dp.Value = value;

            Description des = new Description();
            des._m1Property.Add(dp);
            des.Id = (int)((DateTime.Now.Ticks / 10) % 1000000000);

            Codes codes = new Codes();
            des.Dataset = codes.GetDataset(dp.Code); //vraca vrednost dataseta

            if (m_ListDescription.m_Description.Count > 0)
            {
                foreach (Description d in m_ListDescription.m_Description)
                {
                    if ((d.Dataset == des.Dataset) && (d._m1Property[0].Value != des._m1Property[0].Value))
                    {
                        /*  Kad Modul1 u svojoj kolekciji nakupi 2 razlicite vrednosti u okviru istog dataset-a,
                         *  tada prosledjuje podatke Modul2 komponenti (WriteToModul2).*/
                        writeToModul2 = true;
                    }
                }
            }

            m_ListDescription.m_Description.Add(des);
            Logger.Log("\n\nDodavanje novog Description-a u Listu Description Modula2\nData: " + des._m1Property[0].Code + ", " + des._m1Property[0].Value + "\nVreme:" + DateTime.Now);
        }
        else
        {
            Logger.Log("Modul1Property sa vrednoscu Coda " + code + " vec postoji, njegova vrednost je sad postavljena na " + value + "\nVreme: " + DateTime.Now);
            check = false;
        }

        if (writeToModul2 == true)
        {
            /* Tom prilikom Modul1 prosledjuje Modul2 komponenti svoju strukturu – LD. */
            Logger.Log("\nNadjene dve razlicite vrednosti istog DataSet-a.\nSlanje ListDescription-a Modulu2.\n");

            m_Modul2.ReceiveFromModul1(m_ListDescription);

            m_ListDescription.m_Description.Clear();
            writeToModul2 = false;
            if (m_ListDescription.m_Description.Count == 0)
            {
                Logger.Log("Ciscenje Modula1 posle slanja podataka Modulu2.\n");
            }
        }
        else
        {
            Logger.Log("Dve razlicite vrednosti od istog Dataset-a jos nisu pronadjene.\n");
        }
        return(true);
    }