public bool GuardarAprendizFicha(int Id, int Ficha, string Descrip) { var Datos = (from i in entity.Aprendices_Titulada where i.Id == Id select i).FirstOrDefault(); if (Datos.Ficha == Ficha) { return(false); } else { var Datos2 = (from i in entity.Ficha_VTitulada where i.Id == Datos.Ficha select i).FirstOrDefault(); Novedades objN = new Novedades(); objN.Aprendiz = Id; objN.Ficha = Datos.Ficha; objN.Descripcion = Descrip; objN.Nueva_Ficha = Ficha.ToString(); Datos.Ficha = Ficha; entity.Novedades.Add(objN); entity.SaveChanges(); return(true); } }
private void AsentarPlan() { string cuit = dgv_EmpresaAfectada.CurrentRow.Cells["cuit"].Value.ToString(); if (MessageBox.Show("Esta seguro de Asentar el Plan de Pago? ", "¡¡¡ ATENCION !!!", MessageBoxButtons.YesNo) == DialogResult.Yes) { if (!ExistePlanVigente(cuit, NroDeAsignacion)) { using (var context = new lts_sindicatoDataContext()) { var NroDePlan = context.PlanesDePago.ToList().Count() == 0 ? 1 : context.PlanesDePago.Max(x => x.NroDePlan) + 1; PlanesDePago Insert = new PlanesDePago(); Insert.Fecha = DateTime.Now; Insert.CUIT = dgv_EmpresaAfectada.CurrentRow.Cells["cuit"].Value.ToString(); Insert.NroDeAsignacion = NroDeAsignacion; Insert.NroDePlan = NroDePlan; Insert.Estado = 1; Insert.DeudaInicial = Convert.ToDecimal(txt_DeudaInicial.Text); context.PlanesDePago.InsertOnSubmit(Insert); context.SubmitChanges(); CargarPlanDetalle(dgv_PlanDePagos, NroDePlan); Novedades InsertNovedad = new Novedades(); InsertNovedad.Fecha = DateTime.Now; InsertNovedad.Usuario = UserId; InsertNovedad.NumeroDeAsignacion = NroDeAsignacion; InsertNovedad.CUIT = cuit; if (txt_CantidadDeCuotas.Text == "1") { InsertNovedad.Novedad = "Se Confirma Plan de Pago bajo las siguientes condiciones: " + "Deuda Inical: $" + txt_DeudaInicial.Text + " - Compromiso de pago hasta el dia " + dtp_VencCuota.Value.Date.ToString("dd-MM-yyyy") + " - el importe a abonar es de: $" + txt_DeudaInicial.Text + " - NOTA IMPORTANTE !!! ->>> En caso de NO ABONAR dentro de la fecha pactada" + ", El plan CAERA hasta llegar a un nuevo acuerdo." ; } else { InsertNovedad.Novedad = "Se Confirma Plan de Pago bajo las siguientes condiciones: " + "Deuda Inical: $" + txt_DeudaInicial.Text + " - Anticipo: $" + txt_Anticipo.Text + " - Abonar Anticipo hasta el dia " + dtp_VencAnticipo.Value.Date + " - Una vez Abonado el Anticipo Toma Vigencia el PLan de Pago de " + txt_CantidadDeCuotas.Text + " Cuotas de $" + txt_ImporteDeCuota.Text + " Con vencimiento de la 1ª cuota el dia " + dtp_VencCuota.Value.Date.ToString("dd-MM-yyyy") + " - NOTA IMPORTANTE !!! ->>> En caso NO ABONAR el anticipo dentro de la fecha pactada, El plan CAERA hasta nuevo acuerdo." ; } context.Novedades.InsertOnSubmit(InsertNovedad); context.SubmitChanges(); MostrarNovedades(cuit, NroDeAsignacion); } } else { MessageBox.Show("Ya esiste un plan vigente para esta Empresa !!!!!"); } } }
public void Dispose() { if (Reg1TipoRegistro != null) { Reg1TipoRegistro.Dispose(); } if (Reg2TipoRegistro != null) { Reg2TipoRegistro.Dispose(); } if (Inconsistencias != null) { Inconsistencias.Dispose(); } if (Novedades != null) { Novedades.Dispose(); } if (Reliquidaciones != null) { Reliquidaciones.Dispose(); } if (Nomina != null) { Nomina.Dispose(); } if (Vacaciones != null) { Vacaciones.Dispose(); } if (Liquidacion != null) { Liquidacion.Dispose(); } }
public ActionResult DeleteConfirmed(int id) { Novedades novedades = db.Novedades.Find(id); db.Novedades.Remove(novedades); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "NovedadesID,Codigo_Novedad,Descripcion,Fecha_Realizacion")] Novedades novedades) { if (ModelState.IsValid) { db.Entry(novedades).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(novedades)); }
public ActionResult Create([Bind(Include = "NovedadesID,Codigo_Novedad,Descripcion,Fecha_Realizacion")] Novedades novedades) { if (ModelState.IsValid) { db.Novedades.Add(novedades); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(novedades)); }
public ActionResult Edit(Novedades novedades, string CambioEstado) { if (ModelState.IsValid) { novedades.Estado = CambioEstado; db.Entry(novedades).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Idmensaje = new SelectList(db.Mensajes, "Id", "Asunto", novedades.Idmensaje); ViewBag.CambioEstado = this.CambioEstado(); return(View(novedades)); }
public List <Novedades> Capa_Dato_Get_ListandoDetallesDocumentos(string id_operario, string fecha_ini, string fecha_fin, string contrato) { try { cadenaCnx = System.Configuration.ConfigurationManager.ConnectionStrings["dataSige"].ConnectionString; string rutaServer = ConfigurationManager.AppSettings["servidor-foto-novedades"]; List <Novedades> ListArchivos = new List <Novedades>(); using (SqlConnection cn = new SqlConnection(cadenaCnx)) { cn.Open(); using (SqlCommand cmd = new SqlCommand("SP_S_VISOR_NOVEDADES", cn)) { cmd.CommandTimeout = 0; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@id_operario", SqlDbType.Int).Value = Convert.ToInt32(id_operario); cmd.Parameters.Add("@fecha_ini", SqlDbType.VarChar).Value = fecha_ini; cmd.Parameters.Add("@fecha_fin", SqlDbType.VarChar).Value = fecha_fin; cmd.Parameters.Add("@cuenta_contrato", SqlDbType.VarChar).Value = contrato; DataTable dt_detalle = new DataTable(); using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.Fill(dt_detalle); foreach (DataRow Fila in dt_detalle.Rows) { Novedades obj_entidad = new Novedades(); obj_entidad.checkeado = false; obj_entidad.id_foto = Convert.ToInt32(Fila["id_foto"].ToString()); obj_entidad.id_Operario = Convert.ToInt32(Fila["id_Operario"].ToString()); obj_entidad.desc_operario = Fila["desc_operario"].ToString(); obj_entidad.cuentaContrato = Fila["cuentaContrato"].ToString(); obj_entidad.urlfoto = rutaServer + Fila["urlfoto"].ToString(); obj_entidad.fechaRegistro = Fila["fechaRegistro"].ToString(); obj_entidad.Latitud = Fila["Latitud"].ToString(); obj_entidad.Longitud = Fila["Longitud"].ToString(); ListArchivos.Add(obj_entidad); } } } } return(ListArchivos); } catch (Exception ex) { throw ex; } }
//[ValidateAntiForgeryToken] public ActionResult Details(Novedades support, string CambioEstado) { idusuario = new SUIUsuarios(HttpContext.User.Identity.Name).User_Id; if (ModelState.IsValid) { db.Entry(support).State = EntityState.Modified; support.Estado = CambioEstado; db.SaveChanges(); return(RedirectToAction("Details")); } return(View(support)); }
// GET: Novedades/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Novedades novedades = db.Novedades.Find(id); if (novedades == null) { return(HttpNotFound()); } return(View(novedades)); }
private void LimpiarListas() { if (Novedades != null) { Novedades.Clear(); } if (NovedadesABajar != null) { NovedadesABajar.Clear(); } if (NovedadesBajaError != null) { NovedadesBajaError.Clear(); } }
// GET: Novedades/Details/5 public ActionResult Details(int?id) { ViewBag.CambioEstado = this.CambioEstado(); if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Novedades novedades = db.Novedades.Find(id); if (novedades == null) { return(HttpNotFound()); } return(View(novedades)); }
// GET: Novedades/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Novedades novedades = db.Novedades.Find(id); if (novedades == null) { return(HttpNotFound()); } ViewBag.Idmensaje = new SelectList(db.Mensajes, "Id", "Asunto", novedades.Idmensaje); ViewBag.CambioEstado = this.CambioEstado(); return(View(novedades)); }
private void cargar_novedad() { try { // Cargar en la tabla novedades la generacion del acta //int ultima_acta = db_sindicato.ACTAS.OrderByDescending(x => x.ID_ACTA).First().ID_ACTA; //var ultima_acta = db_sindicato.ACTAS.Where(x => x.ID_ACTA == act_id).Single().ID_ACTA ; // .OrderByDescending(x => x.ID_ACTA).First().ID_ACTA; Novedades nov = new Novedades(); nov.Fecha = DateTime.Now; nov.Id_Acta = act_id; nov.Novedad = "Generacion de Acta"; db_sindicato.Novedades.InsertOnSubmit(nov); db_sindicato.SubmitChanges(); } catch (Exception) { throw; } }
public void InsertarNovedad(string cuit, int NroDeAsignacion, string Novedad, int MensajeAlCobrador, int UserId) { using (var context = new lts_sindicatoDataContext()) { Novedades Insert = new Novedades(); Insert.Acta = 1; Insert.Fecha = DateTime.Now; Insert.Usuario = UserId; Insert.Novedad = Novedad; Insert.CUIT = cuit; Insert.NumeroDeAsignacion = NroDeAsignacion; if (MensajeAlCobrador == 1) { Insert.MensajeAlCobrador = 1; // 1= si tiene Mensaje Insert.EstadoMensajeAlCobrador = 0; // 0 = no esta leido } context.Novedades.InsertOnSubmit(Insert); context.SubmitChanges(); } }
// GET: Novedades public ActionResult Index() { idusuario = new SUIUsuarios(HttpContext.User.Identity.Name).User_Id; var hola = new Novedades(); if (hola.Privado) { var query = db.Novedades.Include(m => m.Mensajes).AsQueryable(); query = query.Where(r => r.User_Id == idusuario && r.Privado); query = query.OrderByDescending(r => r.Fecha); return(View(query.ToList())); } else { var novedades = db.Novedades.Include(n => n.Mensajes); return(View(novedades.ToList())); } }
public bool GuardarAprendizEstado(int Id, string Estado, string Descripcion) { Novedades objN = new Novedades(); var Datos = (from i in entity.Aprendices_Titulada where i.Id == Id select i).FirstOrDefault(); var Datos1 = (from i in entity.Ficha_VTitulada where i.Id == Datos.Ficha select i).FirstOrDefault(); if (Datos1 != null) { objN.Aprendiz = Id; objN.Ficha = Datos.Ficha; objN.Descripcion = Descripcion; objN.Nueva_Ficha = "No Aplica"; entity.Novedades.Add(objN); entity.SaveChanges(); return(true); } else { if (Datos.Estado == Estado) { return(false); } else { var Datos2 = (from i in entity.Novedades where i.Aprendiz == Id select i).First(); Datos.Estado = Estado; Datos2.Descripcion = Descripcion; entity.SaveChanges(); return(true); } } }
public List <Novedades> Capa_Dato_Get_Operarios() { try { cadenaCnx = System.Configuration.ConfigurationManager.ConnectionStrings["dataSige"].ConnectionString; List <Novedades> List_Operario = new List <Novedades>(); using (SqlConnection cn = new SqlConnection(cadenaCnx)) { cn.Open(); using (SqlCommand cmd = new SqlCommand("SP_S_OPERARIO", cn)) { cmd.CommandTimeout = 0; cmd.CommandType = CommandType.StoredProcedure; DataTable dt_detalle = new DataTable(); using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.Fill(dt_detalle); foreach (DataRow Fila in dt_detalle.Rows) { Novedades obj_entidad = new Novedades(); obj_entidad.id_Operario = Convert.ToInt32(Fila["id_Operario"].ToString()); obj_entidad.desc_operario = Fila["desc_operario"].ToString(); List_Operario.Add(obj_entidad); } } } } return(List_Operario); } catch (Exception ex) { throw ex; } }
// [ValidateAntiForgeryToken] public ActionResult Create(Novedades novedades, int?id, int?idproyecto, int?CambioEstado, int?Idmensaje) { if (ModelState.IsValid) { if (id == null) { novedades.Idmensaje = Idmensaje; } else { novedades.Idmensaje = id; } var query = from c in db.Mensajes where c.Id == id select new { c.Idproyecto }; foreach (var c in query) { novedades.Idproyecto = c.Idproyecto; } List <Archivos> fileDetails = new List <Archivos>(); for (int i = 0; i < Request.Files.Count; i++) { var file = Request.Files[i]; if (file != null && file.ContentLength > 0) { var fileName = Path.GetFileName(file.FileName); Archivos fileDetail = new Archivos() { Nombre = DateTime.Now + "_" + fileName, Extension = Path.GetExtension(fileName), Id = Guid.NewGuid(), Fecha = DateTime.Now, Idusuario = new SUIUsuarios(HttpContext.User.Identity.Name).User_Id }; fileDetails.Add(fileDetail); var path = Path.Combine(Server.MapPath("~/Content/Upload/"), fileDetail.Id + fileDetail.Extension); file.SaveAs(path); } } novedades.Fecha = DateTime.Now; novedades.Usuario = new SUIUsuarios(HttpContext.User.Identity.Name).Usuario; novedades.Archivos = fileDetails; novedades.Idestadonovedad = CambioEstado; novedades.User_Id = new SUIUsuarios(HttpContext.User.Identity.Name).User_Id; if (novedades.Privado) { novedades.Privado = true; } else { novedades.Privado = false; } db.Novedades.Add(novedades); db.SaveChanges(); if (id == null) { return(View(novedades)); } else { TempData["success"] = "La novedad que creo se encuentra " + CambioEstado; return(RedirectToAction("Details" + "/" + id, "Mensajes")); } } ViewBag.CambioEstado = this.CambioEstado(); ViewBag.Idmensaje = new SelectList(db.Mensajes, "Id", "Asunto"); return(View(novedades)); }