예제 #1
0
        public void get_InfoSede()
        {
            try
            {
                if (cmbSede.EditValue != null && cmbSede.EditValue != "")
                {
                    //Aca_Jornada_Bus negJornada = new Aca_Jornada_Bus();
                    //cmbJornada.Properties.DataSource = negJornada.Get_List_Jornada(param.IdInstitucion, Convert.ToInt16(cmbSede.EditValue));
                    //listSucursal = BusSucu.Get_List_Sucursal(param.IdEmpresa);
                    listPuntoVta = BusPtoVta.Get_List_PuntoVta(param.IdEmpresa);
                    ListInfoSede = BusSede.Get_List_Sede(param.IdInstitucion);

                    InfoSede = (Aca_Sede_Info)(ListInfoSede.FirstOrDefault(v => v.IdSede == Convert.ToInt32(cmbSede.EditValue)));


                    //Info_Sucursal = (tb_Sucursal_Info)(listSucursal.FirstOrDefault(v => v.IdSucursal == Convert.ToInt32(cmbSede.EditValue)));

                    if (InfoSede != null)
                    {
                        cargar_PtoVta_en_Combo(Convert.ToInt16(InfoSede.IdEmpresa), Convert.ToInt16(InfoSede.IdSucursal));
                        //Event_cmb_sucursal_EditValueChanged(sender, e);
                    }



                    //cmb_PtoVta.Properties.DataSource = listPuntoVta;
                }
            }
            catch (Exception ex)
            {
                string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name;
                MessageBox.Show(NameMetodo + " - " + ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString());
            }
        }
예제 #2
0
        public Boolean AnularDB(Aca_Sede_Info info, ref string msg)
        {
            try
            {
                using (Entities_Academico context = new Entities_Academico())
                {
                    var address = context.Aca_Sede.FirstOrDefault(a => a.IdInstitucion == info.IdInstitucion && a.IdSede == info.IdSede);

                    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 la Sede #: " + info.IdSede.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());
            }
        }
예제 #3
0
        public void Grabar()
        {
            try
            {
                Aca_Sede_Info infoSede = new Aca_Sede_Info();

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

                infoSede = GetSede(ref mensaje);
                Aca_Sede_Bus neg       = new Aca_Sede_Bus();
                bool         resultado = neg.GrabarDB(infoSede, ref id, ref mensaje);
                txtIdSede.Text = id.ToString();

                if (resultado == true)
                {
                    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);
                }
            }
            catch (Exception ex)
            {
                string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name;
                NameMetodo = NameMetodo + " - " + ex.ToString();
                Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString());
                MessageBox.Show(NameMetodo + " " + param.Get_Mensaje_sys(enum_Mensajes_sys.Error_comunicarse_con_sistemas)
                                , param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #4
0
        void FormaSede(Cl_Enumeradores.eTipo_action Accion)
        {
            try
            {
                FrmAcaSede_Mant frm      = new FrmAcaSede_Mant();
                Aca_Sede_Info   infoSede = new Aca_Sede_Info();
                infoSede.IdInstitucion = infoVistaTree.IdInstitucion == null ? 0 : Convert.ToInt16(infoVistaTree.IdInstitucion);

                if (Accion != Cl_Enumeradores.eTipo_action.grabar)
                {
                    infoSede.IdSede = infoVistaTree.IdSede == null ? 0 : Convert.ToInt16(infoVistaTree.IdSede);
                    //infoSede.IdSucursal = listSucursal.FirstOrDefault(v => v.IdSucursal == Convert.ToInt32(cmbsucursal.EditValue));
                    infoSede.DescripcionSede = infoVistaTree.Nombre;
                    infoSede.Estado          = infoVistaTree.Estado;
                }

                frm.set_Sede(infoSede);
                frm.set_Accion(Accion);
                frm.Show();
                frm.event_FrmAcaSede_Mant_FormClosing += new FrmAcaSede_Mant.delegate_FrmAcaSede_Mant_FormClosing(frm_event_FrmAcaSede_Mant_FormClosing);
            }
            catch (Exception)
            {
                throw;
            }
        }
예제 #5
0
        private void Anular()
        {
            try
            {
                if (SedeInfo.Estado != "I")
                {
                    if (MessageBox.Show(param.Get_Mensaje_sys(enum_Mensajes_sys.Está_seguro_que_desea_anular_la) + " Sede #:" + txtIdSede.Text.Trim() + " ?", param.Nombre_sistema, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        FrmGe_MotivoAnulacion fr = new FrmGe_MotivoAnulacion();
                        fr.ShowDialog();

                        Aca_Sede_Bus  neg     = new Aca_Sede_Bus();
                        Aca_Sede_Info sedInfo = new Aca_Sede_Info();
                        string        mensaje = string.Empty;

                        sedInfo = GetSede(ref mensaje);
                        if (mensaje != "")
                        {
                            MessageBox.Show(mensaje, param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                        sedInfo.UsuarioAnulacion = param.IdUsuario;
                        sedInfo.MotivoAnulacion  = fr.motivoAnulacion;
                        bool resultado = neg.EliminarDB(sedInfo, 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(param.Get_Mensaje_sys(enum_Mensajes_sys.Error_encontrado) + ":" + mensaje, param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                }
                else
                {
                    MessageBox.Show("La sede #:" + txtIdSede.Text.Trim() + param.Get_Mensaje_sys(enum_Mensajes_sys.Ya_se_encuentra_anulada), param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name;
                NameMetodo = NameMetodo + " - " + ex.ToString();
                Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString());
                MessageBox.Show(NameMetodo + " " + param.Get_Mensaje_sys(enum_Mensajes_sys.Error_comunicarse_con_sistemas)
                                , param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #6
0
        private void nuevaSedeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FrmAcaSede_Mant frm      = new FrmAcaSede_Mant();
            Aca_Sede_Info   infoSede = new Aca_Sede_Info();

            infoSede.IdInstitucion =
                infoSede.IdSede    = infoVistaTree.IdSede == null ? 0 : Convert.ToInt16(infoVistaTree.IdSede);
            infoSede.IdInstitucion = infoVistaTree.IdInstitucion == null ? 0 : Convert.ToInt16(infoVistaTree.IdInstitucion);

            frm.set_Sede(infoSede);
            frm.set_Accion(Cl_Enumeradores.eTipo_action.grabar);
            frm.Show();
            frm.event_FrmAcaSede_Mant_FormClosing += new FrmAcaSede_Mant.delegate_FrmAcaSede_Mant_FormClosing(frm_event_FrmAcaSede_Mant_FormClosing);
        }
예제 #7
0
 public bool EliminarDB(Aca_Sede_Info info, ref string mensaje)
 {
     try
     {
         return(da.AnularDB(info, ref mensaje));
     }
     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("", "EliminarDB", ex.Message), ex)
               {
                   EntityType = typeof(Aca_Sede_Bus)
               };
     }
 }
예제 #8
0
 public void set_Sede(Aca_Sede_Info info)
 {
     try
     {
         SedeInfo = info;
     }
     catch (Exception ex)
     {
         string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name;
         NameMetodo = NameMetodo + " - " + ex.ToString();
         Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString());
         MessageBox.Show(NameMetodo + " " + param.Get_Mensaje_sys(enum_Mensajes_sys.Error_comunicarse_con_sistemas)
                         , param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
예제 #9
0
        public List <Aca_Sede_Info> Get_List_Sede(int IdInstitucion)
        {
            List <Aca_Sede_Info> listaSede = new List <Aca_Sede_Info>();
            Aca_Sede_Info        infoSede;

            try
            {
                using (Entities_Academico Base = new Entities_Academico())
                {
                    var vSede = from s in Base.vwAca_Sede_Sucursal
                                where s.IdInstitucion == IdInstitucion
                                select s;


                    foreach (var item in vSede)
                    {
                        infoSede = new Aca_Sede_Info();
                        infoSede.IdInstitucion            = item.IdInstitucion;
                        infoSede.IdSede                   = item.IdSede;
                        infoSede.DescripcionSede          = item.Descripcion_sede;
                        infoSede.CodAlterno               = item.CodAlterno;
                        infoSede.Estado                   = item.estado;
                        infoSede.IdEmpresa                = item.IdEmpresa;
                        infoSede.IdSucursal               = item.IdSucursal;
                        infoSede.Su_Descripcion           = item.Su_Descripcion;
                        infoSede.Su_CodigoEstablecimiento = item.Su_CodigoEstablecimiento;
                        listaSede.Add(infoSede);
                    }
                }
                return(listaSede);
            }
            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());
            }
        }
예제 #10
0
        public Aca_Sede_Info GetSede(ref string mensaje)
        {
            try
            {
                SedeInfo = new Aca_Sede_Info();
                SedeInfo.IdInstitucion       = IdInstitucion;
                SedeInfo.IdSede              = string.IsNullOrEmpty(txtIdSede.Text) ? 0 : Convert.ToInt16(txtIdSede.Text);
                SedeInfo.CodSede             = string.IsNullOrEmpty(txtCodigoSede.Text) ? SedeInfo.IdSede.ToString() : txtCodigoSede.Text.Trim();
                SedeInfo.DescripcionSede     = txtDescripcion.Text.Trim();
                SedeInfo.IdInstitucion       = Convert.ToInt16(cmbInstitucion.EditValue);
                SedeInfo.UsuarioModificacion = param.IdUsuario;
                SedeInfo.UsuarioCreacion     = param.IdUsuario;
                SedeInfo.UsuarioAnulacion    = param.IdUsuario;
                SedeInfo.IdEmpresa           = param.IdEmpresa;
                SedeInfo.IdSucursal          = ucGe_Sucursal_combo1.Get_IdSucursal();


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

                SedeInfo.Estado = (chkActivo.Checked == true) ? "A" : "I";
                if (chkActivo.Checked)
                {
                    lblAnulado.Visible = false;
                }
                else
                {
                    lblAnulado.Visible = true;
                }
            }
            catch (Exception ex)
            {
                string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name;
                NameMetodo = NameMetodo + " - " + ex.ToString();
                Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString());
                MessageBox.Show(NameMetodo + " " + param.Get_Mensaje_sys(enum_Mensajes_sys.Error_comunicarse_con_sistemas)
                                , param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            return(SedeInfo);
        }
예제 #11
0
        public bool GrabarDB(Aca_Sede_Info info, ref int IdSede, ref string mensaje)
        {
            try
            {
                using (Entities_Academico Base = new Entities_Academico())
                {
                    Aca_Sede addressSede = new Aca_Sede();
                    IdSede                          = GetId(info.IdInstitucion);
                    addressSede.IdSede              = IdSede;
                    addressSede.IdInstitucion       = info.IdInstitucion;
                    addressSede.CodSede             = string.IsNullOrEmpty(info.CodSede) ? IdSede.ToString() : info.CodSede == "0"?IdSede.ToString():info.CodSede;
                    addressSede.CodAlterno          = string.IsNullOrEmpty(info.CodAlterno) ? "" : info.CodAlterno;
                    addressSede.Descripcion_sede    = info.DescripcionSede.Trim();
                    addressSede.estado              = info.Estado.Trim();
                    addressSede.FechaCreacion       = DateTime.Now;
                    addressSede.FechaModificacion   = DateTime.Now;
                    addressSede.UsuarioCreacion     = info.UsuarioCreacion.Trim();
                    addressSede.UsuarioModificacion = info.UsuarioModificacion.Trim();
                    addressSede.IdEmpresa           = info.IdEmpresa;
                    addressSede.IdSucursal          = info.IdSucursal;

                    Base.Aca_Sede.Add(addressSede);
                    Base.SaveChanges();
                    mensaje = "Se ha procedido a grabar la Sede #: " + IdSede.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());
            }
        }
예제 #12
0
        public bool ActualizarDB(Aca_Sede_Info info, ref string mensaje)
        {
            try
            {
                using (Entities_Academico Base = new Entities_Academico())
                {
                    var vSede = Base.Aca_Sede.FirstOrDefault(j => j.IdInstitucion == info.IdInstitucion && j.IdSede == info.IdSede);

                    if (vSede != null)
                    {
                        vSede.CodSede             = string.IsNullOrEmpty(info.CodSede) ? info.IdSede.ToString() : info.CodSede.Trim();
                        vSede.CodAlterno          = string.IsNullOrEmpty(info.CodAlterno) ? "" : info.CodAlterno.Trim();
                        vSede.Descripcion_sede    = info.DescripcionSede.Trim();
                        vSede.estado              = info.Estado.Trim();
                        vSede.FechaModificacion   = DateTime.Now;
                        vSede.UsuarioModificacion = info.UsuarioModificacion;
                        vSede.IdEmpresa           = info.IdEmpresa;
                        vSede.IdSucursal          = info.IdSucursal;

                        Base.SaveChanges();
                        mensaje = "Se ha procedido actualizar la Sede #: " + info.IdSede.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.InnerException.ToString());
            }
        }