コード例 #1
0
        /// <summary>
        /// Ziska data o psovi s danym ID, upravi je a zpet ulozi.
        /// </summary>
        /// <param name="id"></param>
        /// <param name="newData"></param>
        public void Edit(int id, Pes newData)
        {
            Pes oldData = this.GetPesById(id);

            oldData.Jmeno        = newData.Jmeno;
            oldData.Plemeno      = newData.Plemeno;
            oldData.Pohlavi      = newData.Pohlavi;
            oldData.Fci          = newData.Fci;
            oldData.Datum        = newData.Datum;
            oldData.Licence      = newData.Licence;
            oldData.Majitel      = newData.Majitel;
            oldData.Skupina      = newData.Skupina;
            oldData.StartBeh1    = newData.StartBeh1;
            oldData.StartBeh2    = newData.StartBeh2;
            oldData.ZavodLicence = newData.ZavodLicence;
            oldData.Platba       = newData.Platba;
            oldData.Doplatit     = newData.Doplatit;
            oldData.Poznamka     = newData.Poznamka;
            oldData.Diskval      = newData.Diskval;

            oldData.AgilityA0      = newData.AgilityA0;
            oldData.SpeedA0        = newData.SpeedA0;
            oldData.EnduranceA0    = newData.EnduranceA0;
            oldData.EnthusiasmA0   = newData.EnthusiasmA0;
            oldData.IntelligenceA0 = newData.IntelligenceA0;
            oldData.AgilityA1      = newData.AgilityA1;
            oldData.SpeedA1        = newData.SpeedA1;
            oldData.EnduranceA1    = newData.EnduranceA1;
            oldData.EnthusiasmA1   = newData.EnthusiasmA1;
            oldData.IntelligenceA1 = newData.IntelligenceA1;

            oldData.Body1 = newData.Body1;

            oldData.AgilityB0      = newData.AgilityB0;
            oldData.SpeedB0        = newData.SpeedB0;
            oldData.EnduranceB0    = newData.EnduranceB0;
            oldData.EnthusiasmB0   = newData.EnthusiasmB0;
            oldData.IntelligenceB0 = newData.IntelligenceB0;
            oldData.AgilityB1      = newData.AgilityB1;
            oldData.SpeedB1        = newData.SpeedB1;
            oldData.EnduranceB1    = newData.EnduranceB1;
            oldData.EnthusiasmB1   = newData.EnthusiasmB1;
            oldData.IntelligenceB1 = newData.IntelligenceB1;

            oldData.Body2 = newData.Body2;

            oldData.Barva0 = newData.Barva0;
            oldData.Barva1 = newData.Barva1;

            oldData.Dvojice0 = newData.Dvojice0;
            oldData.Dvojice1 = newData.Dvojice1;
        }
コード例 #2
0
        public Skupina(Pes iPes1, Pes iPes2)
        {
            this.id = iPes1.Id;

            this.pes1name = iPes1.Jmeno;
            this.pes2name = iPes2.Jmeno;

            this.pes1plemeno = iPes1.Plemeno;
            this.pes2plemeno = iPes2.Plemeno;

            this.pes1barva = "červená";
            this.pes2barva = "bílá";
        }
コード例 #3
0
        public Skupina(Pes iPes1, Pes iPes2, Pes iPes3)
        {
            this.id = iPes1.Id; // WTF?! proč ID prvniho psa ?!

            this.pes1name = iPes1.Jmeno;
            this.pes2name = iPes2.Jmeno;
            this.pes3name = iPes3.Jmeno;

            this.pes1plemeno = iPes1.Plemeno;
            this.pes2plemeno = iPes2.Plemeno;
            this.pes3plemeno = iPes3.Plemeno;

            this.pes1barva = "červená";
            this.pes2barva = "bílá";
            this.pes3barva = "modrá";
        }
コード例 #4
0
ファイル: Pes.cs プロジェクト: JuraSmurfer/Cours_database
 public Pes(Pes aPes)
 {
     InitVar(aPes.GetDictionary);
 }
コード例 #5
0
 /// <summary>
 /// Prida zakaznika do databaze
 /// </summary>
 /// <param name="newPes"></param>
 public void Add(Pes newPes)
 {
     this.psi.Add(newPes);
 }
コード例 #6
0
        public void read_excel_table_temp(Majitele dataM, Psi dataP, string sourceFile, Int32 list)
        {
            Int32 tmp = 0;

            Excel.Application excelApp = new Excel.Application();
            Excel.Workbook    workbook;
            Excel.Worksheet   worksheet;
            Excel.Range       range;
            string            databasePath = sourceFile;

            workbook = excelApp.Workbooks.Open(databasePath);

            worksheet = (Excel.Worksheet)workbook.Sheets.get_Item(list);

            Majitel temp_majitel = new Majitel();
            Pes     temp_pes     = new Pes();

            Int32 row = 0;

            range = worksheet.UsedRange;
            DataTable dt = new DataTable();

            String temp = null;

            for (row = 2; row <= range.Rows.Count; row++)
            {
                DataRow dr = dt.NewRow();

                temp = (range.Cells[row, 1] as Excel.Range).Value2;
                if (temp != null) // excel sloupec clenstvi
                {
                    string tempStr = temp.ToString();
                    if (tempStr[0] == 'N')
                    {
                        temp_majitel.clen = "ne"; // neni clenem klubu
                    }
                    else
                    {
                        temp_majitel.clen = "ano"; // je clenem klubu
                    }
                }
                else
                {
                    temp_majitel.clen = "ano"; // policko by melo byt prazdne - mozna NULL ?!
                }

                //temp = (range.Cells[row, 2] as Excel.Range).Value2;
                temp_pes.ZavodLicence = SetTempFromExcel(range, row, 2);      // excel sloupec zavod-licence-trening

                temp_pes.Jmeno = SetTempFromExcel(range, row, 3);             // excel sloupec jmeno psa

                temp_pes.Plemeno = SetTempFromExcel(range, row, 4);           // excel sloupec plemeno

                temp_pes.Poznamka = SetTempFromExcel(range, row, 5);          // excel sloupec poznamka ZAVODNI SKUPINA !!!!

                temp_pes.Pohlavi = SetTempFromExcel(range, row, 6).ToLower(); // excel sloupec pohlavi

                temp_pes.Platba = SetTempIntFromExcel(range, row, 8);         // excel sloupec platba

                temp_pes.Licence = SetTempFromExcel(range, row, 11);          // excel sloupec licence

                temp = (range.Cells[row, 14] as Excel.Range).Value.ToShortDateString();
                if (temp != null) // excel sloupec datum narozeni
                {
                    temp_pes.Datum = DateTime.ParseExact(temp, Thread.CurrentThread.CurrentCulture.DateTimeFormat.ShortDatePattern, Thread.CurrentThread.CurrentCulture);
                }
                else
                {
                    temp_pes.Datum = DateTime.ParseExact(DateTime.MinValue.ToShortDateString(), Thread.CurrentThread.CurrentCulture.DateTimeFormat.ShortDatePattern, Thread.CurrentThread.CurrentCulture);
                }

                temp_majitel.firstName = SetTempFromExcel(range, row, 15); // excel sloupec jmeno

                temp_majitel.narodnost = SetTempFromExcel(range, row, 17); // excel sloupec národnost

                temp_majitel.telefon = SetTempFromExcel(range, row, 18);   // excel sloupec telefon

                temp_majitel.email = SetTempFromExcel(range, row, 19);     // excel sloupec email

                temp_pes.Doplatit = 0;

                temp_majitel.id        = dataM.GetNewId();                    // přiřzení ID majiteli
                temp_majitel.penize    = temp_pes.Platba + temp_pes.Doplatit; // součet zaplatil a má zaplatit
                temp_majitel.potvrzeni = "--";                                // implicitně nastaven jako nezaplaceno
                temp_majitel.pocet_psu = 1;

                temp_pes.Id             = dataP.GetNewId();
                temp_pes.Majitel        = temp_majitel.id;
                temp_pes.MajitelJmeno   = temp_majitel.firstName;
                temp_pes.Skupina        = 0;
                temp_pes.StartBeh1      = 0;
                temp_pes.StartBeh1      = 0;
                temp_pes.Diskval        = "---";
                temp_pes.AgilityA0      = 0;
                temp_pes.AgilityA1      = 0;
                temp_pes.SpeedA0        = 0;
                temp_pes.SpeedA1        = 0;
                temp_pes.EnduranceA0    = 0;
                temp_pes.EnduranceA1    = 0;
                temp_pes.EnthusiasmA0   = 0;
                temp_pes.EnthusiasmA1   = 0;
                temp_pes.IntelligenceA0 = 0;
                temp_pes.IntelligenceA1 = 0;
                temp_pes.AgilityB0      = 0;
                temp_pes.AgilityB1      = 0;
                temp_pes.SpeedB0        = 0;
                temp_pes.SpeedB1        = 0;
                temp_pes.EnduranceB0    = 0;
                temp_pes.EnduranceB1    = 0;
                temp_pes.EnthusiasmB0   = 0;
                temp_pes.EnthusiasmB1   = 0;
                temp_pes.IntelligenceB0 = 0;
                temp_pes.IntelligenceB1 = 0;
                temp_pes.Body1          = 0;
                temp_pes.Body2          = 0;
                temp_pes.Dvojice0       = 0;
                temp_pes.Dvojice1       = 0;
                temp_pes.Barva0         = "";
                temp_pes.Barva1         = "";

                tmp = dataM.FindSame(temp_majitel.firstName, temp_majitel.lastName, temp_majitel.email);
                if (tmp < 0)
                {
                    dataM.Add(new Majitel(temp_majitel));
                }
                else
                {
                    Majitel editmajitel = dataM.GetMajitelById(tmp);
                    editmajitel.penize += temp_majitel.penize; // přičtení majiteli platbu za dalšího psa
                    editmajitel.pocet_psu++;
                    dataM.Edit(tmp, editmajitel);
                    temp_pes.Majitel = tmp;
                }

                dataP.Add(new Pes(temp_pes));
            }
            workbook.Close(true, Missing.Value, Missing.Value);
            excelApp.Quit();
        }