Example #1
0
        public Boolean GrabarDB(cp_proveedor_codigo_SRI_Info info)
        {
            try
            {
                using (EntitiesCuentasxPagar context = new EntitiesCuentasxPagar())
                {
                    EntitiesCuentasxPagar EDB = new EntitiesCuentasxPagar();

                    var address = new cp_proveedor_codigo_SRI();
                    address.IdEmpresa    = info.IdEmpresa;
                    address.IdProveedor  = info.IdProveedor;
                    address.IdCodigo_SRI = info.IdCodigo_SRI;
                    address.observacion  = info.observacion == null ? "" : info.observacion.Trim();
                    context.cp_proveedor_codigo_SRI.Add(address);
                    context.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());
            }
        }
Example #2
0
        public List <cp_proveedor_codigo_SRI_Info> Get_List_proveedor_codigo_SRI(int IdEmpresa, decimal Iproveedor)
        {
            try
            {
                List <cp_proveedor_codigo_SRI_Info> lM = new List <cp_proveedor_codigo_SRI_Info>();
                EntitiesCuentasxPagar db = new EntitiesCuentasxPagar();

                var select_ = from T in db.cp_proveedor_codigo_SRI
                              where T.IdEmpresa == IdEmpresa && T.IdProveedor == Iproveedor
                              select T;

                foreach (var item in select_)
                {
                    cp_proveedor_codigo_SRI_Info dat = new cp_proveedor_codigo_SRI_Info();
                    dat.IdEmpresa    = item.IdEmpresa;
                    dat.IdProveedor  = item.IdProveedor;
                    dat.IdCodigo_SRI = item.IdCodigo_SRI;
                    // dat.IdCtaCble = item.IdCtaCble;

                    dat.observacion = item.observacion;

                    lM.Add(dat);
                }
                return(lM);
            }
            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());
            }
        }
Example #3
0
 public Boolean EliminarDB(cp_proveedor_codigo_SRI_Info Info)
 {
     try
     {
         using (EntitiesCuentasxPagar context = new EntitiesCuentasxPagar())
         {
             var contact = context.cp_proveedor_codigo_SRI.FirstOrDefault(min => min.IdEmpresa == Info.IdEmpresa && min.IdProveedor == Info.IdProveedor && min.IdCodigo_SRI == Info.IdCodigo_SRI);
             if (contact != null)
             {
                 context.cp_proveedor_codigo_SRI.Remove(contact);
                 context.SaveChanges();
                 context.Dispose();
             }
         }
         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.ToString() + " " + ex.Message;
         throw new Exception(ex.ToString());
     }
 }
 public Boolean GrabarDB(cp_proveedor_codigo_SRI_Info info)
 {
     try
     {
         cp_proveedor_codigo_SRI_Data data = new cp_proveedor_codigo_SRI_Data();
         return data.GrabarDB(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("", "GrabarDB", ex.Message), ex) { EntityType = typeof(cp_proveedor_codigo_SRI_Bus) };
     }
 }
Example #5
0
 public Boolean ModificarDB(cp_proveedor_codigo_SRI_Info info)
 {
     try
     {
         using (EntitiesCuentasxPagar context = new EntitiesCuentasxPagar())
         {
             var select = from A in context.cp_proveedor_codigo_SRI
                          where A.IdEmpresa == info.IdEmpresa &&
                          A.IdProveedor == info.IdProveedor &&
                          A.IdCodigo_SRI == info.IdCodigo_SRI
                          select A;
             if (select.ToList().Count < 1)
             {
                 GrabarDB(info);
             }
             else
             {
                 var contact = context.cp_proveedor_codigo_SRI.FirstOrDefault(minfo => minfo.IdEmpresa == info.IdEmpresa && minfo.IdProveedor == info.IdProveedor && minfo.IdCodigo_SRI == info.IdCodigo_SRI);
                 if (contact != null)
                 {
                     contact.observacion = info.observacion;
                     context.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.ToString() + " " + ex.Message;
         throw new Exception(ex.ToString());
     }
 }