예제 #1
0
        public bool guardarDB(man_tecnico_Info info)
        {
            try
            {
                using (EntitiesMantenimiento Context = new EntitiesMantenimiento())
                {
                    man_tecnico Entity = new man_tecnico();
                    Entity.IdEmpresa      = info.IdEmpresa;
                    Entity.IdTecnico      = info.IdTecnico = get_id(info.IdEmpresa);
                    Entity.IdEmpleado     = info.IdEmpleado;
                    Entity.te_codigo      = info.te_codigo;
                    Entity.te_observacion = info.te_observacion;
                    Entity.estado         = true;
                    Context.man_tecnico.Add(Entity);
                    Context.SaveChanges();
                }

                return(true);
            }
            catch (Exception ex)
            {
                string mensaje = "";
                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 mensaje);
                mensaje = ex.ToString();
                throw new Exception(ex.ToString());
            }
        }
예제 #2
0
        public bool anularDB(man_tecnico_Info info)
        {
            try
            {
                using (EntitiesMantenimiento Context = new EntitiesMantenimiento())
                {
                    man_tecnico Entity = Context.man_tecnico.FirstOrDefault(q => q.IdEmpresa == info.IdEmpresa && q.IdTecnico == info.IdTecnico);
                    if (Entity != null)
                    {
                        Entity.estado = false;
                        Context.SaveChanges();
                    }
                }

                return(true);
            }
            catch (Exception ex)
            {
                string mensaje = "";
                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 mensaje);
                mensaje = ex.ToString();
                throw new Exception(ex.ToString());
            }
        }