예제 #1
0
        void SubmitUpdate()
        {
            CheckForIllegalCrossThreadCalls = false;

            this._inAction = true;
            this._tBranch_Old = this._tBranch;
            this._cBranch.Data = this._tBranch;

            if ( this._cBranch.Modify() )
            {
                this.pgsLoading.Visible = false;
                this.panelMain.Enabled = true;

                MetroMessageBox.Show( this, "Se ha Modificado la sucursal", "Muy Bien", MessageBoxButtons.OK, MessageBoxIcon.Question );

                DataRow[] row = this._data.Tables["Sucursal"].Select( "Codigo=" + this._tBranch.Codigo );

                row[0]["Address"] = this._tBranch.Address;
                row[0]["IsMain"] = this._tBranch.IsMain;
                row[0]["LocalCode"] = this._tBranch.LocalCode;
                row[0]["ModifiedDate"] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");

                this.ResetControls();
            }
            else
            {
                this.pgsLoading.Visible = false;
                this._inAction = false;
                this.panelMain.Enabled = true;
                MetroMessageBox.Show( this, this._cBranch.ExceptionHistory, "Error al Modificar", MessageBoxButtons.OK, MessageBoxIcon.Error );
            }

            this._inAction = false;
            this._hilo.Abort();
        }
예제 #2
0
        void ResetControls()
        {
            this.txtDireccion.Clear();
            this.chboPrincipal.Checked = false;
            this.cboDepartamento.SelectedIndex = -1;
            this.cboDepartamento_SelectionChangeCommitted( this.cboDepartamento, EventArgs.Empty );
            this.txtCodigoLocal.Clear();
            this.txtTelefono.Clear();
            this.txtEmail.Clear();
            this.txtLatitud.Clear();
            this.txtLongitud.Clear();
            this.nudZoom.Value = 13;

            this._submitInsert = false;
            this._tBranch = new tBranch();
            this._inAction = false;

            this.panelRegistro.Enabled = false;
            this.panelListado.Enabled = true;
            this.tabControl.SelectedIndex = 0;
        }
예제 #3
0
        void SubmitInsert()
        {
            CheckForIllegalCrossThreadCalls = false;

            this._inAction = true;
            this._tBranch_Old = this._tBranch;
            this._tBranch = this._cBranch.Insert();

            if ( this._tBranch == null )
            {
                pgsLoading.Visible = false;
                this.panelMain.Enabled = true;
                this._tBranch = this._tBranch_Old;
                MetroMessageBox.Show(this, "Error al intentar Guardar: \n" + this._cBranch.ExceptionHistory, "ERROR!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                this.pgsLoading.Visible = false;
                this.panelMain.Enabled = true;

                object[] temp = new object[6]
                {
             					this._tBranch.Codigo,
                    this._tBranch.Address,
                    this._tBranch.IsMain,
                    this._tBranch.LocalCode,
                    DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                    this._tBranch.Codigo + "-" + this._tBranch.Address
                };

                this._data.Tables["Sucursal"].Rows.Add(temp);

                MetroMessageBox.Show( this, "Se ha Registrado una nueva Sucursal", "Muy bien!", MessageBoxButtons.OK, MessageBoxIcon.Question );

                this.ResetControls();
            }

            this._hilo.Abort();
        }
예제 #4
0
        void FindBranch()
        {
            CheckForIllegalCrossThreadCalls = false;

            this._inAction = true;
            this._tBranch_Old = this._tBranch;

            this._tBranch = this._cBranch.Find( this._codigoBranch );

            if ( this._tBranch == null )
            {
                pgsLoading.Visible = false;
                this.panelMain.Enabled = true;
                this._tBranch = this._tBranch_Old;
                MetroMessageBox.Show( this, this._cBranch.ExceptionHistory, "Error al Modificar", MessageBoxButtons.OK, MessageBoxIcon.Error );
            }
            else
            {
                pgsLoading.Visible = false;
                this.RestoreData();
            }

            this._inAction = false;
            this._hilo.Abort();
        }