Beispiel #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);
        }
Beispiel #2
0
        private void UCAca_Rubro_EditValueChanged_1(object sender, EventArgs e)
        {
            // _InfoRubro = (Aca_Rubro_Info)UC_Rubro.Properties.View.GetFocusedRow();


            //this.Event_UCRubro_SelectionChanged(sender, e);

            // Event_UCRubro_EditValueChanged(sender, e);

            try
            {
                _InfoRubro = (Aca_Rubro_Info)UC_Rubro.Properties.View.GetFocusedRow();
                this.Event_UCRubro_SelectionChanged(sender, e);

                Event_UCRubro_EditValueChanged(sender, e);

                if (_InfoRubro == null)
                {
                    ListRubro  = BusRubro.Get_List_Rubro();
                    _InfoRubro = ListRubro.Where(v => v.IdRubro == Convert.ToDecimal(UC_Rubro.EditValue)).FirstOrDefault();
                }
            }
            catch (Exception ex)
            {
                string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name;
                MessageBox.Show(NameMetodo + " - " + ex.ToString(), param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
                Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString());
            }
        }
Beispiel #3
0
        public Aca_Rubro_Info   get_item_info()
        {
            try
            {
                if (UC_Rubro.EditValue != null && UC_Rubro.Text != "")
                {
                    _InfoRubro = (Aca_Rubro_Info)UC_Rubro.Properties.View.GetFocusedRow();
                    if (_InfoRubro == null)
                    {
                        ListRubro  = BusRubro.Get_List_Rubro();
                        _InfoRubro = ListRubro.Where(v => v.IdRubro == Convert.ToDecimal(UC_Rubro.EditValue)).FirstOrDefault();
                    }
                }
                else
                {
                    return(new Aca_Rubro_Info());
                }

                return(_InfoRubro);
            }
            catch (Exception ex)
            {
                string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name;
                MessageBox.Show(NameMetodo + " - " + ex.ToString(), param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
                Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString());
                return(new Aca_Rubro_Info());
            }
        }
Beispiel #4
0
 public Boolean AnularDB(Aca_Rubro_Info info, ref string msg)
 {
     try
     {
         using (Entities_Academico context = new Entities_Academico())
         {
             var address = context.Aca_Rubro.FirstOrDefault(a => a.IdRubro == info.IdRubro);
             if (address != null)
             {
                 address.estado           = "I";
                 address.FechaAnulacion   = DateTime.Now;
                 address.UsuarioAnulacion = info.UsuarioAnulacion;
                 address.MotivoAnulacion  = info.MotivoAnulacion;
                 context.SaveChanges();
                 msg = "Se ha procedido anular el rubro #: " + info.IdRubro.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);
         msg = ex.InnerException + " " + ex.Message;
         oDataLog.Guardar_Log_Error(Log_Error_sis, ref msg);
         msg = "Se ha producido el siguiente error: " + ex.Message;
         throw new Exception(ex.ToString());
     }
 }
Beispiel #5
0
        private void Menu_event_btnModificar_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            try
            {
                rubroInfo = (Aca_Rubro_Info)this.gridViewRubro.GetFocusedRow();

                if (rubroInfo == null)
                {
                    MessageBox.Show(param.Get_Mensaje_sys(enum_Mensajes_sys.Por_favor_seleccione_item_a_modi), param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                else
                {
                    if (rubroInfo.estado != "I")
                    {
                        llama_frm(Cl_Enumeradores.eTipo_action.actualizar);
                    }
                    else
                    {
                        MessageBox.Show(param.Get_Mensaje_sys(enum_Mensajes_sys.No_se_puede_modif_regis_Inac), param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
                MessageBox.Show(param.Get_Mensaje_sys(enum_Mensajes_sys.Error_comunicarse_con_sistemas) + ex.Message + " ", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #6
0
 public void set_Rubro(Aca_Rubro_Info info)
 {
     try
     {
         rubroInfo = info;
     }
     catch (Exception ex)
     {
         Log_Error_bus.Log_Error(ex.ToString());
         MessageBox.Show(ex.Message);
     }
 }
Beispiel #7
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);
            }
        }
Beispiel #8
0
        public List <Aca_Rubro_Info> Get_List_Rubro(int IdInstitucion, int Idsede)
        {
            List <Aca_Rubro_Info> lista = new List <Aca_Rubro_Info>();
            Aca_Rubro_Info        rubroInfo;

            try
            {
                using (Entities_Academico Base = new Entities_Academico())
                {
                    var rubro = from r in Base.Aca_Rubro
                                where r.estado == "A" && r.IdSede == Idsede && r.IdInstitucion == IdInstitucion
                                orderby r.IdRubro
                                select r;

                    foreach (var item in rubro)
                    {
                        rubroInfo = new Aca_Rubro_Info();
                        rubroInfo.IdInstitucion     = item.IdInstitucion;
                        rubroInfo.IdRubro           = item.IdRubro;
                        rubroInfo.Descripcion_rubro = item.Descripcion_rubro;
                        rubroInfo.Deb_cred          = item.deb_cred;
                        //rubroInfo.CodRubro = item.CodRubro;
                        rubroInfo.CodRubro       = "[" + item.CodRubro + "]" + item.Descripcion_rubro;
                        rubroInfo.CodAlterno     = item.CodAlterno;
                        rubroInfo.IdTipoServicio = item.IdTipoServicio_cata;
                        rubroInfo.IdTipoRubro    = item.IdTipoRubro;
                        rubroInfo.IdGrupoFE      = item.IdGrupoFE;

                        rubroInfo.estado           = item.estado;
                        rubroInfo.IdCtaCble        = item.IdCtaCble;
                        rubroInfo.IdEmpresa_inv    = item.IdEmpresa_inv;
                        rubroInfo.IdProducto_inv   = item.IdProducto_inv;
                        rubroInfo.IdCentroCosto_ct = item.IdCentroCosto_ct;
                        rubroInfo.IdSede           = item.IdSede;
                        lista.Add(rubroInfo);
                    }
                }
                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 #9
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);
        }
Beispiel #10
0
        public Aca_Rubro_Info GetRubro(ref string mensaje)
        {
            Aca_Rubro_Info rInfo = new Aca_Rubro_Info();

            try
            {
                rInfo.IdInstitucion       = param.IdInstitucion;
                rInfo.IdRubro             = (txtIdRubro.Text != "") ? Convert.ToInt32(txtIdRubro.Text) : 0;
                rInfo.Descripcion_rubro   = txtDescripcionRubro.Text;
                rInfo.Deb_cred            = cmbDebeHaber.EditValue.ToString();
                rInfo.CodRubro            = txtCodigoRubro.Text;
                rInfo.IdGrupoFE           = Convert.ToInt16(cmbFEE.EditValue.ToString());
                rInfo.CodAlterno          = string.Empty;
                rInfo.IdTipoServicio      = cmbTipoServicio.EditValue.ToString();
                rInfo.IdTipoRubro         = Convert.ToInt16(cmbTipoRubro.EditValue.ToString());
                rInfo.NumeroCoutas        = 0;
                rInfo.UsuarioCreacion     = param.IdUsuario;
                rInfo.UsuarioModificacion = param.IdUsuario;
                rInfo.IdCtaCble           = ucCon_Plan_de_Cuenta_x_Movimiento1.get_CuentaInfo().IdCtaCble;
                rInfo.IdProducto_inv      = ucIn_ProductoCmb1.get_ProductoInfo().IdProducto;
                rInfo.IdEmpresa_inv       = ucIn_ProductoCmb1.get_ProductoInfo().IdEmpresa;
                rInfo.IdCentroCosto_ct    = ucCon_CentroCosto_ctas_Movi1.Get_IdCentroCosto();
                //rInfo.IdCentroCosto_ct = ucCon_CentroCosto_ctas_Movi1.Get_IdCentroCosto();
                rInfo.IdEmpresa_ct = param.IdEmpresa;

                if (Accion == Cl_Enumeradores.eTipo_action.grabar)
                {
                    chkActivo.Checked = true;
                }

                rInfo.estado = (chkActivo.Checked == true) ? "A" : "I";
                if (chkActivo.Checked)
                {
                    lblAnulado.Visible = false;
                }
                else
                {
                    lblAnulado.Visible = true;
                }
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
                mensaje = ex.Message.ToString();
                MessageBox.Show("Error " + mensaje, param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(rInfo);
        }
Beispiel #11
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);
        }
Beispiel #12
0
        public bool ActualizarDB(Aca_Rubro_Info info, ref string mensaje)
        {
            try
            {
                using (Entities_Academico Base = new Entities_Academico())
                {
                    var vRubro = Base.Aca_Rubro.FirstOrDefault(j => j.IdRubro == info.IdRubro);
                    if (vRubro != null)
                    {
                        vRubro.IdInstitucion = info.IdInstitucion;
                        //vRubro.CodRubro = string.IsNullOrEmpty(info.CodRubro) ? info.IdRubro.ToString() : info.CodRubro == "0" ? info.IdRubro.ToString() : info.CodRubro;
                        //vRubro.CodAlterno = string.IsNullOrEmpty(info.CodAlterno) ? "" : info.CodAlterno.ToString();
                        vRubro.Descripcion_rubro   = info.Descripcion_rubro;
                        vRubro.IdGrupoFE           = info.IdGrupoFE;
                        vRubro.deb_cred            = info.Deb_cred;
                        vRubro.IdTipoRubro         = info.IdTipoRubro;
                        vRubro.IdTipoServicio_cata = info.IdTipoServicio;

                        vRubro.IdCtaCble           = info.IdCtaCble;
                        vRubro.UsuarioModificacion = info.UsuarioModificacion;
                        vRubro.FechaModificacion   = DateTime.Now;
                        vRubro.estado           = info.estado;
                        vRubro.IdProducto_inv   = info.IdProducto_inv;
                        vRubro.IdCentroCosto_ct = info.IdCentroCosto_ct;
                        vRubro.IdEmpresa_ct     = info.IdEmpresa_ct;
                        vRubro.IdSede           = info.IdSede;

                        //vRubro.IdEmpresa_inv = info.IdEmpresa_inv;
                        Base.SaveChanges();
                        mensaje = "Se ha procedido actualizar el Rubro #: " + info.IdRubro.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);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                mensaje = ex.InnerException + " " + ex.Message;
                throw new Exception(ex.ToString());
            }
        }
Beispiel #13
0
        public bool ActualizarDB(Aca_Rubro_Info info, ref string mensaje)
        {
            bool resultado = false;

            try
            {
                resultado = da.ActualizarDB(info, ref mensaje);
                return(resultado);
            }
            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("", "ActualizarDB", ex.Message), ex)
                      {
                          EntityType = typeof(Aca_Rubro_Bus)
                      };
            }
        }
Beispiel #14
0
        public bool GrabarDB(Aca_Rubro_Info info, ref int idRubro, ref string mensaje)
        {
            try
            {
                using (Entities_Academico Base = new Entities_Academico())
                {
                    Aca_Rubro addressRubro = new Aca_Rubro();
                    idRubro = GetId();
                    addressRubro.IdRubro             = idRubro;
                    addressRubro.IdInstitucion       = info.IdInstitucion;
                    addressRubro.CodRubro            = string.IsNullOrEmpty(info.CodRubro) ? idRubro.ToString():info.CodRubro;
                    addressRubro.CodAlterno          = string.IsNullOrEmpty(info.CodAlterno)?"":info.CodAlterno.ToString();
                    addressRubro.Descripcion_rubro   = info.Descripcion_rubro;
                    addressRubro.IdTipoRubro         = info.IdTipoRubro;
                    addressRubro.estado              = info.estado;
                    addressRubro.deb_cred            = info.Deb_cred;
                    addressRubro.IdTipoServicio_cata = info.IdTipoServicio;
                    addressRubro.IdCtaCble           = info.IdCtaCble;
                    addressRubro.IdGrupoFE           = info.IdGrupoFE;
                    addressRubro.FechaCreacion       = DateTime.Now;
                    addressRubro.UsuarioCreacion     = info.UsuarioCreacion;
                    addressRubro.IdEmpresa_inv       = info.IdEmpresa_inv;
                    addressRubro.IdProducto_inv      = info.IdProducto_inv;
                    addressRubro.IdEmpresa_ct        = info.IdEmpresa_ct;
                    addressRubro.IdCentroCosto_ct    = info.IdCentroCosto_ct;
                    addressRubro.IdSede              = info.IdSede;
                    Base.Aca_Rubro.Add(addressRubro);

                    Base.SaveChanges();
                    mensaje = "Se ha procedido a grabar el Rubro #: " + idRubro.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);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                mensaje = ex.InnerException + " " + ex.Message;
                throw new Exception(ex.ToString());
            }
        }
Beispiel #15
0
 public Aca_Rubro_Info Get_Info_Rubro_x_Producto(decimal IdProducto)
 {
     try
     {
         Aca_Rubro_Info rubroInfo = new Aca_Rubro_Info();
         using (Entities_Academico Base = new Entities_Academico())
         {
             var rubro = from r in Base.Aca_Rubro
                         where r.IdProducto_inv == IdProducto
                         orderby r.IdRubro
                         select r;
             foreach (var item in rubro)
             {
                 rubroInfo.IdInstitucion     = item.IdInstitucion;
                 rubroInfo.IdRubro           = item.IdRubro;
                 rubroInfo.Descripcion_rubro = item.Descripcion_rubro;
                 rubroInfo.Deb_cred          = item.deb_cred;
                 //rubroInfo.CodRubro = item.CodRubro;
                 rubroInfo.CodRubro         = "[" + item.CodRubro + "]" + item.Descripcion_rubro;
                 rubroInfo.CodAlterno       = item.CodAlterno;
                 rubroInfo.IdTipoServicio   = item.IdTipoServicio_cata;
                 rubroInfo.IdTipoRubro      = item.IdTipoRubro;
                 rubroInfo.IdGrupoFE        = item.IdGrupoFE;
                 rubroInfo.NumeroCoutas     = item.Num_coutas;
                 rubroInfo.estado           = item.estado;
                 rubroInfo.IdCtaCble        = item.IdCtaCble;
                 rubroInfo.IdEmpresa_inv    = item.IdEmpresa_inv;
                 rubroInfo.IdProducto_inv   = item.IdProducto_inv;
                 rubroInfo.IdCentroCosto_ct = item.IdCentroCosto_ct;
             }
         }
         return(rubroInfo);
     }
     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 #16
0
        public Aca_Rubro_Info GetRubro(ref string mensaje)
        {
            Aca_Rubro_Info rInfo = new Aca_Rubro_Info();

            try
            {
                rInfo = ucAca_Rubro1.get_item_info();
                //rInfo.IdInstitucion = param.IdInstitucion;
                //rInfo.IdRubro = (txtIdRubro.Text != "") ? Convert.ToInt32(txtIdRubro.Text) : 0;
                //rInfo.IdRubro = (txtIdRubro.Text != "") ? Convert.ToInt32(txtIdRubro.Text) : 0;

                //rInfo.Descripcion_rubro = txtDescripcionRubro.Text;
                //rInfo.Deb_cred =  cmbDebeHaber.EditValue.ToString();
                //rInfo.CodRubro = txtCodigoRubro.Text;
                //rInfo.IdGrupoFE = Convert.ToInt16(cmbFEE.EditValue.ToString());
                //rInfo.CodAlterno = string.Empty;
                //rInfo.IdTipoServicio = cmbTipoServicio.EditValue.ToString();
                //rInfo.IdTipoRubro = Convert.ToInt16(cmbTipoRubro.EditValue.ToString());
                //rInfo.NumeroCoutas = 0;
                //rInfo.UsuarioCreacion = param.IdUsuario;
                //rInfo.UsuarioModificacion = param.IdUsuario;
                //rInfo.IdCtaCble = ucCon_Plan_de_Cuenta_x_Movimiento1.get_CuentaInfo().IdCtaCble;
                //if (Accion == Cl_Enumeradores.eTipo_action.grabar)
                //{
                //    chkActivo.Checked = true;
                //}

                //rInfo.estado = (chkActivo.Checked == true) ? "A" : "I";
                //if (chkActivo.Checked)
                //{
                //    lblAnulado.Visible = false;
                //}
                //else { lblAnulado.Visible = true; }

                //Get_List_Rubro_x_Periodo();
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
                mensaje = ex.Message.ToString();
                MessageBox.Show("Error " + mensaje, "Sistemas", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(rInfo);
        }
Beispiel #17
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);
        }