public static int CopiarPlan(string PLAN_Interno, string PLAN_Descripcion) { PlanTrabajo Plan = new PlanTrabajo(int.Parse(PLAN_Interno)); ControlPlan ControlPlan = new ControlPlan(); return(ControlPlan.CopiarPlan(Plan, PLAN_Descripcion, 1)); }
public int InsertarPlan(PlanTrabajo PlanTrabajo, int?AUDI_UsuarioCrea, int?AUDI_UsuarioEdita) { PlanTrabajoDAO DataPlanTrabajo = new PlanTrabajoDAO(); int PLAN_Interno = DataPlanTrabajo.InsertarPlanTrabajo(PlanTrabajo, AUDI_UsuarioCrea, AUDI_UsuarioEdita); PartePlanDAO PartePlanDAO = new PartePlanDAO(); PartePlan PartePlan = new PartePlan(); int ResultadoParte = 0; if (AUDI_UsuarioCrea == null) { PartePlan.PART_Interno = this.ObtenerParteOrigenPLan(PLAN_Interno); PartePlan.PART_Nombre = PlanTrabajo.PLAN_Descripcion; PartePlan.PART_Origen = null; PartePlan.PLAN_Interno = PLAN_Interno; ResultadoParte = PartePlanDAO.InsertarPartePlan(PartePlan, null, AUDI_UsuarioEdita); } else { PartePlan.PART_Interno = null; PartePlan.PART_Nombre = PlanTrabajo.PLAN_Descripcion; PartePlan.PART_Origen = null; PartePlan.PLAN_Interno = PLAN_Interno; ResultadoParte = PartePlanDAO.InsertarPartePlan(PartePlan, AUDI_UsuarioCrea, null); } if (ResultadoParte > 0) { return(PLAN_Interno); } else { return(0); } }
/// <summary> /// Fabián Quirós Masís /// 03/10/2018 /// Efecto: devuelve el plan de trabajo asociado a un funcionario /// Requiere: idFuncionario /// Modifica: - /// Devuelve: Plan de Trabajo /// </summary> /// <returns> PlanTrabajo </returns> public PlanTrabajo getPlanTrabajo(int idFuncionario) { PlanTrabajo planTrabajo = new PlanTrabajo(); SqlConnection sqlConnection = conexion.conexionTeletrabajo(); String consulta = @"SELECT id_plan,fecha_inicio,feacha_fin,aprobacion_jefe FROM dbo.PlanTrabajo WHERE id_funcionario = @id_funcionario and activo = @activo"; SqlCommand sqlCommand = new SqlCommand(consulta, sqlConnection); sqlCommand.Parameters.AddWithValue("@id_funcionario", idFuncionario); sqlCommand.Parameters.AddWithValue("@activo", true); SqlDataReader reader; sqlConnection.Open(); reader = sqlCommand.ExecuteReader(); while (reader.Read()) { planTrabajo.idPlan = Convert.ToInt16(reader["id_plan"].ToString()); planTrabajo.fechaInicio = Convert.ToDateTime(reader["fecha_inicio"].ToString()); planTrabajo.fechaFin = Convert.ToDateTime(reader["feacha_fin"].ToString()); planTrabajo.aprobacionJefe = Convert.ToBoolean(reader["aprobacion_jefe"].ToString()); } sqlConnection.Close(); return(planTrabajo); }
// POST: api/PlanTrabajo public PlanTrabajo Post([FromBody] PlanTrabajo value) { //var path = Path.Combine(HttpContext.Current.Server.MapPath("foede"), "name"); PlanTrabajoService servicio = new PlanTrabajoService(cadenaConexion); return(servicio.guardarPlanTrabajo(value)); }
public HttpResponseMessage AssingDatesWorkPlan(AssingDatesWorkPlanModel guiam) { PlanTrabajo planTrabajo = new PlanTrabajo(); try { if (guiam.IdPlanTrabajo != 0) { planTrabajo = db.PlanTrabajo.Where(x => x.IdPlanTrabajo == guiam.IdPlanTrabajo).FirstOrDefault(); planTrabajo.FechaPlanFin = guiam.FechaFin; planTrabajo.FechaPlanInicio = guiam.Fechainicio; planTrabajo.Comienza = guiam.Comienza; db.SaveChanges(); return(new HttpResponseMessage(System.Net.HttpStatusCode.OK) { Content = null }); } else { return new HttpResponseMessage(System.Net.HttpStatusCode.NoContent) { Content = null } }; } catch (Exception ex) { return(Request.CreateResponse <string>(HttpStatusCode.InternalServerError, ex.Message + Environment.NewLine + "PlanTrabajo")); } }
public List <PlanTrabajo> ObtenerPlanesP(int TamanioPagina, int NumeroPagina) { //System.Windows.Forms.MessageBox.Show("hola"); List <PlanTrabajo> planes = new List <PlanTrabajo>(); List <DbParameter> parametros = new List <DbParameter>(); DbParameter param = dpf.CreateParameter(); param.Value = TamanioPagina; param.ParameterName = "TamanioPagina"; parametros.Add(param); DbParameter param1 = dpf.CreateParameter(); param1.Value = NumeroPagina; param1.ParameterName = "NumeroPagina"; parametros.Add(param1); string StoredProcedure = "PA_ObtenerPlanesP"; //System.Windows.Forms.MessageBox.Show(TamanioPagina.ToString()+' '+NumeroPagina.ToString()); try { if (Connection.State == System.Data.ConnectionState.Closed) { Connection.Open(); } DbDataReader dr = EjecuteReader(StoredProcedure, parametros); while (dr.Read()) { PlanTrabajo plan = null; try { plan = new PlanTrabajo(); plan.PLAN_Interno = (int)dr["PLAN_Interno"]; plan.PLAN_Descripcion = (string)(dr["PLAN_Descripcion"]); plan.PLAN_Regimen = (string)(dr["PLAN_Regimen"]); plan.PLAN_UnidadLecturas = dr["PLAN_UnidadLecturas"] == System.DBNull.Value ? null : (string)(dr["PLAN_UnidadLecturas"]); } catch (Exception ex) { throw new Exception("Error convirtiendo datos de plan a Objecto", ex); } planes.Add(plan); } } catch (Exception ex) { throw new Exception("Error al obtener la lista de planes", ex); } finally { if (Connection.State == System.Data.ConnectionState.Open) { Connection.Close(); } } return(planes); }
protected string ObtenerNombrePlan() { ControlPlan Plan = new ControlPlan(); PlanTrabajo ObjPlan = new PlanTrabajo(Interno); ObjPlan = Plan.ObtenerPlanPorId(ObjPlan); return(ObjPlan.PLAN_Descripcion); }
public ActionResult DeleteConfirmed(int id) { PlanTrabajo planTrabajo = db.PlanTrabajo.Find(id); db.PlanTrabajo.Remove(planTrabajo); db.SaveChanges(); return(RedirectToAction("Index")); }
public static int InsertarMantenimientoInicial(string PLAN_Interno) { ControlPlan ControlPlan = new ControlPlan(); PlanTrabajo Plan = new PlanTrabajo(int.Parse(PLAN_Interno)); var opcItem = false; if (opc == "equi") { opcItem = true; } return(ControlPlan.InsertarMantenimientoInicial(Plan, items, opcItem, 1)); }
public ActionResult Edit([Bind(Include = "IdPlanTrabajo,IdObra,IdEmpresaConstructora,plazoOriginal,FechaInicio,FechaFinalizacion,montoContrato,estado")] PlanTrabajo planTrabajo) { if (ModelState.IsValid) { db.Entry(planTrabajo).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index", new { id = planTrabajo.IdObra })); } ViewBag.IdEmpresaConstructora = new SelectList(db.EmpresaConstructora, "IdEmpConstructora", "EmpresaConstructora1", planTrabajo.IdEmpresaConstructora); ViewBag.IdObra = new SelectList(db.Obra, "IdObra", "expMatriz", planTrabajo.IdObra); return(View(planTrabajo)); }
public HttpResponseMessage GenerateWorkPlan(IdModelPlanTrabajo guiam) { try { OrdenTrabajo ordenTrabajo = new OrdenTrabajo(); List <DetalleOrdenTrabajo> detalleOrdenTrabajos = new List <DetalleOrdenTrabajo>(); if (guiam.IdOrdenTrabajo != 0) { ordenTrabajo = db.OrdenTrabajo.Where(x => x.IdOrdenTrabajo == guiam.IdOrdenTrabajo).FirstOrDefault(); if (ordenTrabajo != null) { detalleOrdenTrabajos = db.DetalleOrdenTrabajo.Where(x => x.IdOrdenTrabajo == ordenTrabajo.IdOrdenTrabajo).ToList(); } else { throw new Exception("No existe Orden Trabajo"); } } else { throw new Exception("Datos Requeridos no enviados"); } PlanTrabajo planTrabajo = new PlanTrabajo(); foreach (DetalleOrdenTrabajo detalle in detalleOrdenTrabajos) { planTrabajo.IdOrdenTrabajo = detalle.IdOrdenTrabajo; planTrabajo.IdDetalleOrdenTrabajo = detalle.IdDetalleOrdenTrabajo; planTrabajo.IdArea = ordenTrabajo.IdArea; planTrabajo.TipoServicio = detalle.TipoServicio; planTrabajo.Actividad = detalle.Actividad; planTrabajo.Tiempo = detalle.Tiempo; planTrabajo.FechaPlanInicio = DateTime.Now; planTrabajo.FechaPlanFin = DateTime.Now; planTrabajo.Comienza = TimeSpan.FromHours(0); db.PlanTrabajo.Add(planTrabajo); db.SaveChangesAsync(); ordenTrabajo.Planeada = true; db.SaveChangesAsync(); } return(new HttpResponseMessage(System.Net.HttpStatusCode.OK) { Content = null }); } catch (Exception ex) { return(Request.CreateResponse <string>(HttpStatusCode.InternalServerError, ex.Message + Environment.NewLine + "PlanTrabajo")); } }
public JsonResult GuardarPlanTrabajo(PlanTrabajo plan) //si { //mandar datos a master page UserSessionWeb objLogin = (UserSessionWeb)Session["UsuarioSession"]; plan.folio_dominio = objLogin.folioAgencia; //PlanTrabajo miAgrupador = new PlanTrabajo(); //miAgrupador.clv_agrupador_empleado = 02; HttpResponseMessage response = GlobalVariables.WebApiClient.PostAsJsonAsync("PlanTrabajo", plan).Result; return(Json(response.Content.ReadAsAsync <PlanTrabajo>().Result, JsonRequestBehavior.AllowGet)); }
public JsonResult ObtenerListaPlanes(string filtrogenero) //si { //string condicion="mistickets"; PlanTrabajo lstPlanes = new PlanTrabajo(); UserSessionWeb objLogin = (UserSessionWeb)Session["UsuarioSession"]; lstPlanes.folio_dominio = objLogin.agencia; HttpResponseMessage response = GlobalVariables.WebApiClient.PostAsJsonAsync("MisPlanes", lstPlanes).Result; return(Json(new { data = response.Content.ReadAsAsync <List <PlanTrabajo> >().Result }, JsonRequestBehavior.AllowGet)); }
// GET: PlanTrabajo/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PlanTrabajo planTrabajo = db.PlanTrabajo.Find(id); if (planTrabajo == null) { return(HttpNotFound()); } return(View(planTrabajo)); }
public List <ActividadR> ObtenerActividadesPlan(PlanTrabajo PlanTrabajo) { List <ActividadR> Actividades = new List <ActividadR>(); string StoredProcedure = "PA_ObtenerActividadesPlan"; List <DbParameter> parametros = new List <DbParameter>(); DbParameter param = dpf.CreateParameter(); param.Value = PlanTrabajo.PLAN_Interno; param.ParameterName = "PLAN_Interno"; parametros.Add(param); try { if (Connection.State == System.Data.ConnectionState.Closed) { Connection.Open(); } DbDataReader dr = EjecuteReader(StoredProcedure, parametros); while (dr.Read()) { ActividadR Actividad = null; try { Actividad = new ActividadR(); Actividad.ACRU_Interno = (int)dr["ACRU_Interno"]; Actividad.ACRU_Frecuencia = (int)dr["ACRU_Frecuencia"]; Actividad.ACRU_UnidadFrecuencia = (string)dr["ACRU_UnidadFrecuencia"]; } catch (Exception ex) { throw new Exception("Error convirtiendo datos de Actividades de Plan", ex); } Actividades.Add(Actividad); } } catch (Exception ex) { throw new Exception("Error al obtener Actividades de Plan", ex); } finally { if (Connection.State == System.Data.ConnectionState.Open) { Connection.Close(); } } return(Actividades); }
// GET: PlanTrabajo/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PlanTrabajo planTrabajo = db.PlanTrabajo.Find(id); if (planTrabajo == null) { return(HttpNotFound()); } ViewBag.IdEmpresaConstructora = new SelectList(db.EmpresaConstructora, "IdEmpConstructora", "EmpresaConstructora1", planTrabajo.IdEmpresaConstructora); ViewBag.IdObra = new SelectList(db.Obra.Where(o => o.IdObra == planTrabajo.IdObra), "IdObra", "expMatriz"); return(View(planTrabajo)); }
public PlanTrabajo ObtenerPlanTrabajoPorId(PlanTrabajo objPlanTrabajo) { PlanTrabajo PlanTrabajo = null; string StoredProcedure = "PA_ObtenerPlanTrabajoPorId"; List <DbParameter> parametros = new List <DbParameter>(); DbParameter param = dpf.CreateParameter(); param.Value = objPlanTrabajo.PLAN_Interno; param.ParameterName = "PLAN_Interno"; parametros.Add(param); try { if (Connection.State == System.Data.ConnectionState.Closed) { Connection.Open(); } DbDataReader dr = EjecuteReader(StoredProcedure, parametros); if (dr.Read()) { try { PlanTrabajo = new PlanTrabajo(); PlanTrabajo.PLAN_Interno = (int)dr["PLAN_Interno"]; PlanTrabajo.PLAN_Descripcion = (string)dr["PLAN_Descripcion"]; PlanTrabajo.PLAN_Regimen = (string)dr["PLAN_Regimen"]; PlanTrabajo.PLAN_UnidadLecturas = dr["PLAN_UnidadLecturas"] == System.DBNull.Value ? null : (string)(dr["PLAN_UnidadLecturas"]); } catch (Exception ex) { throw new Exception("Error convirtiendo datos de Plan a Objecto", ex); } } } catch (Exception ex) { throw new Exception("Error al obtener Plan", ex); } finally { if (Connection.State == System.Data.ConnectionState.Open) { Connection.Close(); } } return(PlanTrabajo); }
public static int EliminarPlanes(string IDs) { int resultado = 0; string[] IDEquipos = IDs.Split('|'); ControlPlan CtrlPlan = new ControlPlan(); foreach (string ID in IDEquipos) { PlanTrabajo PlanTrabajo = new PlanTrabajo(int.Parse(ID)); if (CtrlPlan.EliminarPlan(PlanTrabajo, 1) > 0) { resultado++; } } return(resultado); }
// GET: PlanTrabajo/Details/5 public ActionResult Details(int?id) { var plan = db.PlanTrabajoDetalle.Where(x => x.IdPlanTrabajo == id).OrderBy(x => x.numeroPeriodo); // var filteredData = db.Products.Local //.Where(x => x.Name.Contains(this.FilterTextBox.Text)); // this.productBindingSource.DataSource = filteredData; DataTable datosgrafico = new DataTable(); datosgrafico.Columns.Add(new DataColumn("Fecha", typeof(string))); datosgrafico.Columns.Add(new DataColumn("Porcentaje Real", typeof(string))); datosgrafico.Columns.Add(new DataColumn("Porcentaje Presupuestado", typeof(string))); foreach (PlanTrabajoDetalle elemento in plan.ToList()) { datosgrafico.Rows.Add(new Object[] { elemento.FechaAvance.ToString("MM/yyyy"), elemento.porcentajeReal.ToString(), elemento.porcentajePrevisto.ToString() }); } string stringDatos = "[[" + "`Fecha`," + "`Porcentaje Real`," + "`Porcentaje Presupuestado`]"; foreach (DataRow fila in datosgrafico.Rows) { stringDatos = stringDatos + ",["; stringDatos = stringDatos + "`" + fila[0] + "`" + "," + fila[1].ToString().Replace(",", ".") + "," + fila[2].ToString().Replace(",", "."); stringDatos = stringDatos + "]"; } stringDatos = stringDatos + "]"; ViewBag.datosCharts = stringDatos; ViewBag.idobra = id; ViewBag.Plandetalle = plan.ToList(); //return View(plan.ToList() if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PlanTrabajo planTrabajo = db.PlanTrabajo.Find(id); if (planTrabajo == null) { return(HttpNotFound()); } return(View(planTrabajo)); }
public bool Add(string proyectoId) { try { var proyecto = _context.Proyecto .Single(p => p.CodigoProyecto == proyectoId); var plan = new PlanTrabajo(DateTime.Now); proyecto.PlanTrabajo = plan; plan.Proyecto = proyecto; _context.PlanTrabajo.Add(plan); _context.SaveChanges(); return(true); } catch (Exception e) { Console.WriteLine(e); return(false); } }
/// <summary> /// Fabián Quirós Masís /// 03/10/2018 /// Efecto: devuelve el plan de trabajo asociado a un funcionario /// Requiere: idFuncionario /// Modifica: - /// Devuelve: Plan de Trabajo /// </summary> /// <returns> PlanTrabajo </returns> public void eliminarPlanTrabajo(PlanTrabajo planTrabajo, Funcionario funcionario) { SqlConnection sqlConnection = conexion.conexionTeletrabajo(); String consulta = @"UPDATE dbo.PlanTrabajo SET activo = @activo WHERE id_funcionario = @id_funcionario"; SqlCommand sqlCommand = new SqlCommand(consulta, sqlConnection); sqlCommand.Parameters.AddWithValue("@id_funcionario", funcionario.idFuncionario); sqlCommand.Parameters.AddWithValue("@activo", true); sqlConnection.Open(); sqlCommand.ExecuteReader(); sqlConnection.Close(); bitacora.insertarBitacoraAccion("Eliminar", "PlanTrabajo", planTrabajo.idPlan, 0, funcionario.nombreCompleto); }
public List <PlanTrabajo> ObtenerPlanesTrabajo() { List <PlanTrabajo> PlanesTrabajo = new List <PlanTrabajo>(); string StoredProcedure = "PA_ObtenerPlanesTrabajo"; try { if (Connection.State == System.Data.ConnectionState.Closed) { Connection.Open(); } DbDataReader dr = EjecuteReader(StoredProcedure, null); while (dr.Read()) { PlanTrabajo PlanTrabajo = null; try { PlanTrabajo = new PlanTrabajo(); PlanTrabajo.PLAN_Interno = (int)dr["PLAN_Interno"]; PlanTrabajo.PLAN_Descripcion = (string)dr["PLAN_Descripcion"]; PlanTrabajo.PLAN_Regimen = (string)dr["PLAN_Regimen"]; PlanTrabajo.PLAN_UnidadLecturas = dr["PLAN_UnidadLecturas"] == System.DBNull.Value ? null : (string)(dr["PLAN_UnidadLecturas"]); } catch (Exception ex) { throw new Exception("Error convirtiendo datos de Plan de Trabajo a Objecto", ex); } PlanesTrabajo.Add(PlanTrabajo); } } catch (Exception ex) { throw new Exception("Error al obtener Planes", ex); } finally { if (Connection.State == System.Data.ConnectionState.Open) { Connection.Close(); } } return(PlanesTrabajo); }
public HttpResponseMessage DeleteHeader(IdModelPlanTrabajo id) { PlanTrabajo planTrabajo = new PlanTrabajo(); DetallePlanTrabajoTrabajador detaplanTrabajo = new DetallePlanTrabajoTrabajador(); try { if (id.IdPlanTrabajo != 0) { planTrabajo = db.PlanTrabajo.Where(x => x.IdPlanTrabajo == id.IdPlanTrabajo).FirstOrDefault(); if (planTrabajo != null) { detaplanTrabajo = db.DetallePlanTrabajoTrabajador.Where(x => x.IdPlanTrabajo == planTrabajo.IdPlanTrabajo).FirstOrDefault(); db.DetallePlanTrabajoTrabajador.Remove(detaplanTrabajo); db.PlanTrabajo.Remove(planTrabajo); db.SaveChanges(); return(new HttpResponseMessage(System.Net.HttpStatusCode.OK) { Content = null }); } else { throw new Exception("Error Al eliminar Plan de Trabjo no existe"); } } else { return new HttpResponseMessage(System.Net.HttpStatusCode.NoContent) { Content = null } }; } catch (Exception ex) { return(Request.CreateResponse <string>(HttpStatusCode.InternalServerError, ex.Message + Environment.NewLine + "BackLog")); } }
public int EliminarPlanTrabajo(PlanTrabajo PlanTrabajo, int AUDI_UsuarioEdita) { List <DbParameter> parametros = new List <DbParameter>(); DbParameter param = dpf.CreateParameter(); param.Value = PlanTrabajo.PLAN_Interno; param.ParameterName = "PLAN_Interno"; parametros.Add(param); DbParameter param1 = dpf.CreateParameter(); param1.Value = AUDI_UsuarioEdita; param1.ParameterName = "AUDI_UsuarioEdita"; parametros.Add(param1); int result = 0; try { if (Connection.State == System.Data.ConnectionState.Closed) { Connection.Open(); } result = EjecuteNonQuery("PA_EliminarPlanTrabajo", parametros); } catch (Exception ex) { throw new Exception("Error al eliminar plan de trabajo", ex); } finally { if (Connection.State == System.Data.ConnectionState.Open) { Connection.Close(); } } return(result); }
public List <PlanTrabajo> ConsultarPlanes(PlanTrabajo plann) { string sql = "select poc.descripcion as proyecto, pc.folio_trabajo as folio_trabajo, pc.descripcion as descripcion, " + "pc.fecha_ini as fecha_ini, pc.fecha_fin as fecha_fin, do.nombre as dominio, pc.fecha_cap as fecha_captura, " + "pc.folio_dominio as folio_dominio, ect.descripcion as estado from plan_0_cara pc left join proyecto_cara poc on poc.folio_proyecto = pc.folio_proyecto " + "left join dominio do on do.folio_dominio = pc.folio_dominio " + "left join edo_calendario_trabajo ect on ect.clv_edo_calendario_trabajo=pc.clv_edo_calendario_trabajo"; List <Parametro> parametros = new List <Parametro>(); Parametro paramDomiini = new Parametro(); paramDomiini.Nombre = "@folio_dominio"; paramDomiini.Valor = plann.folio_dominio.ToString(); parametros.Add(paramDomiini); SqlDataReader reader = conexion.Consultar(sql, parametros); List <PlanTrabajo> planes = new List <PlanTrabajo>(); while (reader.Read()) { PlanTrabajo plan = new PlanTrabajo(); plan.proyecto = reader["proyecto"].ToString(); plan.folio_trabajo = reader["folio_trabajo"].ToString(); plan.descripcion = reader["descripcion"].ToString(); plan.fecha_ini = reader["fecha_ini"].ToString(); plan.fecha_fin = reader["fecha_fin"].ToString(); plan.dominio = reader["dominio"].ToString(); plan.fecha_captura = reader["fecha_captura"].ToString(); plan.folio_dominio = reader["folio_dominio"].ToString(); plan.estado = reader["estado"].ToString(); planes.Add(plan); } conexion.Cerrar(); return(planes); }
public int CopiarPlan(PlanTrabajo PlanTrabajo, string PLAN_Descripcion, int AUDI_UsuarioCrea) { //ControlActividadR ControlActividad = new ControlActividadR(); ActividadRDAO DataActividad = new ActividadRDAO(); PlanTrabajo Plan = this.ObtenerPlanPorId(PlanTrabajo); PlanTrabajo PlanCopia = new PlanTrabajo(); PlanCopia.PLAN_Interno = null; PlanCopia.PLAN_Descripcion = PLAN_Descripcion; PlanCopia.PLAN_Regimen = Plan.PLAN_Regimen; PlanCopia.PLAN_UnidadLecturas = Plan.PLAN_UnidadLecturas; int PLAN_InternoCopia = this.InsertarPlan(PlanCopia, AUDI_UsuarioCrea, null); int?PART_Interno = this.ObtenerParteOrigenPLan(Convert.ToInt32(PlanTrabajo.PLAN_Interno)); int?PART_InternoCopia = this.ObtenerParteOrigenPLan(PLAN_InternoCopia); //List<ActividadR> Actividades = ControlActividad.ObtenerActividadesPorParte(Convert.ToInt32(PART_Interno)); List <ActividadR> Actividades = DataActividad.ObtenerActividadesParte(Convert.ToInt32(PART_Interno)); foreach (ActividadR Actividad in Actividades) { ActividadR ActividadCopia = new ActividadR(); ActividadCopia.ACRU_Interno = null; ActividadCopia.ACRU_Descripcion = Actividad.ACRU_Descripcion; ActividadCopia.ACRU_Tipo = Actividad.ACRU_Tipo; ActividadCopia.ACRU_ConCorte = Actividad.ACRU_ConCorte; ActividadCopia.ACRU_ConMedicion = Actividad.ACRU_ConMedicion; ActividadCopia.ACRU_UnidadMedicion = Actividad.ACRU_UnidadMedicion; ActividadCopia.ACRU_Frecuencia = Actividad.ACRU_Frecuencia; ActividadCopia.ACRU_UnidadFrecuencia = Actividad.ACRU_UnidadFrecuencia; ActividadCopia.PART_Interno = Convert.ToInt32(PART_InternoCopia); ActividadCopia.NOMB_Interno = Actividad.NOMB_Interno; //int res = ControlActividad.InsertarActividadR(ActividadCopia, AUDI_UsuarioCrea, null); int res = DataActividad.InsertarActividad(ActividadCopia, AUDI_UsuarioCrea, null); } CopiarPartesActividades(Convert.ToInt32(PART_Interno), Convert.ToInt32(PART_InternoCopia), PLAN_InternoCopia, AUDI_UsuarioCrea); return(1); }
/// <summary> /// Fabián Quirós Masís /// 03/10/2018 /// Efecto: actualiza un plan de trabajo asociado a un funcionario /// Requiere: PlanTrabajo, idFuncionario /// Modifica: - /// Devuelve: Plan de Trabajo /// </summary> /// <returns> - </returns> public void actualizarPlanTrabajo(PlanTrabajo planTrabajo, int idFuncionario) { SqlConnection sqlConnection = conexion.conexionTeletrabajo(); String consulta = @"UPDATE dbo.PlanTrabajo SET fecha_inicio =@fecha_inicio ,feacha_fin = @feacha_fin ,aprobacion_jefe = @aprobacion_jefe ,activo = @activo WHERE id_funcionario = @id_funcionario"; SqlCommand sqlCommand = new SqlCommand(consulta, sqlConnection); sqlCommand.Parameters.AddWithValue("@id_funcionario", idFuncionario); sqlCommand.Parameters.AddWithValue("@fecha_inicio", idFuncionario); sqlCommand.Parameters.AddWithValue("@feacha_fin", idFuncionario); sqlCommand.Parameters.AddWithValue("@aprobacion_jefe", idFuncionario); sqlCommand.Parameters.AddWithValue("@activo", true); sqlConnection.Open(); sqlCommand.ExecuteReader(); sqlConnection.Close(); }
public static int GuardarPlan(string PLAN_Interno, string PLAN_Descripcion, string PLAN_Regimen, string PLAN_UnidadLecturas) { PlanTrabajo PlanTrabajo = new PlanTrabajo(); if (PLAN_Interno == "") { PlanTrabajo.PLAN_Interno = null; } else { PlanTrabajo.PLAN_Interno = int.Parse(PLAN_Interno); } PlanTrabajo.PLAN_Descripcion = PLAN_Descripcion; PlanTrabajo.PLAN_Regimen = PLAN_Regimen; if (PLAN_UnidadLecturas == "") { PlanTrabajo.PLAN_UnidadLecturas = null; } else { PlanTrabajo.PLAN_UnidadLecturas = PLAN_UnidadLecturas; } ControlPlan ctrlPlan = new ControlPlan(); if (PLAN_Interno == "") { return(ctrlPlan.InsertarPlan(PlanTrabajo, 1, null)); } else if (PLAN_Interno != "") { return(ctrlPlan.InsertarPlan(PlanTrabajo, null, 1)); } else { return(0); } }
/// <summary> /// Fabián Quirós Masís /// 03/10/2018 /// Efecto: devuelve el plan de trabajo asociado a un funcionario /// Requiere: idFuncionario /// Modifica: - /// Devuelve: Plan de Trabajo /// </summary> /// <returns> PlanTrabajo </returns> public int insertarPlanTrabajo(PlanTrabajo planTrabajo, int idFuncionario) { SqlConnection sqlConnection = conexion.conexionTeletrabajo(); String consulta = @"INSERT INTO dbo.PlanTrabajo (id_funcionario,fecha_inicio,feacha_fin,activo) VALUES(@id_funcionario,@fecha_inicio,@feacha_fin,@activo) SELECT SCOPE_IDENTITY();"; SqlCommand sqlCommand = new SqlCommand(consulta, sqlConnection); sqlCommand.Parameters.AddWithValue("@id_funcionario", idFuncionario); sqlCommand.Parameters.AddWithValue("@fecha_inicio", planTrabajo.fechaInicio); sqlCommand.Parameters.AddWithValue("@feacha_fin", planTrabajo.fechaFin); sqlCommand.Parameters.AddWithValue("@activo", true); sqlConnection.Open(); int idPlan = Convert.ToInt32(sqlCommand.ExecuteScalar()); sqlConnection.Close(); return(idPlan); }
// POST: api/MisPlanes public List <PlanTrabajo> Post([FromBody] PlanTrabajo plan) { PlanTrabajoService servicio = new PlanTrabajoService(cadenaConexion); return(servicio.ConsultarPlanes(plan)); }