Exemplo n.º 1
0
        internal Pasport GetResult()
        {
            int pspId = QM.Nextval(connection, "n_pasport_seq");

            QM.DML(connection, "insert into pasport(pasport_id,nc,npart,nplav,bsh_id, vid_proizv_id,date_zap) values (:0,:1,:2,:3,:4, :5, sysdate)", new object[] { pspId, Nc, NPart, NPlav, BshId, VidProizvId });
            QM.DML(connection, "insert into n_pasport(n_pasport_id,pasport_id) values (:0,:0)", new object[] { pspId });

            if (ShifrId != 0)
            {
                QM.DML(connection, "insert into n_pasport_shifr(n_pasport_id,uslov_shifr_id) values (:0,:1)", new object[] { pspId, ShifrId });
            }



            var psp = new Pasport(connection, pspId);

            for (var i = 0; i < ZagotCount; i++)
            {
                psp.AddZagot($"T{i}");
            }

            psp.LinkTek(TekId);
            psp.GenerateOpers();

            psp.Document.TransTo("22P_EL_PASP");
            psp.Document.Denorm();



            return(psp);
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,RegistationDate,Skill")] Pasport pasport)
        {
            if (id != pasport.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(pasport);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PasportExists(pasport.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(pasport));
        }
        public async Task <IActionResult> Create([Bind("Id,RegistationDate,Skill")] Pasport pasport)
        {
            if (ModelState.IsValid)
            {
                _context.Add(pasport);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(pasport));
        }
Exemplo n.º 4
0
        private void Insertbtn_Click(object sender, EventArgs e)
        {
            string connStr = "server=localhost;user=root;database=birjha_truda;";
            // создаём объект для подключения к БД
            MySqlConnection connection = new MySqlConnection(connStr);

            connection.Open();
            string sql = "INSERT INTO `soiskateli`(`id_users`, `Last_name`, `Name`, `Father_name`, `Pol`, `Age`, `Pasport`, `Info`) VALUES " +
                         "(NULL, '" + Fam.Text + "','" + Ima.Text + "','" + Otch.Text + "','" + Pol.Text
                         + "','" + Age.Text + "','" + Pasport.Text + "','" + Inf.Text + "');";
            MySqlCommand command = new MySqlCommand(sql, connection);

            command.ExecuteNonQuery();
            connection.Close();
            Ima.Clear();
            Fam.Clear();
            Otch.Clear();
            Pol.Clear();
            Pasport.Clear();
            Age.Clear();
            Inf.Clear();
        }
Exemplo n.º 5
0
 protected override void Seed(MyDbContext db)
 {
     using (var ctx = new MyDbContext())
     {
         var repo  = new Repository(ctx);
         var comp1 = new Company {
         };
         var comp2 = new Company {
         };
         repo.Insert(comp1);
         repo.Insert(comp2);
         var pasp1 = new Pasport {
             Type = "RU", Number = "456"
         };
         var pasp2 = new Pasport {
             Type = "ENG", Number = "987"
         };
         var pasp3 = new Pasport {
             Type = "RU", Number = "123"
         };
         repo.Insert(pasp1);
         repo.Insert(pasp2);
         repo.Insert(pasp3);
         var empl1 = new Employee {
             Name = "Роналду", Surname = "Иванов", Phone = "987456321", Pasport = pasp1, Company = comp1
         };
         var empl2 = new Employee {
             Name = "Petia", Surname = "Tarashkevich", Phone = "9876544896", Pasport = pasp2, Company = comp1
         };
         var empl3 = new Employee {
             Name = "Zina", Surname = "Kuzina", Phone = "34521564562", Pasport = pasp3, Company = comp2
         };
         repo.Insert(empl1);
         repo.Insert(empl2);
         repo.Insert(empl3);
         repo.SaveChanges();
     }
 }