コード例 #1
0
 public bool GuardarDB(tb_parametro_Info info)
 {
     try
     {
         using (Entities_general Context = new Entities_general())
         {
             tb_parametro Entity = Context.tb_parametro.FirstOrDefault(q => q.IdEmpresa == info.IdEmpresa);
             if (Entity == null)
             {
                 Entity = new tb_parametro
                 {
                     IdEmpresa       = info.IdEmpresa,
                     EsMultiSucursal = info.EsMultiSucursal,
                     IdCod_Impuesto  = info.IdCod_Impuesto,
                     Porcentaje      = info.Porcentaje
                 };
                 Context.tb_parametro.Add(Entity);
             }
             else
             {
                 Entity.EsMultiSucursal = info.EsMultiSucursal;
                 Entity.IdCod_Impuesto  = info.IdCod_Impuesto;
                 Entity.Porcentaje      = info.Porcentaje;
             }
             Context.SaveChanges();
         }
         return(true);
     }
     catch (Exception)
     {
         throw;
     }
 }
コード例 #2
0
 public tb_parametro_Info GetInfo(int IdEmpresa)
 {
     try
     {
         tb_parametro_Info info = new tb_parametro_Info();
         using (Entities_general Context = new Entities_general())
         {
             tb_parametro Entity = Context.tb_parametro.Where(q => q.IdEmpresa == IdEmpresa).FirstOrDefault();
             if (Entity == null)
             {
                 return(null);
             }
             info = new tb_parametro_Info
             {
                 IdEmpresa       = Entity.IdEmpresa,
                 EsMultiSucursal = Entity.EsMultiSucursal,
                 IdCod_Impuesto  = Entity.IdCod_Impuesto,
                 Porcentaje      = Entity.Porcentaje
             };
         }
         return(info);
     }
     catch (Exception)
     {
         throw;
     }
 }
コード例 #3
0
        public Boolean GuardarDB(tb_parametro_Info info, ref string msg)
        {
            try
            {
                Boolean resultado = false;
                using (EntitiesGeneral context = new EntitiesGeneral())
                {
                    var address = new tb_parametro();
                    address.IdParametro = info.IdParametro;
                    address.IdTipoParam = info.IdTipoParam;
                    address.Valor       = info.Valor;
                    address.descripcion = info.descripcion;

                    context.tb_parametro.Add(address);
                    context.SaveChanges();
                    resultado = true;
                }
                return(resultado);
            }
            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;
                msg     = "Se ha producido el siguiente error: " + ex.Message;
                throw new Exception(ex.ToString());
            }
        }
コード例 #4
0
 public Boolean ModificarDB(tb_parametro_Info info, ref string msg)
 {
     try
     {
         using (EntitiesGeneral context = new EntitiesGeneral())
         {
             var contact = context.tb_parametro.First(obj => obj.IdParametro == info.IdParametro);
             contact.IdParametro = info.IdParametro;
             contact.IdTipoParam = info.IdTipoParam;
             contact.Valor       = info.Valor;
             contact.descripcion = info.descripcion;
             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;
         msg     = "Se ha producido el siguiente error: " + ex.Message;
         throw new Exception(ex.ToString());
     }
 }
コード例 #5
0
        public List <tb_parametro_Info> Get_List_parametro()
        {
            try
            {
                List <tb_parametro_Info> lM        = new List <tb_parametro_Info>();
                EntitiesGeneral          OEGeneral = new EntitiesGeneral();

                var select_pv = from A in OEGeneral.tb_parametro
                                select A;

                foreach (var item in select_pv)
                {
                    tb_parametro_Info info = new tb_parametro_Info();
                    info.IdParametro = item.IdParametro;
                    info.IdTipoParam = item.IdTipoParam;
                    info.Valor       = item.Valor;
                    info.descripcion = item.descripcion;


                    lM.Add(info);
                }
                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.ToString() + " " + ex.Message;
                throw new Exception(ex.ToString());
            }
        }
コード例 #6
0
 public ActionResult Index(tb_parametro_Info model)
 {
     if (!bus_parametro.GuardarDB(model))
     {
         ViewBag.mensaje = "No se pudieron actualizar los registros";
     }
     cargar_combos();
     return(View(model));
 }
コード例 #7
0
 public bool GuardarDB(tb_parametro_Info info)
 {
     try
     {
         return(odata.GuardarDB(info));
     }
     catch (Exception)
     {
         throw;
     }
 }
コード例 #8
0
 public tb_parametro_Info Get_Parametro_Info(tb_parametro_enum IdParametro)
 {
     try
     {
         tb_parametro_Info InfoMensaje = listParametros.FirstOrDefault(v => v.IdParametro == IdParametro.ToString());
         return(InfoMensaje);
     }
     catch (Exception ex)
     {
         return(new tb_parametro_Info());
     }
 }
コード例 #9
0
 public Boolean GuardarDB(tb_parametro_Info info, ref string msg)
 {
     try
     {
         return(data.GuardarDB(info, ref msg));
     }
     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("", "ModificarDB", ex.Message), ex)
               {
                   EntityType = typeof(tb_parametro_Bus)
               };
     }
 }
コード例 #10
0
        public ActionResult Index()
        {
            int IdEmpresa           = Convert.ToInt32(SessionFixed.IdEmpresa);
            tb_parametro_Info model = bus_parametro.GetInfo(IdEmpresa);

            if (model == null)
            {
                model = new tb_parametro_Info {
                    IdEmpresa = IdEmpresa
                }
            }
            ;
            cargar_combos();
            return(View(model));
        }