Esempio n. 1
0
        public AfisareForm()
        {
            InitializeComponent();
            adminMasini = ManagerMasini.GetAdministratorStocare();

            List <Masina> masini = new List <Masina>(ManagerMasini.getMasiniList());

            File.WriteAllText(@"C:\Users\sebyg\source\repos\ProiectMasiniPIU\ProiectMasiniPIU\MasiniSalvate.txt", String.Empty);

            afisareListBox.Items.Clear();
            var antetTabel = String.Format("{0,-8}{1,-30}{2,-30}{3,-20}{4,-15}{5,-15}{6,-14}{7,-20}{8,-10}\n", "Id", "Nume vanzator", "Nume cumparator", "Data tranzactie", "Firma", "Model", "Culoare", "An fabricatie", "Pret");

            afisareListBox.Items.Add(antetTabel);



            foreach (Masina m in masini)
            {
                int calculId             = -8 - m.getIdMasina().ToString().Length + 1;
                int calculNumeVanzator   = -30 - m.numeVanzator.Length + 10;
                int calculNumeCumparator = -30 - m.numeCumparator.Length + 7;
                int calculData           = -20 - m.dataTranzactie.Length + 6;
                int calculFirma          = -15 - m.firmaProp.Length + 4;
                int calculModel          = -15 - m.modelProp.Length + 3;
                int calculCuloare        = -14 - m.culoareProp.Length + 4;
                int calculAn             = -20 - m.anFabricatie.ToString().Length + 2;
                int calculPret           = -10 - m.pretProp.ToString().Length + 1;

                var mAfisare = String.Format("\n{0," + calculId.ToString() + "}{1," + calculNumeVanzator.ToString() + "}{2," + calculNumeCumparator.ToString() + "}{3," + calculData.ToString() + "}{4," + calculFirma.ToString() + "}{5," + calculModel.ToString() + "}{6," + calculCuloare.ToString() + "}{7," + calculAn.ToString() + "}{8," + calculPret.ToString() + "}\n",
                                             m.getIdMasina().ToString(), m.numeVanzator, m.numeCumparator, m.dataTranzactie, m.firmaProp, m.modelProp, m.culoareProp, m.anFabricatie.ToString(), m.pretProp.ToString());
                afisareListBox.Items.Add(mAfisare);
                adminMasini.AddMasina(m);
            }
        }
Esempio n. 2
0
 public CautareForm()
 {
     InitializeComponent();
     adminMasini = ManagerMasini.GetAdministratorStocare();
 }
Esempio n. 3
0
        public FormularMasina()
        {
            adminMasini = ManagerMasini.GetAdministratorStocare();

            //setare proprietati
            this.Size          = new System.Drawing.Size(400, 400);
            this.StartPosition = FormStartPosition.Manual;
            this.Location      = new System.Drawing.Point(100, 100);
            this.Font          = new Font("Arial", 9, FontStyle.Bold);
            this.ForeColor     = Color.LimeGreen;
            this.Text          = "Situatie student";



            ////////////////////LABELS - START///////////////////////

            firmaLbl       = new Label();
            firmaLbl.Width = LATIME_CONTROL;
            firmaLbl.Text  = "Firma: ";
            this.Controls.Add(firmaLbl);

            firmaTxt       = new TextBox();
            firmaTxt.Width = LATIME_CONTROL;
            firmaTxt.Left  = DIMENSIUNE_PAS_X;
            this.Controls.Add(firmaTxt);

            modelLbl       = new Label();
            modelLbl.Width = LATIME_CONTROL;
            modelLbl.Text  = "Model:";
            modelLbl.Top   = DIMENSIUNE_PAS_Y;
            this.Controls.Add(modelLbl);

            modelTxt          = new TextBox();
            modelTxt.Width    = LATIME_CONTROL;
            modelTxt.Location = new System.Drawing.Point(DIMENSIUNE_PAS_X, DIMENSIUNE_PAS_Y);
            this.Controls.Add(modelTxt);

            culoareLbl       = new Label();
            culoareLbl.Width = LATIME_CONTROL;
            culoareLbl.Text  = "Culoare:";
            culoareLbl.Top   = 2 * DIMENSIUNE_PAS_Y;
            this.Controls.Add(culoareLbl);

            culoareTxt          = new TextBox();
            culoareTxt.Width    = LATIME_CONTROL;
            culoareTxt.Location = new System.Drawing.Point(DIMENSIUNE_PAS_X, 2 * DIMENSIUNE_PAS_Y);
            this.Controls.Add(culoareTxt);

            anFLbl       = new Label();
            anFLbl.Width = LATIME_CONTROL;
            anFLbl.Text  = "An fabricatie:";
            anFLbl.Top   = 3 * DIMENSIUNE_PAS_Y;
            this.Controls.Add(anFLbl);

            anFTxt          = new TextBox();
            anFTxt.Width    = LATIME_CONTROL;
            anFTxt.Location = new System.Drawing.Point(DIMENSIUNE_PAS_X, 3 * DIMENSIUNE_PAS_Y);
            this.Controls.Add(anFTxt);

            numeVanzatorLbl       = new Label();
            numeVanzatorLbl.Width = LATIME_CONTROL;
            numeVanzatorLbl.Text  = "Nume vanzator:";
            numeVanzatorLbl.Top   = 4 * DIMENSIUNE_PAS_Y;
            this.Controls.Add(numeVanzatorLbl);


            //////////////////////////////LABELS - END////////////////////////



            ///////////////////////////TEXTBOX - START//////////////////////

            numeVanzatorTxt          = new TextBox();
            numeVanzatorTxt.Width    = LATIME_CONTROL;
            numeVanzatorTxt.Location = new System.Drawing.Point(DIMENSIUNE_PAS_X, 4 * DIMENSIUNE_PAS_Y);
            this.Controls.Add(numeVanzatorTxt);

            numeCumparatorLbl       = new Label();
            numeCumparatorLbl.Width = LATIME_CONTROL;
            numeCumparatorLbl.Text  = "Nume cumparator:";
            numeCumparatorLbl.Top   = 5 * DIMENSIUNE_PAS_Y;
            this.Controls.Add(numeCumparatorLbl);

            numeCumparatorTxt          = new TextBox();
            numeCumparatorTxt.Width    = LATIME_CONTROL;
            numeCumparatorTxt.Location = new System.Drawing.Point(DIMENSIUNE_PAS_X, 5 * DIMENSIUNE_PAS_Y);
            this.Controls.Add(numeCumparatorTxt);

            dataLbl       = new Label();
            dataLbl.Width = LATIME_CONTROL;
            dataLbl.Text  = "Data tranzactie:";
            dataLbl.Top   = 6 * DIMENSIUNE_PAS_Y;
            this.Controls.Add(dataLbl);

            dataTxt          = new TextBox();
            dataTxt.Width    = LATIME_CONTROL;
            dataTxt.Location = new System.Drawing.Point(DIMENSIUNE_PAS_X, 6 * DIMENSIUNE_PAS_Y);
            this.Controls.Add(dataTxt);

            pretLbl       = new Label();
            pretLbl.Width = LATIME_CONTROL;
            pretLbl.Text  = "Pret:";
            pretLbl.Top   = 7 * DIMENSIUNE_PAS_Y;
            this.Controls.Add(pretLbl);

            pretTxt          = new TextBox();
            pretTxt.Width    = LATIME_CONTROL;
            pretTxt.Location = new System.Drawing.Point(DIMENSIUNE_PAS_X, 7 * DIMENSIUNE_PAS_Y);
            this.Controls.Add(pretTxt);


            //////////////////////////TEXTBOX - END//////////////////////////


            optiuniLbl       = new Label();
            optiuniLbl.Width = LATIME_CONTROL;
            optiuniLbl.Text  = "Optiuni:";
            optiuniLbl.Top   = 8 * DIMENSIUNE_PAS_Y;
            this.Controls.Add(optiuniLbl);

            optiuniTxt          = new TextBox();
            optiuniTxt.Width    = LATIME_CONTROL;
            optiuniTxt.Location = new System.Drawing.Point(DIMENSIUNE_PAS_X, 8 * DIMENSIUNE_PAS_Y);
            this.Controls.Add(optiuniTxt);



            //adaugare control de tip Button pentru adaugarea unui obiect
            adaugaBtn          = new Button();
            adaugaBtn.Width    = LATIME_CONTROL;
            adaugaBtn.Location = new System.Drawing.Point(DIMENSIUNE_PAS_X, 9 * DIMENSIUNE_PAS_Y);
            adaugaBtn.Text     = "Adauga";
            adaugaBtn.Click   += OnButtonClicked;
            this.Controls.Add(adaugaBtn);

            //adaugare control de tip Label pentru afisarea obiectului adaugat
            afisareLbl           = new Label();
            afisareLbl.Width     = 2 * LATIME_CONTROL;
            afisareLbl.Height    = 50;
            afisareLbl.Location  = new System.Drawing.Point(40, 10 * DIMENSIUNE_PAS_Y);
            afisareLbl.BackColor = Color.LightYellow;
            afisareLbl.TextAlign = ContentAlignment.MiddleCenter;
            this.Controls.Add(afisareLbl);

            this.FormClosed += OnFormClosed;
        }
Esempio n. 4
0
        public ModificareForm(Masina mas, int nrC)
        {
            InitializeComponent();

            adminMasini = ManagerMasini.GetAdministratorStocare();

            id = mas.getIdMasina();
            nr = nrC;

            idLabel.Text = id.ToString();

            firmaTxt.Text = mas.firmaProp;
            modelTxt.Text = mas.modelProp;
            anFTxt.Text   = mas.anFabricatie.ToString();


            if (mas.culoareProp == "alb")
            {
                albRdb.Checked = true;
            }
            else
            if (mas.culoareProp == "albastru")
            {
                albastruRdb.Checked = true;
            }
            else
            if (mas.culoareProp == "mov")
            {
                movRdb.Checked = true;
            }
            else
            if (mas.culoareProp == "galben")
            {
                galbenRdb.Checked = true;
            }
            else
            if (mas.culoareProp == "portocaliu")
            {
                portocaliuRdb.Checked = true;
            }
            else
            if (mas.culoareProp == "rosu")
            {
                rosuRdb.Checked = true;
            }
            else
            if (mas.culoareProp == "verde")
            {
                verdeRdb.Checked = true;
            }
            else
            if (mas.culoareProp == "maro")
            {
                maroRdb.Checked = true;
            }
            else
            if (mas.culoareProp == "negru")
            {
                negruRdb.Checked = true;
            }
            numeVanzatorTxt.Text   = mas.numeVanzator;
            numeCumparatorTxt.Text = mas.numeCumparator;
            dataTxt.Text           = mas.dataTranzactie;
            pretTxt.Text           = mas.pretProp.ToString();
            //tipCmbBox.Text = mas.tipMasina;


            foreach (var culoare in culoareGrpBox.Controls)
            {
                if (culoare is RadioButton)
                {
                    var culoareBox = culoare as RadioButton;
                    if (culoareBox.Text == mas.culoareProp.ToString())
                    {
                        culoareBox.Checked = true;
                    }
                }
            }

            tipCmbBox.Text = mas.tipMasina.ToString();

            identificareOptiuni(mas);
        }