예제 #1
0
        public bool Grabar()
        {
            bool resultado = false;

            try
            {
                string mensaje = string.Empty;
                int    id      = 0;
                rubroInfo = GetRubro(ref mensaje);
                if (mensaje != "")
                {
                    MessageBox.Show(mensaje);
                    return(false);
                }

                Aca_Rubro_Bus neg = new Aca_Rubro_Bus();
                if (neg.GrabarDB(rubroInfo, ref id, ref mensaje))
                {
                    txtIdRubro.Text = id.ToString();

                    if (Lista_Periodo_x_Rubro.Count() != 0)
                    {
                        if (Lista_Periodo_x_Rubro.Where(v => v.chequeo == true).Any())
                        {
                            foreach (var item in Lista_Periodo_x_Rubro)
                            {
                                item.IdInstitucion_rub   = param.IdInstitucion;
                                item.IdInstitucion_per   = param.IdInstitucion;
                                item.IdRubro             = (Convert.ToInt16(txtIdRubro.Text) == null) ? id : Convert.ToInt16(txtIdRubro.Text);
                                item.IdAnioLectivo       = ucAca_Anio_Lectivo1.get_item();
                                item.UsuarioCreacion     = param.IdUsuario;
                                item.UsuarioModificacion = param.IdUsuario;
                                item.Estado = "A";
                            }
                            if (Periodo_x_Rubro_Bus.EliminarDB(param.IdInstitucion, id, ref mensaje))
                            {
                                resultado = Periodo_x_Rubro_Bus.GrabarDB(Lista_Periodo_x_Rubro, ref mensaje);
                            }
                        }
                    }
                }


                if (resultado == true)
                {
                    MessageBox.Show(mensaje, param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    Log_Error_bus.Log_Error(mensaje.ToString());
                    MessageBox.Show("Error " + mensaje, param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
                MessageBox.Show(ex.Message);
            }
            return(resultado);
        }
        public void llenar_grid()
        {
            List <Aca_Rubro_Info> listaRubro = new List <Aca_Rubro_Info>();
            Aca_Rubro_Bus         neg        = new Aca_Rubro_Bus();

            listaRubro = neg.Get_List_Rubro();
            gridControlRubros.DataSource = listaRubro;
        }
예제 #3
0
        private bool Anular()
        {
            try
            {
                bool resultado = false;
                if (rubroInfo.estado != "I")
                {
                    if (MessageBox.Show("¿Está seguro que desea anular el Rubro #:" + txtIdRubro.Text.Trim() + " ?", "Anulación de Mantenimiento Rubro", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        FrmGe_MotivoAnulacion fr = new FrmGe_MotivoAnulacion();
                        fr.ShowDialog();

                        Aca_Rubro_Bus  neg     = new Aca_Rubro_Bus();
                        Aca_Rubro_Info ruInfo  = new Aca_Rubro_Info();
                        string         mensaje = string.Empty;

                        ruInfo = GetRubro(ref mensaje);
                        if (mensaje != "")
                        {
                            MessageBox.Show("Error " + mensaje, param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        ruInfo.UsuarioAnulacion = param.IdUsuario;
                        ruInfo.MotivoAnulacion  = fr.motivoAnulacion;
                        resultado = neg.EliminarDB(ruInfo, ref mensaje);
                        if (resultado)
                        {
                            MessageBox.Show(mensaje, param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Information);
                            this.ucGe_Menu.Visible_bntGuardar_y_Salir = false;
                            this.ucGe_Menu.Visible_btnGuardar         = false;
                        }
                        else
                        {
                            Log_Error_bus.Log_Error(mensaje.ToString());
                            MessageBox.Show("Error " + mensaje, param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                }
                else
                {
                    MessageBox.Show("El rubro #:" + txtIdRubro.Text.Trim() + " ya se encuentra anulado", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }

                return(resultado);
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
                MessageBox.Show("Error " + ex.Message.ToString(), param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(false);
            }
        }
예제 #4
0
        public bool Actualizar()
        {
            bool resultado = false;

            try
            {
                Aca_Rubro_Bus  neg     = new Aca_Rubro_Bus();
                Aca_Rubro_Info ruInfo  = new Aca_Rubro_Info();
                string         mensaje = string.Empty;

                Lista_Periodo_x_Rubro = new BindingList <Aca_Rubro_x_Aca_Periodo_Lectivo_Info>();

                Lista_Periodo_x_Rubro = Get_List_Rubro_x_Periodo();

                //ruInfo = GetRubro(ref mensaje);
                //if (mensaje != "")
                //{
                //    MessageBox.Show(mensaje);
                //    return false;
                //}

                //if (neg.ActualizarDB(ruInfo, ref mensaje))
                //{
                if (Periodo_x_Rubro_Bus.EliminarDB(rubroInfo.IdInstitucion, rubroInfo.IdRubro, ref mensaje))
                {
                    resultado = Periodo_x_Rubro_Bus.GrabarDB(Lista_Periodo_x_Rubro, ref mensaje);
                }
                //}
                if (resultado)
                {
                    MessageBox.Show(mensaje, "Sistemas", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.ucGe_Menu.Visible_bntGuardar_y_Salir = false;
                    this.ucGe_Menu.Visible_btnGuardar         = false;
                }
                else
                {
                    Log_Error_bus.Log_Error(mensaje.ToString());
                    MessageBox.Show("Error " + mensaje, "Sistemas", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
                MessageBox.Show(ex.Message);
            }
            return(resultado);
        }
예제 #5
0
        public void Cargar_Combos()
        {
            try
            {
                vwAca_curso_Bus neg = new vwAca_curso_Bus();
                Lista_Curso = new List <vwAca_curso_Info>();
                Lista_Curso = neg.Get_List_Curso(ref mensaje);
                cmbCurso.Properties.DataSource = Lista_Curso;

                Aca_Rubro_Bus BusRubro = new Aca_Rubro_Bus();
                listRubro = BusRubro.Get_List_Rubro();

                cmb_rubro.DataSource = listRubro;
            }
            catch (Exception ex)
            {
                MessageBox.Show(param.Get_Mensaje_sys(enum_Mensajes_sys.Error_comunicarse_con_sistemas) + ":" + ex.Message + " ", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
                Log_Error_bus.Log_Error(ex.ToString());
            }
        }
예제 #6
0
        public bool Grabar()
        {
            bool resultado = false;

            try
            {
                string mensaje = string.Empty;
                int    id      = 0;
                rubroInfo = GetRubro(ref mensaje);
                if (mensaje != "")
                {
                    MessageBox.Show(mensaje);
                    return(false);
                }

                Aca_Rubro_Bus neg = new Aca_Rubro_Bus();
                if (Lista_Periodo_x_Rubro.Count() == 0)
                {
                    DialogResult dialogResult = MessageBox.Show("Esta seguro de registrar el Rubro sin un Periodo ni Valor", "Some Title", MessageBoxButtons.YesNo);
                    if (dialogResult == DialogResult.Yes)
                    {
                        //do something
                        if (neg.GrabarDB(rubroInfo, ref id, ref mensaje))
                        {
                            //BusFaDescuento.GrabarBD(InfoFaDescuento, ref mensaje);

                            GetRubroDescuento(id);


                            BusRubroDescuento.GuardarDB(ListRubroDescuento, ref mensaje);

                            if (mensaje != "")
                            {
                                MessageBox.Show(mensaje);
                                return(false);
                            }
                        }
                    }
                    else if (dialogResult == DialogResult.No)
                    {
                        //do something else
                        mensaje = "Asigne al Rubro un Periodo y Valor";
                    }
                }
                else if (Lista_Periodo_x_Rubro.Count() != 0)
                {
                    if (Lista_Periodo_x_Rubro.Where(v => v.chequeo == true).Any())
                    {
                        foreach (var rub in Lista_Periodo_x_Rubro)
                        {
                            if (rub.Valor == 0)
                            {
                                MessageBox.Show("Ingrese un Valor", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                            else
                            {
                                if (neg.GrabarDB(rubroInfo, ref id, ref mensaje))
                                {
                                    txtIdRubro.Text = id.ToString();


                                    if (Lista_Periodo_x_Rubro.Where(v => v.chequeo == true).Any())
                                    {
                                        foreach (var item in Lista_Periodo_x_Rubro)
                                        {
                                            item.IdInstitucion_rub   = param.IdInstitucion;
                                            item.IdInstitucion_per   = param.IdInstitucion;
                                            item.IdRubro             = (Convert.ToInt16(txtIdRubro.Text) == null) ? id : Convert.ToInt16(txtIdRubro.Text);
                                            item.IdAnioLectivo       = ucAca_Anio_Lectivo1.get_item();
                                            item.UsuarioCreacion     = param.IdUsuario;
                                            item.UsuarioModificacion = param.IdUsuario;
                                            item.Estado = "A";
                                        }
                                        if (Periodo_x_Rubro_Bus.EliminarDB(param.IdInstitucion, id, ref mensaje))
                                        {
                                            resultado = Periodo_x_Rubro_Bus.GrabarDB(Lista_Periodo_x_Rubro, ref mensaje);
                                        }
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("No tiene selecciona la columna de asignación de valores", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }

                if (resultado == true)
                {
                    MessageBox.Show(mensaje, param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
                MessageBox.Show(ex.Message);
            }
            return(resultado);
        }