예제 #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);
        }
예제 #2
0
        public bool Grabar()
        {
            bool resultado = false;

            try
            {
                Aca_Rubro_Info ruInfo = new Aca_Rubro_Info();
                Lista_Periodo_x_Rubro = new BindingList <Aca_Rubro_x_Aca_Periodo_Lectivo_Info>();


                string mensaje = string.Empty;
                int    id      = 0;

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


                //txtIdRubro.Text = id.ToString();

                Lista_Periodo_x_Rubro = Get_List_Rubro_x_Periodo();
                if (Periodo_x_Rubro_Bus.EliminarDB(param.IdInstitucion, ruInfo.IdRubro, ref mensaje))
                {
                    resultado = Periodo_x_Rubro_Bus.GrabarDB(Lista_Periodo_x_Rubro, ref mensaje);
                }



                if (resultado == true)
                {
                    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);
        }
예제 #3
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);
        }