Пример #1
0
        public bool Modificar_DB(ro_planificacion_x_jornada_desfasada_Info Info)
        {
            try
            {
                using (EntityRoles_FJ db = new EntityRoles_FJ())
                {
                    var add = db.ro_planificacion_x_jornada_desfasada.FirstOrDefault(v => v.IdEmpresa == Info.IdEmpresa && v.IdPeriodo == Info.IdPeriodo && v.IdDivision == Info.IdDivision);
                    if (add != null)
                    {
                        add.Observación     = Info.Observación;
                        add.Fecha_UltMod    = DateTime.Now;
                        add.IdDivision      = Info.IdDivision;
                        add.IdUsuarioUltMod = Info.IdUsuarioUltMod;
                        db.SaveChanges();
                        Info.IdPlanificacion = add.IdPlanificacion;
                    }


                    return(true);
                }
            }
            catch (Exception ex)
            {
                string arreglo = ToString();
                tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
                tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref MensajeError);
                MensajeError = ex.ToString();
                throw new Exception(ex.ToString());
            }
        }
Пример #2
0
        public bool Anular_DB(ro_planificacion_x_jornada_desfasada_Info info)
        {
            try
            {
                using (EntityRoles_FJ db = new EntityRoles_FJ())
                {
                    string SQL = "";
                    SQL = " delete Fj_servindustrias.ro_planificacion_x_jornada_desfasada_empleado where IdEmpresa='" + info.IdEmpresa + "'  and IdNomina_Tipo='" + info.IdNomina_Tipo + "'  and IdPeriodo='" + info.IdPeriodo + "' and IdPlanificacion='" + info.IdPlanificacion + "'";

                    db.Database.ExecuteSqlCommand(SQL);

                    SQL = " delete Fj_servindustrias.ro_planificacion_x_jornada_desfasada where IdEmpresa='" + info.IdEmpresa + "'  and IdNomina_Tipo='" + info.IdNomina_Tipo + "'  and IdPeriodo='" + info.IdPeriodo + "' and IdPlanificacion='" + info.IdPlanificacion + "'";

                    db.Database.ExecuteSqlCommand(SQL);


                    return(true);
                }
            }
            catch (Exception ex)
            {
                string arreglo = ToString();
                tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
                tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref MensajeError);
                MensajeError = ex.ToString();
                throw new Exception(ex.ToString());
            }
        }
Пример #3
0
        public void Set(ro_planificacion_x_jornada_desfasada_Info info_)
        {
            try
            {
                Info_planificacion       = info_;
                cmb_periodo.EditValue    = info_.IdPeriodo;
                txtobservacion.EditValue = info_.Observación;
                cmbnomina.EditValue      = info_.IdNomina_Tipo;
                if (Info_planificacion.Esta_Proceso == "ABIERTO")
                {
                    lb_estado.Text = " PLANIFICACIÓN ABIERTA";
                }
                else
                {
                    lb_estado.Text = " PLANIFICACIÓN CERRADA";
                }
                // busca el detalle

                lista_empleado = Bus_empleado.Listado_planificacion_x_periodo(param.IdEmpresa, info_.IdNomina_Tipo, info_.IdPeriodo);
                gridControl_Turnos.DataSource = lista_empleado;
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
                MessageBox.Show(ex.ToString());
            }
        }
Пример #4
0
        public bool Cerrar_Planificacion(ro_planificacion_x_jornada_desfasada_Info Info)
        {
            try
            {
                using (EntityRoles_FJ db = new EntityRoles_FJ())
                {
                    var add = db.ro_planificacion_x_jornada_desfasada.FirstOrDefault(v => v.IdEmpresa == Info.IdEmpresa && v.IdPeriodo == Info.IdPeriodo && v.IdNomina_Tipo == Info.IdNomina_Tipo);
                    add.Esta_Proceso    = "CERRADO";
                    add.Fecha_UltMod    = DateTime.Now;
                    add.IdUsuarioUltMod = Info.IdUsuarioUltMod;
                    db.SaveChanges();



                    return(true);
                }
            }
            catch (Exception ex)
            {
                string arreglo = ToString();
                tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
                tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref MensajeError);
                MensajeError = ex.ToString();
                throw new Exception(ex.ToString());
            }
        }
Пример #5
0
        public bool Modificar_DB(ro_planificacion_x_jornada_desfasada_Info Info)
        {
            bool ba = true;

            try
            {
                if (data.Modificar_DB(Info))
                {
                    if (bus_planificacion_x_empleado.Eliminar(Info))
                    {
                        foreach (var item in Info.Lista)
                        {
                            ba = bus_planificacion_x_empleado.Guardar_DB(item);
                        }
                    }
                }

                return(ba);
            }
            catch (Exception ex)
            {
                mensaje = ex.ToString();
                tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
                tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", mensaje, "", "", "", "", "", DateTime.Now);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                throw new Exception(mensaje);
            }
        }
        public bool Anular_DB(ro_planificacion_x_jornada_desfasada_Info Info)
        {
            try
            {
                using (EntityRoles_FJ db = new EntityRoles_FJ())
                {
                    var add = db.ro_planificacion_x_jornada_desfasada.FirstOrDefault(v => v.IdEmpresa == Info.IdEmpresa && v.IdPeriodo == Info.IdPeriodo);
                    add.Estado = "I";
                    db.ro_planificacion_x_jornada_desfasada.Add(add);
                    db.SaveChanges();



                    return(true);
                }
            }
            catch (Exception ex)
            {
                string arreglo = ToString();
                tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
                tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref MensajeError);
                MensajeError = ex.ToString();
                throw new Exception(ex.ToString());
            }
        }
        public bool Guardar_DB(ro_planificacion_x_jornada_desfasada_Info info)
        {
            bool ba = false;

            try
            {
                int IdPlanificacion = 0;
                if (data.Guardar_DB(info, ref IdPlanificacion))
                {
                    foreach (var item in info.Lista)
                    {
                        item.IdPlanificacion = IdPlanificacion;
                        ba = bus_planificacion_x_empleado.Guardar_DB(item);
                    }
                }
                return(ba);
            }
            catch (Exception ex)
            {
                mensaje = ex.ToString();
                tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
                tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", mensaje, "", "", "", "", "", DateTime.Now);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                throw new Exception(mensaje);
            }
        }
Пример #8
0
        public bool Eliminar(ro_planificacion_x_jornada_desfasada_Info info, int Idmes, int IdAnio)
        {
            string mensaje = "";

            string SQL = "";

            try
            {
                using (EntityRoles_FJ db = new EntityRoles_FJ())
                {
                    if (info.IdDivision != null)
                    {
                        SQL = " delete Fj_servindustrias.ro_planificacion_x_jornada_desfasada_empleado where IdEmpresa='" + info.IdEmpresa + "'  and IdNomina_Tipo='" + info.IdNomina_Tipo + "'  and IdPeriodo='" + info.IdPeriodo + "' and IdPlanificacion='" + info.IdPlanificacion + "'";
                    }
                    else
                    {
                        SQL = " delete Fj_servindustrias.ro_planificacion_x_jornada_desfasada_empleado where IdEmpresa='" + info.IdEmpresa + "'  and IdNomina_Tipo='" + info.IdNomina_Tipo + "'  and Idanio='" + IdAnio + "' and IdMes='" + Idmes + "'";
                    }
                    db.Database.ExecuteSqlCommand(SQL);

                    return(true);
                }
            }
            catch (Exception ex)
            {
                string arreglo = ToString();
                tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
                tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now);
                mensaje = ex.InnerException + " " + ex.Message;
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                throw new Exception(ex.InnerException.ToString());
            }
        }
Пример #9
0
 private void gridView_Planificacion_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
 {
     try
     {
         info = new ro_planificacion_x_jornada_desfasada_Info();
         info = (ro_planificacion_x_jornada_desfasada_Info)gridView_Planificacion.GetFocusedRow();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Пример #10
0
 public bool Anular_DB(ro_planificacion_x_jornada_desfasada_Info Info)
 {
     try
     {
         return(data.Anular_DB(Info));
     }
     catch (Exception ex)
     {
         mensaje = ex.ToString();
         tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
         tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", mensaje, "", "", "", "", "", DateTime.Now);
         oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
         throw new Exception(mensaje);
     }
 }
Пример #11
0
 public bool Eliminar(ro_planificacion_x_jornada_desfasada_Info info, int IdAnio, int Idmes)
 {
     try
     {
         return(data.Eliminar(info, IdAnio, Idmes));
     }
     catch (Exception ex)
     {
         mensaje = ex.ToString();
         tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
         tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", mensaje, "", "", "", "", "", DateTime.Now);
         oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
         throw new Exception(mensaje);
     }
 }
Пример #12
0
        public List <ro_planificacion_x_jornada_desfasada_Info> Listado_planificacion_x_periodo(int IdEmpresa, DateTime Fecha_Inicio, DateTime Fecha_Fin)
        {
            try
            {
                Fecha_Inicio = Convert.ToDateTime(Fecha_Inicio.ToShortDateString());
                Fecha_Fin    = Convert.ToDateTime(Fecha_Fin.ToShortDateString());
                List <ro_planificacion_x_jornada_desfasada_Info> lista = new List <ro_planificacion_x_jornada_desfasada_Info>();
                using (EntityRoles_FJ db = new EntityRoles_FJ())
                {
                    var query = from q in db.vwro_planificacion_x_jornada_desfasada
                                where
                                q.IdEmpresa == IdEmpresa &&
                                q.pe_FechaIni >= Fecha_Inicio &&
                                q.pe_FechaIni <= Fecha_Fin
                                select q;

                    foreach (var item in query)
                    {
                        ro_planificacion_x_jornada_desfasada_Info add = new ro_planificacion_x_jornada_desfasada_Info();
                        add.IdEmpresa       = item.IdEmpresa;
                        add.IdPlanificacion = item.IdPlanificacion;
                        add.IdNomina_Tipo   = item.IdNomina_Tipo;
                        add.IdPeriodo       = item.IdPeriodo;
                        add.Observación     = item.Observación;
                        add.Esta_Proceso    = item.Esta_Proceso;
                        add.pe_FechaFin     = item.pe_FechaFin;
                        add.pe_FechaIni     = item.pe_FechaIni;
                        add.pe_descripcion  = item.pe_FechaIni.ToString().Substring(0, 10) + " al" + item.pe_FechaFin.ToString().Substring(0, 10);
                        add.Esta_Proceso    = item.Esta_Proceso;
                        add.Descripcion     = item.Descripcion;
                        lista.Add(add);
                    }
                }

                return(lista);
            }
            catch (Exception ex)
            {
                string arreglo = ToString();
                tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
                tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref MensajeError);
                MensajeError = ex.ToString();
                throw new Exception(ex.ToString());
            }
        }
Пример #13
0
 public bool Guardar_DB(ro_planificacion_x_jornada_desfasada_Info info, ref int IdPlanificacion)
 {
     try
     {
         if (!si_existe_planificacion(info.IdEmpresa, info.IdNomina_Tipo, info.IdPeriodo, info.IdDivision))
         {
             using (EntityRoles_FJ db = new EntityRoles_FJ())
             {
                 ro_planificacion_x_jornada_desfasada add = new ro_planificacion_x_jornada_desfasada();
                 add.IdEmpresa       = info.IdEmpresa;
                 add.IdPlanificacion = Get_Id(info.IdEmpresa);
                 add.IdNomina_Tipo   = info.IdNomina_Tipo;
                 add.IdPeriodo       = info.IdPeriodo;
                 add.Observación     = info.Observación;
                 add.Esta_Proceso    = "ABIERTO";
                 add.IdUsuario       = info.IdUsuario;
                 add.Fecha_Transac   = DateTime.Now;
                 add.Estado          = "A";
                 add.IdDivision      = info.IdDivision;
                 db.ro_planificacion_x_jornada_desfasada.Add(add);
                 db.SaveChanges();
                 IdPlanificacion = add.IdPlanificacion;
             }
             return(true);
         }
         else
         {
             return(Modificar_DB(info));
         }
     }
     catch (Exception ex)
     {
         string arreglo = ToString();
         tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
         tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now);
         oDataLog.Guardar_Log_Error(Log_Error_sis, ref MensajeError);
         MensajeError = ex.ToString();
         throw new Exception(ex.ToString());
     }
 }