Пример #1
0
        private void llamar_formulario_gasto(Cl_Enumeradores.eTipo_action Accion)
        {
            try
            {
                imp_gasto_x_ct_plancta_Info row = (imp_gasto_x_ct_plancta_Info)gridView_gastos.GetFocusedRow();
                if (Accion != Cl_Enumeradores.eTipo_action.grabar)
                {
                    if (row == null)
                    {
                        MessageBox.Show("Seleccione un registro", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        return;
                    }

                    if (!row.info_gasto.estado && Accion != Cl_Enumeradores.eTipo_action.consultar)
                    {
                        MessageBox.Show("El registro se encuentra anulado", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        return;
                    }
                }

                frmImp_gasto_x_ct_plancta_mant frm = new frmImp_gasto_x_ct_plancta_mant();
                frm.set_accion(Accion);
                if (Accion != Cl_Enumeradores.eTipo_action.grabar)
                {
                    frm.set_info(row);
                }
                frm.ShowDialog();
                load_data();
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
                MessageBox.Show(ex.ToString(), param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
 public imp_gasto_x_ct_plancta_Info get_info(int IdEmpresa, string IdCtaCble)
 {
     try
     {
         imp_gasto_x_ct_plancta_Info info = new imp_gasto_x_ct_plancta_Info();
         using (Entities_importacion Context = new Entities_importacion())
         {
             imp_gasto_x_ct_plancta Entity = Context.imp_gasto_x_ct_plancta.FirstOrDefault(q => q.IdEmpresa == IdEmpresa && q.IdCtaCble == IdCtaCble);
             if (Entity == null)
             {
                 return(null);
             }
             info = new imp_gasto_x_ct_plancta_Info
             {
                 IdEmpresa    = Entity.IdEmpresa,
                 IdGasto_tipo = Entity.IdGasto_tipo,
                 IdCtaCble    = Entity.IdCtaCble
             };
         }
         return(info);
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #3
0
 public frmImp_gasto_x_ct_plancta_mant()
 {
     InitializeComponent();
     info_gasto_x_ct = new imp_gasto_x_ct_plancta_Info();
     bus_gasto_x_ct  = new imp_gasto_x_ct_plancta_Bus();
     param           = cl_parametrosGenerales_Bus.Instance;
     Log_Error_bus   = new tb_sis_Log_Error_Vzen_Bus();
 }
Пример #4
0
 public bool guardarDB(imp_gasto_x_ct_plancta_Info info)
 {
     try
     {
         return(odata.guardarDB(info));
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #5
0
 public void set_info(imp_gasto_x_ct_plancta_Info _info)
 {
     try
     {
         info_gasto_x_ct = _info;
     }
     catch (Exception ex)
     {
         Log_Error_bus.Log_Error(ex.ToString());
         MessageBox.Show(ex.ToString(), param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
 public bool guardarDB(imp_gasto_x_ct_plancta_Info info)
 {
     try
     {
         return(odata.guardarDB(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("", "guardarDB", ex.Message), ex)
               {
                   EntityType = typeof(imp_gasto_x_ct_plancta_Bus)
               };
     }
 }
Пример #7
0
 private void gridView_gastos_RowStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowStyleEventArgs e)
 {
     try
     {
         imp_gasto_x_ct_plancta_Info row = (imp_gasto_x_ct_plancta_Info)gridView_gastos.GetRow(e.RowHandle);
         if (row == null)
         {
             return;
         }
         if (!row.info_gasto.estado)
         {
             e.Appearance.ForeColor = Color.Red;
         }
     }
     catch (Exception ex)
     {
         Log_Error_bus.Log_Error(ex.ToString());
         MessageBox.Show(ex.ToString(), param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
 public bool guardarDB(imp_gasto_x_ct_plancta_Info info)
 {
     try
     {
         using (Entities_importacion Context = new Entities_importacion())
         {
             imp_gasto_x_ct_plancta Entity = new imp_gasto_x_ct_plancta
             {
                 IdEmpresa    = info.IdEmpresa,
                 IdGasto_tipo = info.IdGasto_tipo,
                 IdCtaCble    = info.IdCtaCble
             };
             Context.imp_gasto_x_ct_plancta.Add(Entity);
             Context.SaveChanges();
         }
         return(true);
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #9
0
        public bool guardarDB(imp_gasto_x_ct_plancta_Info info)
        {
            try
            {
                using (Entities_importacion Context = new Entities_importacion())
                {
                    if (info.info_gasto.IdGasto_tipo == 0)
                    {
                        imp_gasto Entity_gasto = new imp_gasto();
                        Entity_gasto.IdGasto_tipo   = info.info_gasto.IdGasto_tipo = info.IdGasto_tipo = get_id_gasto();
                        Entity_gasto.gt_descripcion = info.info_gasto.gt_descripcion;
                        Entity_gasto.estado         = info.info_gasto.estado = true;
                        Context.imp_gasto.Add(Entity_gasto);
                        Context.SaveChanges();

                        imp_gasto_x_ct_plancta Entity = new imp_gasto_x_ct_plancta();
                        Entity.IdEmpresa    = info.IdEmpresa;
                        Entity.IdGasto_tipo = info.IdGasto_tipo;
                        Entity.IdCtaCble    = info.IdCtaCble;
                        Context.imp_gasto_x_ct_plancta.Add(Entity);
                        Context.SaveChanges();
                    }
                    else
                    {
                        imp_gasto Entity_gasto = Context.imp_gasto.FirstOrDefault(q => q.IdGasto_tipo == info.IdGasto_tipo);
                        if (Entity_gasto == null)
                        {
                            return(false);
                        }

                        Entity_gasto.gt_descripcion = info.info_gasto.gt_descripcion;
                        Context.SaveChanges();

                        imp_gasto_x_ct_plancta Entity = Context.imp_gasto_x_ct_plancta.FirstOrDefault(q => q.IdEmpresa == info.IdEmpresa && q.IdGasto_tipo == info.IdGasto_tipo);
                        if (Entity == null)
                        {
                            Entity              = new imp_gasto_x_ct_plancta();
                            Entity.IdEmpresa    = info.IdEmpresa;
                            Entity.IdGasto_tipo = info.IdGasto_tipo;
                            Entity.IdCtaCble    = info.IdCtaCble;
                            Context.imp_gasto_x_ct_plancta.Add(Entity);
                            Context.SaveChanges();
                        }
                        else
                        {
                            Entity.IdCtaCble = info.IdCtaCble;
                            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);
                mensaje = ex.ToString();
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                throw new Exception(ex.ToString());
            }
        }