public async Task <IActionResult> Crear(int?IdPer) { if (IdPer == null) { return(NotFound()); } IT1 it0p = new IT1(); var personal = await _context.Personals .SingleOrDefaultAsync(m => m.Id == IdPer); ViewBag.GpoCiaG = personal.Gbukrs; ViewBag.Nombre = personal.Cname; ViewBag.Bukrs = personal.Bukrs; ViewBag.NoPer = personal.Pernr; var items = new List <SelectListItem>(); items = _bukrs.DaClasedeMedida(personal.Gbukrs, personal.Bukrs); ViewBag.ListaClases = items.ToList(); var esta1 = new List <Estatus_stat2>(); esta1 = _bukrs.GetEstatus1(personal.Bukrs, personal.Gbukrs); ViewBag.ListaEst = esta1.ToList(); var divis = new List <Divis>(); divis = _bukrs.GetDivisions(personal.Bukrs, personal.Gbukrs); ViewBag.ListaDivis = divis.ToList(); ViewBag.ListaNomina = _bukrs.GetNomina(personal.Bukrs, personal.Gbukrs).ToList(); ViewBag.CentroCostos = _bukrs.GetCentrodeCostos(personal.Bukrs, personal.Gbukrs).ToList(); var tipoper = new List <SelectListItem>(); tipoper = _bukrs.GetTipoPersonal(personal.Bukrs, personal.Gbukrs); ViewBag.TipoPers = tipoper.ToList(); var lastIt0 = await _context.IT1s.LastOrDefaultAsync(m => m.PersonalId == IdPer); if (lastIt0 == null) { it0p.BegDa = DateTime.Now; } else { it0p.BegDa = lastIt0.BegDa.AddDays(1); } it0p.Gbukrs = personal.Gbukrs; it0p.Bukrs = personal.Bukrs; string dateInput = "Jan 1, 9999"; DateTime parsedDate = DateTime.Parse(dateInput); it0p.EndDa = parsedDate; var userNa = User.FindFirstValue(ClaimTypes.Name); it0p.Uname = userNa; it0p.Pernr = personal.Pernr; it0p.Aedtm = DateTime.Now; it0p.PersonalId = personal.Id; return(View(it0p)); }
// GET: IT0_1/Create public async Task <IActionResult> Crear(int?IdPer) { if (IdPer == null) { return(NotFound()); } IT16 it0p = new IT16(); var personal = await _context.Personals .SingleOrDefaultAsync(m => m.Id == IdPer); ViewBag.GpoCiaG = personal.Gbukrs; ViewBag.Nombre = personal.Cname; ViewBag.Bukrs = personal.Bukrs; ViewBag.NoPer = personal.Pernr; var items = new List <SelectListItem>(); items = _bukrs.DaClasedeMedida(personal.Gbukrs, personal.Bukrs); ViewBag.ListaClases = items.ToList(); var esta1 = new List <Estatus_stat2>(); esta1 = _bukrs.GetEstatus1(personal.Bukrs, personal.Gbukrs); ViewBag.ListaEst = esta1.ToList(); var lastIt16 = await _context.IT16s.LastOrDefaultAsync(m => m.PersonalId == IdPer); if (lastIt16 == null) { it0p.BegDa = DateTime.Now; } else { it0p.BegDa = lastIt16.BegDa.AddDays(1); } it0p.Gbukrs = personal.Gbukrs; it0p.Bukrs = personal.Bukrs; string dateInput = "Jan 1, 9999"; DateTime parsedDate = DateTime.Parse(dateInput); it0p.EndDa = parsedDate; var userNa = User.FindFirstValue(ClaimTypes.Name); it0p.Uname = userNa; it0p.Pernr = personal.Pernr; it0p.Aedtm = DateTime.Now; it0p.PersonalId = personal.Id; ViewBag.ListofClasedeContrato = _bukrs.GetClasedeContrato(); ViewBag.ListofPerPru = _bukrs.GetPeriodoPrueba(); return(View(it0p)); }
// GET: IT0_1/Create public async Task <IActionResult> Crear(int?IdPer) { if (IdPer == null) { return(NotFound()); } IT2_185_105 it0p = new IT2_185_105(); var personal = await _context.Personals .SingleOrDefaultAsync(m => m.Id == IdPer); ViewBag.GpoCiaG = personal.Gbukrs; ViewBag.Nombre = personal.Cname; ViewBag.Bukrs = personal.Bukrs; ViewBag.ListofRegion1 = _bukrs.GetRegion1(); ViewBag.NoPer = personal.Pernr; ViewBag.ListofClavedeSexo = _bukrs.GetClavedeSexo(); var items = new List <SelectListItem>(); items = _bukrs.DaClasedeMedida(personal.Gbukrs, personal.Bukrs); ViewBag.ListaClases = items.ToList(); var esta1 = new List <Estatus_stat2>(); esta1 = _bukrs.GetEstatus1(personal.Bukrs, personal.Gbukrs); ViewBag.ListaEst = esta1.ToList(); var lastIt0 = await _context.IT2_185_105s.LastOrDefaultAsync(m => m.PersonalId == IdPer); if (lastIt0 == null) { it0p.BegDa = DateTime.Now; } else { it0p.BegDa = lastIt0.BegDa.AddDays(1); it0p.Rfc = lastIt0.Rfc; it0p.Afore = lastIt0.Afore; it0p.Cartilla = lastIt0.Cartilla; it0p.Curp = lastIt0.Curp; it0p.Fm2 = lastIt0.Fm2; it0p.Fm3 = lastIt0.Fm3; it0p.GbDat = lastIt0.GbDat; it0p.Gbdep = lastIt0.Gbdep; it0p.Gblnd = lastIt0.Gblnd; it0p.Gbort = lastIt0.Gbort; it0p.Gesch = lastIt0.Gesch; it0p.Ine = lastIt0.Ine; it0p.Issste = lastIt0.Issste; it0p.Licencia = lastIt0.Licencia; it0p.Natio = lastIt0.Natio; it0p.Pasaporte = lastIt0.Pasaporte; it0p.Subty = lastIt0.Subty; it0p.Titl2 = lastIt0.Titl2; it0p.Title = lastIt0.Title; it0p.Usrid1 = lastIt0.Usrid1; it0p.Usrid2 = lastIt0.Usrid2; it0p.Usrid3 = lastIt0.Usrid3; it0p.Usrid4 = lastIt0.Usrid4; it0p.Usrty1 = lastIt0.Usrty1; it0p.Usrty2 = lastIt0.Usrty2; it0p.Usrty3 = lastIt0.Usrty3; it0p.Usrty4 = lastIt0.Usrty4; } it0p.Gbukrs = personal.Gbukrs; it0p.Bukrs = personal.Bukrs; string dateInput = "Jan 1, 9999"; DateTime parsedDate = DateTime.Parse(dateInput); it0p.EndDa = parsedDate; var userNa = User.FindFirstValue(ClaimTypes.Name); it0p.Uname = userNa; it0p.Pernr = personal.Pernr; it0p.Aedtm = DateTime.Now; it0p.PersonalId = personal.Id; return(View(it0p)); }