Ejemplo n.º 1
0
        public IHttpActionResult GetIncasari(int id)
        {
            Incasari incasari = db.Incasaris.Find(id);

            if (incasari == null)
            {
                return(NotFound());
            }

            return(Ok(incasari));
        }
Ejemplo n.º 2
0
        public void Test_module_externe2()
        {
            //Arrange
            var mock_audit    = new Mock <IAudit>();
            var Audit         = new Audit_noapte();
            var mock_incasari = new Mock <IIncasari>();
            var incasari      = new Incasari();
            var rap           = new Raport();

            bool  ok  = false;
            float res = 0;

            mock_audit.Setup(_ => _.Completare_raport(model_client, p, v)).Returns(true);
            mock_incasari.Setup(_ => _.Calcul_pret(15, "Lux", v)).Returns(15 * 15);

            //Act
            ok  = Audit.Completare_raport(model_client, p, v);
            res = incasari.Calcul_pret(15, "Lux", v);
            rap.Report(mock_audit.Object, mock_incasari.Object, p, v, model_client, 15, "Lux");

            //Assert
            mock_audit.Verify(_ => _.Completare_raport(model_client, p, v), Times.Once());
            mock_incasari.Verify(_ => _.Calcul_pret(15, "Lux", v), Times.Once());
        }
Ejemplo n.º 3
0
        private void loadDatas(DataRow row)
        {
            DataTable dt = new DataTable();
            try
            {
                dt = DAL.getInstance().select("Select * FROM Programe WHERE Status=1");
                if (dt != null)
                {
                    Console.WriteLine("Not null");
                    foreach (DataRow key in dt.Rows)
                    {
                        Console.WriteLine(key);
                        comboProgram.Items.Add(key["Denumire"] as string);
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            try
            {

                txtNumar.Text = row["NrMatricol"] as string;
                txtNume.Text = row["Nume"] as string;
                txtPrenume.Text = row["Prenume"] as string;
                txtTata.Text = row["Tata"] as string;
                txtMama.Text = row["Mama"] as string;
                txtCNP.Text = row["CNP"] as string;
                Console.WriteLine("nasteri" + (string)row["DataNasterii"]);
                txtDataNasterii.SelectedDate = DateTime.Parse((string) row["DataNasterii"]);
                txtLoculN.Text = row["LoculNasterii"] as string;
                txtStrada.Text = row["Strada"] as string;
                txtNr.Text = row["Nr"] as string;
                txtBloc.Text = row["Bloc"] as string;
                txtScara.Text = row["Scara"] as string;
                txtAp.Text = row["Ap"] as string;
                txtLocalitatea.Text = row["Localitate"] as string;
                txtJudet.Text = row["Judet"] as string;
                txtCP.Text = row["Cp"] as string;
                txtTelefon.Text = row["Telefon"] as string;
                txtStudii.Text = row["Studii"] as string;
                txtProfesia.Text = row["Profesia"] as string;
                txtLocMunca.Text = row["LocMunca"] as string;

                DataRow rowP = null;
                DataTable Program = DAL.getInstance().select("SELECT * FROM ProgramCandidat WHERE IdCandidat=" + id);
                if (Program.Rows.Count > 0 && Program.Rows != null)
                {

                    rowP = Program.Rows[0];
                    idc = Convert.ToInt32(rowP["IdCandidat"] as string);
                    Console.WriteLine("Here {0}, {1}", idc, rowP["IdCandidat"] as string);
                    datePregatireS.SelectedDate = DateTime.Parse((string)rowP["PpregDin"]);
                    datePregatireE.SelectedDate = DateTime.Parse((string)rowP["PpregPana"]);
                    dateTeoreticaS.SelectedDate = DateTime.Parse((string)rowP["PteorDin"]);
                    dateTeoreticaE.SelectedDate = DateTime.Parse((string)rowP["PteorPana"]);
                    datePracticaS.SelectedDate = DateTime.Parse((string)rowP["PpracDin"]);
                    datePracticaE.SelectedDate = DateTime.Parse((string)rowP["PpracPana"]);
                    dateAbsolvire.SelectedDate = DateTime.Parse((string)rowP["Absolvire"]);
                    txtMediaGenerala.Text = rowP["Media"] as string;
                    txtCalificativ.Text = rowP["Calificativ"] as string;
                    comboProgram.SelectedItem = rowP["Program"] as string;
                }

                list = new List<Incasari>();
                DataTable dtIncasari = DAL.getInstance().select("SELECT * FROM Incasari WHERE IdCandidat=" + id);
                if (dtIncasari.Rows.Count > 0 && dtIncasari.Rows != null)
                {
                    foreach (DataRow rowI in dtIncasari.Rows)
                    {
                        Incasari inc = new Incasari();
                        inc.Data = rowI["Data"] as string;
                        inc.Valoare = rowI["Valoare"] as string + " RON";
                        list.Add(inc);
                    }
                    listIncasari.ItemsSource = list;
                }

                DataRow rowC = null;
                DataTable Certificat = DAL.getInstance().select("SELECT * FROM Certificat WHERE IdCandidat=" + id);
                if (Certificat.Rows.Count > 0 && Certificat.Rows != null)
                {
                    idce = 1;
                    rowC = Certificat.Rows[0];
                    txtNrOrdine.Text = rowC["NrOrdine"] as string;
                    txtSerie.Text = rowC["Serie"] as string;
                    txtNumarCert.Text = rowC["Numar"] as string;
                    dateEliberare.SelectedDate = DateTime.Parse((string)rowC["DataEliberarii"]);
                    txtObservatii.Text = rowC["Observatii"] as string;

                }

            }
            catch (Exception ex)
            {
                MessageBox.Show("Eroare candidat!\n "+ ex.Message);
            }
        }
Ejemplo n.º 4
0
        private void btnAdauga_Click(object sender, RoutedEventArgs e)
        {
            string query = null;

            query = "INSERT INTO Incasari (" +
                "Data, Valoare, IdCandidat) VALUES ('" +
                dateIncasare.SelectedDate.Value.ToShortDateString() + "','" +
                txtValoare.Text + "', " +
                id + ")";
            if (DAL.getInstance().InsertUpdate(query) == "Success")
            {
                if (contextMain == null) return;
                Incasari inc = new Incasari();
                inc.Data = dateIncasare.SelectedDate.Value.ToShortDateString();
                inc.Valoare = txtValoare.Text;
                list.Add(inc);
                listIncasari.ItemsSource = null;
                listIncasari.ItemsSource = list;
            }
            else
            {
                labelError.Content = "Erroare la inserarea datelor in baza de date";
            }
        }