public Boolean GrabarBD(ro_empleado_gastos_perso_x_Gastos_deduci_Info info, ref string msg)
        {
            try
            {
                using (EntitiesRoles db = new EntitiesRoles())
                {
                    ro_empleado_gastos_perso_x_Gastos_deduci item = new ro_empleado_gastos_perso_x_Gastos_deduci();

                    item.IdEmpresa      = info.IdEmpresa;
                    item.IdEmpleado     = info.IdEmpleado;
                    item.Anio_fiscal    = info.Anio_fiscal;
                    item.Secuencia      = getId(info.IdEmpresa, info.IdEmpleado, info.Anio_fiscal);
                    item.Ruc            = info.Ruc;
                    item.Num_CbteVta    = info.Num_CbteVta;
                    item.Base_Imponible = info.Base_Imponible;
                    item.IdTipoGastos   = info.IdTipoGastos;

                    db.ro_empleado_gastos_perso_x_Gastos_deduci.Add(item);
                    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 mensaje);
                mensaje = msg = ex.InnerException + " " + ex.Message;
                throw new Exception(ex.InnerException.ToString());
            }
        }
コード例 #2
0
 public Boolean Eliminar_EGPXGD(ro_empleado_gastos_perso_x_Gastos_deduci_Info info)
 {
     try
     {
         return(Data.Eliminar_EGPXGD(info));
     }
     catch (Exception ex)
     {
         Core.Erp.Info.Log_Exception.LoggingManager.Logger.Log(Core.Erp.Info.Log_Exception.LoggingCategory.Error, ex.Message);
         throw new Core.Erp.Info.Log_Exception.DalException(string.Format("", "Eliminar_EGPXGD", ex.Message), ex)
               {
                   EntityType = typeof(ro_empleado_gastos_perso_Bus)
               };
     }
 }
        public List <ro_empleado_gastos_perso_x_Gastos_deduci_Info> Get_List_empleado_gastos_perso_x_Gastos_deduc(int IdEmpresa, decimal IdEmpleado, int anio)
        {
            List <ro_empleado_gastos_perso_x_Gastos_deduci_Info> lst = new List <ro_empleado_gastos_perso_x_Gastos_deduci_Info>();

            try
            {
                using (EntitiesRoles rol = new EntitiesRoles())
                {
                    var Consulta = from q in rol.vwRo_empleado_gastos_perso_x_Gastos_deduci_x_sri_tipo_Gasto
                                   where q.IdEmpresa == IdEmpresa &&
                                   q.IdEmpleado == IdEmpleado &&
                                   q.Anio_fiscal == anio
                                   orderby q.IdEmpleado
                                   select q;

                    foreach (var item in Consulta)
                    {
                        ro_empleado_gastos_perso_x_Gastos_deduci_Info info = new ro_empleado_gastos_perso_x_Gastos_deduci_Info();
                        info.IdEmpresa      = item.IdEmpresa;
                        info.IdEmpleado     = item.IdEmpleado;
                        info.Anio_fiscal    = item.Anio_fiscal;
                        info.Secuencia      = item.Secuencia;
                        info.Ruc            = item.Ruc;
                        info.Num_CbteVta    = item.Num_CbteVta;
                        info.Base_Imponible = item.Base_Imponible;
                        info.IdTipoGastos   = item.IdTipoGastos;
                        info.descTipoGasto  = item.Descripcion;
                        lst.Add(info);
                    }
                }
                return(lst);
            }
            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 mensaje);
                mensaje = ex.InnerException + " " + ex.Message;
                throw new Exception(ex.InnerException.ToString());
            }
        }
        //public int GetSecuencia()
        //{
        //    try
        //    {
        //        EntitiesRoles rol = new EntitiesRoles();
        //        var numero = (from q in rol.ro_empleado_gastos_perso_x_Gastos_deduci
        //                      select q.Secuencia).Max() + 1;

        //        return numero;
        //    }
        //    catch (Exception)
        //    {

        //        return 0;
        //    }
        //}

        public Boolean Eliminar_EGPXGD(ro_empleado_gastos_perso_x_Gastos_deduci_Info info)
        {
            try
            {
                using (EntitiesRoles ro = new EntitiesRoles())
                {
                    ro_empleado_gastos_perso_x_Gastos_deduci EGPXGD = ro.ro_empleado_gastos_perso_x_Gastos_deduci.First(v => v.IdEmpleado == info.IdEmpleado && v.IdEmpresa == info.IdEmpresa && v.Anio_fiscal == info.Anio_fiscal);
                    ro.ro_empleado_gastos_perso_x_Gastos_deduci.Remove(EGPXGD);
                    ro.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 mensaje);
                mensaje = ex.InnerException + " " + ex.Message;
                throw new Exception(ex.InnerException.ToString());
            }
        }