Beispiel #1
0
        private void gridControlRubroDescuento_KeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                if (e.KeyCode == Keys.Delete)
                {
                    if (MessageBox.Show("¿Desea eliminar el registro seleccionado?", param.Nombre_sistema, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        bool resultado = false;

                        InfoRubroDescuento = (Aca_Rubro_x_fa_descuento_Info)this.gridViewRubroDescuento.GetFocusedRow();
                        if (InfoRubroDescuento != null)
                        {
                            InfoRubroDescuento.IdUsuarioUltAnu = param.IdUsuario;

                            //resultado = BusRubroDescuento.EliminarBD(InfoRubroDescuento, ref mensaje);
                            resultado = BusRubroDescuento.AnularDB(InfoRubroDescuento, ref mensaje);

                            if (resultado == true)
                            {
                                MessageBox.Show(param.Get_Mensaje_sys(enum_Mensajes_sys.Se_Anulo_Correctamente) + "el descuento " + InfoRubroDescuento.descuento, param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                        }

                        gridViewRubroDescuento.DeleteSelectedRows();
                    }
                }
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #2
0
        public bool AnularDB(Aca_Rubro_x_fa_descuento_Info info, ref string msj)
        {
            try
            {
                using (Entities_Academico Base = new Entities_Academico())
                {
                    var address = Base.Aca_Rubro_x_fa_descuento.FirstOrDefault(a => a.IdInstitucion_rub == info.IdInstitucion_rub && a.IdRubro == info.IdRubro && a.IdEmpresa_fadesc == info.IdEmpresa_fadesc && a.IdDescuento == info.IdDescuento);

                    if (address != null)
                    {
                        address.Estado          = false;
                        address.FechaUltAnu     = DateTime.Now;
                        address.MotivoAnulacion = info.MotivoAnulacion;
                        address.IdUsuarioUltAnu = info.IdUsuarioUltAnu;
                        Base.SaveChanges();
                        msj = "Se ha procedido anular  #: " + info.IdDescuento.ToString() + " exitosamente.";
                    }
                    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);
                msj = ex.InnerException + " " + ex.Message;
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref msj);
                msj = "Se ha producido el siguiente error: " + ex.Message;
                throw new Exception(ex.InnerException.ToString());
            }
        }
 public bool AnularDB(Aca_Rubro_x_fa_descuento_Info info, ref string msj)
 {
     try
     {
         return(odata.AnularDB(info, ref msj));
     }
     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("", "ConsultaGeneral", ex.Message), ex)
               {
                   EntityType = typeof(Aca_Rubro_x_fa_descuento_Bus)
               };
     }
 }
Beispiel #4
0
        public List <Aca_Rubro_x_fa_descuento_Info> Get_Lista(int IdInstitucion, int IdRubro, int IdEmpresa, decimal IdDescuento)
        {
            try
            {
                List <Aca_Rubro_x_fa_descuento_Info> Lista = new List <Aca_Rubro_x_fa_descuento_Info>();
                Entities_Academico Base = new Entities_Academico();
                var Select = from q in Base.vwAca_Rubro_x_fa_descuento
                             where q.IdInstitucion_rub == IdInstitucion &&
                             q.IdRubro == IdRubro &&
                             q.IdEmpresa_fadesc == IdEmpresa &&
                             q.IdDescuento == IdDescuento
                             select q;

                if (Select != null)
                {
                    foreach (var item in Select)
                    {
                        Aca_Rubro_x_fa_descuento_Info Info = new Aca_Rubro_x_fa_descuento_Info();
                        Info.IdInstitucion_rub = item.IdInstitucion_rub;
                        Info.IdRubro           = item.IdRubro;
                        Info.IdEmpresa_fadesc  = item.IdEmpresa_fadesc;
                        Info.IdDescuento       = item.IdDescuento;
                        if (item.Estado == true)
                        {
                            Info.estado = 'A';
                        }
                        else
                        {
                            Info.estado = 'I';
                        }
                        Info.Estado = item.Estado;

                        Lista.Add(Info);
                    }
                }
                return(Lista);
            }
            catch (Exception ex)
            {
                string arreglo      = ToString();
                string MensajeError = string.Empty;
                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);
                MensajeError = ex.InnerException + " " + ex.Message;
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref MensajeError);
                throw new Exception(ex.ToString());
            }
        }
Beispiel #5
0
        private void gridViewRubroDescuento_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            try
            {
                Double  PorcentajeDescuento = 0;
                Decimal IdDescuento         = 0;

                InfoRubroDescuento = new Aca_Rubro_x_fa_descuento_Info();
                txtCodigoRubro.Focus();
                InfoRubroDescuento  = (Aca_Rubro_x_fa_descuento_Info)this.gridViewRubroDescuento.GetFocusedRow();
                IdDescuento         = Convert.ToDecimal(gridViewRubroDescuento.GetFocusedRowCellValue(Col_IdDescuento));
                PorcentajeDescuento = ListInfoFaDescuento.FirstOrDefault(p => p.IdDescuento == IdDescuento).de_porcentaje;

                //if (e.Column.Name == "Col_IdDescuento")
                //{
                //    InfoRubroDescuento.porcentaje_descuento = PorcentajeDescuento;
                //    //InfoRubroDescuento.
                //}
                if (e.Column.Name == "Col_IdDescuento")
                {
                    foreach (var iteminfo in BListRubroDescuento)
                    {
                        var itemProd = ListInfoFaDescuento.FirstOrDefault(p => p.IdDescuento == InfoRubroDescuento.IdDescuento);

                        if (iteminfo.IdDescuento == InfoRubroDescuento.IdDescuento)
                        {
                            iteminfo.porcentaje_descuento = itemProd.de_porcentaje;
                            iteminfo.IdEmpresa_fadesc     = itemProd.IdEmpresa;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Log_Error_bus = new tb_sis_Log_Error_Vzen_Bus();
                Log_Error_bus.Log_Error(ex.ToString());
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #6
0
 public bool EliminarBD(Aca_Rubro_x_fa_descuento_Info info, ref string mensaje)
 {
     try
     {
         using (Entities_Academico Base = new Entities_Academico())
         {
             string comando = "delete Aca_Rubro_x_fa_descuento where IdInstitucion_rub = " + info.IdInstitucion_rub + " and IdRubro = " + info.IdRubro + " and IdEmpresa_fadesc = " + info.IdEmpresa_fadesc + " and IdDescuento = " + info.IdDescuento;
             Base.Database.ExecuteSqlCommand(comando);
         }
         return(true);
     }
     catch (Exception ex)
     {
         string arreglo      = ToString();
         string MensajeError = string.Empty;
         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);
         MensajeError = ex.InnerException + " " + ex.Message;
         oDataLog.Guardar_Log_Error(Log_Error_sis, ref MensajeError);
         throw new Exception(ex.InnerException.ToString());
     }
 }
Beispiel #7
0
        public bool GuardarDB(Aca_Rubro_x_fa_descuento_Info info, ref string mensaje)
        {
            try
            {
                bool resultado = false;

                using (Entities_Academico Base = new Entities_Academico())
                {
                    Aca_Rubro_x_fa_descuento Entity = new Aca_Rubro_x_fa_descuento();
                    Entity.IdInstitucion_rub = info.IdInstitucion_rub;
                    Entity.IdRubro           = info.IdRubro;
                    Entity.IdEmpresa_fadesc  = info.IdEmpresa_fadesc;
                    Entity.IdDescuento       = info.IdDescuento;
                    Entity.Estado            = true;
                    Entity.FechaCreacion     = info.FechaCreacion;
                    Entity.IdUsuarioCreacion = info.IdUsuarioCreacion;
                    Entity.nom_pc            = info.nom_pc;
                    Entity.ip = info.ip;

                    Base.Aca_Rubro_x_fa_descuento.Add(Entity);
                    Base.SaveChanges();
                    resultado = true;
                }


                return(resultado);
            }
            catch (Exception ex)
            {
                string arreglo      = ToString();
                string MensajeError = string.Empty;
                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);
                MensajeError = ex.InnerException + " " + ex.Message;
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref MensajeError);
                throw new Exception(ex.InnerException.ToString());
            }
        }