示例#1
0
        public void AdvanceState(GUIState state) //-------------------***********************************************
        {
            MainSelection.state = state;
            switch (MainSelection.state)
            {
            case GUIState.AppExit:
                MongoDBController.shutdown();
                break;

            case GUIState.AppStart:     //----------------------------------------------------------------------------

                txtEmpTipo.Items.Clear();
                txtEmpTipo.Items.AddRange(new object[] {
                    EmpType.Cliente, EmpType.Proveedor
                });
                cbFiltro.SelectedIndex = 0;     //set filtro default
                cbMainTipo.Items.Clear();
                cbMainTipo.Items.AddRange(new object[] {
                    EmpType.Cliente, EmpType.Proveedor
                });
                cbMainTipo.SelectedIndex = 0;     //set tipo default
                updateListaEmpresas();

                tabDetalle.Enabled   = false;
                tabEmpresa.Enabled   = false;
                tabDocumento.Enabled = false;

                tabResumen_Toggle(false);
                AdvanceState(GUIState.BusquedaEmpresa);

                break;

            case GUIState.BusquedaEmpresa:     //----------------------------------------------------------------------------
                updateListaEmpresas();
                tabDetalle.Text   = "";
                tabEmpresa.Text   = "";
                tabDocumento.Text = "";
                tabBusqueda.Text  = "Busqueda";
                tabResumen_Toggle(false);
                tabControMainMain.SelectTab(tabBusqueda);
                break;

            case GUIState.EmpresaSeleccionada:     //----------------------------------------------------------------------------
                tabDetalle.Text   = "";
                tabEmpresa.Text   = "";
                tabDocumento.Text = "";
                tabBusqueda.Text  = "Busqueda";
                tabControMainMain.SelectTab(tabBusqueda);
                tabResumen_Toggle(true);
                Emp em = (Emp)lbEmp.SelectedItem;
                if (em != null)
                {
                    MainSelection.emp   = em;
                    lResumenNombre.Text = em.name;

                    //Carga detalle
                    lvDetalle.Items.Clear();
                    foreach (Doc d in em.docs)
                    {
                        ListViewItem item = new ListViewItem(d.fecha.ToShortDateString());
                        item.SubItems.Add(d.type.descripcion, Color.LightBlue, Color.LawnGreen, lvDetalle.Font);
                        item.SubItems.Add(d.importe.ToString(), Color.LightBlue, Color.LawnGreen, lvDetalle.Font);
                        item.SubItems.Add("", Color.LightBlue, Color.LawnGreen, lvDetalle.Font);
                        item.SubItems.Add(d.observacion, Color.LightBlue, Color.LawnGreen, lvDetalle.Font);
                        lvDetalle.Items.Add(item);
                    }
                }

                break;

            case GUIState.EmpresaAlta:     //----------------------------------------------------------------------------
                txtEmpId.Text               = "";
                txtEmpName.Text             = "";
                txtAddress.Text             = "";
                txtPhones.Text              = "";
                txtContactoAlternativo.Text = "";
                txtCUIL.Text             = "";
                txtDeParteDe.Text        = "";
                txtEmpTipo.SelectedIndex = 1;
                btnEmpGuardar.Enabled    = true;
                btnEmpEliminar.Enabled   = true;
                btnEmpEliminar.Text      = "Cancelar";
                tabBusqueda.Text         = "";
                tabEmpresa.Text          = "Empresa";
                tabEmpresa.Enabled       = true;
                tabControMainMain.SelectTab(tabEmpresa);
                break;

            case GUIState.EmpresaModi:     //----------------------------------------------------------------------------
                txtEmpId.Text               = MainSelection.emp._id.ToString();
                txtAddress.Text             = MainSelection.emp.addresses;
                txtPhones.Text              = MainSelection.emp.phones;
                txtContactoAlternativo.Text = MainSelection.emp.contactoAlternativo;
                txtCUIL.Text      = MainSelection.emp.cuil;
                txtDeParteDe.Text = MainSelection.emp.deParteDe;
                //
                txtEmpName.Text = MainSelection.emp.name.ToString();
                for (int x = 0; x < txtEmpTipo.Items.Count; x++)
                {
                    EmpType t = (EmpType)txtEmpTipo.Items[x];
                    if (t != null && t._id == MainSelection.emp.type._id)
                    {
                        txtEmpTipo.SelectedIndex = x;
                    }
                }
                btnEmpGuardar.Enabled  = true;
                btnEmpEliminar.Enabled = true;
                btnEmpEliminar.Text    = "Eliminar";
                tabBusqueda.Text       = "";
                tabEmpresa.Text        = "Empresa";
                tabEmpresa.Enabled     = true;
                tabControMainMain.SelectTab(tabEmpresa);
                break;
            }
        }
示例#2
0
 public UpdateDatabaseSystem(Contexts contexts) : base(contexts.game)
 {
     db = GameObject.FindObjectOfType <MongoDBController>();
 }
示例#3
0
 public LoadGameSystem(Contexts contexts)
 {
     _contexts = contexts;
     db        = GameObject.FindObjectOfType <MongoDBController>();
 }