Beispiel #1
0
        private void button7_Click(object sender, EventArgs e)
        {
            try
            {
                SqlCommandBuilder builder = new SqlCommandBuilder(adapter);
                bs.EndEdit();
                adapter.Update(ds, "Automobile");

                dataGridView.DataSource = bs;
                button5.Enabled         = true;
            }
            catch (FormatException ex)
            {
                MessageBox.Show(ex.Message + " data not save", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                bs.CancelEdit();
                button5.Enabled = true;
            }
            catch (System.Data.SqlClient.SqlException ex)
            {
                MessageBox.Show(ex.Message + " data not save", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                //DataTable dt = this.dataGridView.DataSource as DataTable;
                //dt.RejectChanges();
                bs.CancelEdit();
            }
            records();
        }
Beispiel #2
0
        // FECHAR FORM
        //------------------------------------------------------------------------------------------------------------
        private void btnFechar_Click(object sender, EventArgs e)
        {
            if (Sit == EnumFlagEstado.NovoRegistro)
            {
                AbrirDialog("Esse registro ainda não foi salvo... \n" +
                            "Favor SALVAR ou CANCELAR a edição do registro atual antes de fechar.",
                            "Registro Novo", DialogType.OK, DialogIcon.Exclamation);
                return;
            }
            else if (Sit == EnumFlagEstado.Alterado)
            {
                AbrirDialog("Esse registro de Transferência não pode ser alterado... \n" +
                            "O formulário será fechado, e não será salvo.",
                            "Registro Alterado", DialogType.OK, DialogIcon.Exclamation);
                bind.CancelEdit();
                Sit = EnumFlagEstado.RegistroSalvo;
            }

            if (_formOrigem == null)
            {
                new frmTransfSetorListagem().Show();
            }

            Close();
        }
        // CANCELAR ALTERACAO
        //------------------------------------------------------------------------------------------------------------
        private void btnCancelar_Click(object sender, EventArgs e)
        {
            if (Sit == EnumFlagEstado.NovoRegistro)
            {
                var response = AbrirDialog("Deseja cancelar a inserção de um novo registro?",
                                           "Cancelar", DialogType.SIM_NAO, DialogIcon.Question);

                if (response == DialogResult.Yes)
                {
                    if (bind.Count == 1)
                    {
                        Close();

                        if (_formOrigem != null && _formOrigem.GetType() == typeof(frmPrincipal))
                        {
                            MostraMenuPrincipal();
                        }
                    }
                    else
                    {
                        bind.CancelEdit();
                    }
                }
            }
            else if (Sit == EnumFlagEstado.Alterado)
            {
                bind.CancelEdit();
                Sit = EnumFlagEstado.RegistroSalvo;
            }
            else
            {
                Sit = EnumFlagEstado.RegistroSalvo;
            }
        }
Beispiel #4
0
        private void GridVenda_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
            int IdEntregador = 0;

            if (e.ColumnIndex == 7)
            {
                IdEntregador = int.Parse(GridVenda.CurrentRow.Cells[7].Value.ToString());
                GridVenda.CurrentRow.Cells[9].Value = DateTime.Now.Date.ToShortDateString();
            }
            else if (e.ColumnIndex == 8)
            {
                IdEntregador = int.Parse(GridVenda.CurrentRow.Cells[8].Value.ToString());
                GridVenda.CurrentRow.Cells[9].Value = DateTime.Now.Date.ToShortDateString();
            }
            else if (e.ColumnIndex == 9)
            {
                IdEntregador = int.Parse(GridVenda.CurrentRow.Cells[7].Value.ToString());
                DateTime Dt   = DateTime.Parse(GridVenda.CurrentCell.Value.ToString());
                DateTime DtVd = DateTime.Parse(GridVenda.CurrentRow.Cells[2].Value.ToString());
                if (Dt.Date < DtVd.Date)
                {
                    MessageBox.Show("Previsão de Entrega não pode ser inferior a data da venda", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    Source_Venda.CancelEdit();
                    IdEntregador = 0;
                }
                else if (IdEntregador == 0)
                {
                    MessageBox.Show("Entregador não informado", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    Source_Venda.CancelEdit();
                    IdEntregador = 0;
                }
            }
            Controles.Verificar ExisteEntregador = new Controles.Verificar();
            ExisteEntregador.Controle = Controle;
            DateTime DtEntrega = DateTime.Parse(GridVenda.CurrentRow.Cells[9].Value.ToString());

            if (ExisteEntregador.Verificar_ExisteCadastro("Id_Entregador", "SELECT * FROM ENTREGADORES WHERE ID_ENTREGADOR=" + IdEntregador.ToString()) > 0 || IdEntregador == 0)
            {
                Controle.ExecutaSQL("Update MvVenda set Id_Entregador=" + IdEntregador.ToString() + ",PREVENTREGA=Convert(DateTime,'" + DtEntrega.ToShortDateString() + "',103)  Where Id_Venda=" + GridVenda.CurrentRow.Cells[0].Value.ToString());
                GridVenda.CurrentRow.Cells[7].Value = IdEntregador.ToString();
                GridVenda.CurrentRow.Cells[8].Value = IdEntregador.ToString();
                //Registrando Movimento de Auditoria
                if (IdEntregador > 0)
                {
                    FrmPrincipal.RegistrarAuditoria(this.Text, int.Parse(GridVenda.CurrentRow.Cells[0].Value.ToString()), GridVenda.CurrentRow.Cells[3].Value.ToString(), 7, "Mapa do Entregador: " + IdEntregador.ToString() + " Prev.Entrega" + DtEntrega.ToShortDateString());
                }
                else
                {
                    FrmPrincipal.RegistrarAuditoria(this.Text, int.Parse(GridVenda.CurrentRow.Cells[0].Value.ToString()), GridVenda.CurrentRow.Cells[3].Value.ToString(), 7, "Retirando do Mapa de Entrega");
                }
            }
            else
            {
                MessageBox.Show("Código do entregador não existe", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            //PopularGridVenda();
            GridVenda.CurrentCell = GridVenda.CurrentRow.Cells[e.ColumnIndex];
        }
Beispiel #5
0
 // Cancel the current action (adding, editing)
 private void btnCancel_Click(object sender, EventArgs e)
 {
     bindingSource.CancelEdit();
     if (btnSave.Visible)
     {
         DisconnectTable();
         this.frmHoliday_Load(sender, e);
     }
     ClearBindings();
     AddBindings();
 }
Beispiel #6
0
 private void GridDados_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
 {
     if (e.ColumnIndex == 1)
     {
         DateTime Dt = DateTime.Parse(GridDados.CurrentCell.Value.ToString());
         if (Dt.Date < TxtDtBase.Value.Date)
         {
             MessageBox.Show("Vencimento não pode ser inferior a data base", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Information);
             Source_Lanc.CancelEdit();
         }
     }
 }
Beispiel #7
0
 void f_Enregistrer(DataRowView dr, bool nouv)
 {
     if (nouv)
     {
         bs.EndEdit();
         ((DataTable)bs.DataSource).AcceptChanges();
     }
     else
     {
         bs.CancelEdit();
         (bs.DataSource as DataTable).RejectChanges();
     }
 }
 protected virtual void OnNewEvent()
 {
     if (OnNewButton())
     {
         masterBind.CancelEdit();
         masterBind.ResetCurrentItem();
         IsNew = true;
         OnNewData();
         OnAfterAddNew();
         DocumentMode = DBMode.Edit;
     }
     ManageToolbarEvents();
     FocusOnNew();
 }
Beispiel #9
0
        private void GridItemComodVinc_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
        {
            if (StaFormEdicao)
            {
                MessageBox.Show("Cadastro da Grade em edição", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Information);
                Source_ComodVinc.CancelEdit();
                e.Cancel = true;
            }

            if (Grade.IdGrade == 0)
            {
                Source_ComodVinc.CancelEdit();
                e.Cancel = true;
            }
        }
Beispiel #10
0
        private void GridItens_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
        {
            if (StaFormEdicao)
            {
                MessageBox.Show("Cadastro de Composição dos Produto em edição", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Information);
                Source_Itens.CancelEdit();
                e.Cancel = true;
            }

            if (CadProducao.IdProducao == 0)
            {
                Source_Itens.CancelEdit();
                e.Cancel = true;
            }
        }
Beispiel #11
0
        private void GridEventoFixo_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
        {
            if (StaFormEdicao)
            {
                MessageBox.Show("Cadastro do Funcionario em edição", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Information);
                Source_EventosFixo.CancelEdit();
                e.Cancel = true;
            }

            if (Func.IdFunc == 0)
            {
                Source_EventosFixo.CancelEdit();
                e.Cancel = true;
            }
        }
Beispiel #12
0
 private void btnUndo_Click(object sender, EventArgs e)
 {
     this.IsBusy = true;
     try
     {
         bindingSource1.CancelEdit();
         if ((this.EditState & EditState.Created) != 0)
         {
             this.BeginCreate();
         }
         else
         {
             var rm = Undo();
             if (rm.Result)
             {
                 this.EditState = EditState.Unchanged;
             }
             else
             {
                 Utility.ShowError(rm.Message, this);
             }
         }
     }
     finally
     {
         this.IsBusy = false;
     }
 }
Beispiel #13
0
        // Завершение редактирования
        public void EndEditB(bool bSave)
        {
            bEditMode = false;
            if (bSave)
            {
                bsB.EndEdit();
            }
            else
            {
                try
                {
                    if (bsB.Current != null)
                    {
                        ((DataRowView)bsB.Current).CancelEdit();
                    }
                    bsB.CancelEdit();
                }
                catch { }
            }

            bsB.ResetBindings(false);
            aEd.EditIsOver(this);

            if (dgBrak.Enabled)
            {
                dgBrak.Focus();
            }
            else
            {
                this.Close();
            }
        }
        private void TsbUserNewClick(object sender, EventArgs e)
        {
            using (UserForm userForm = new UserForm())
            {
                if (userForm.ShowDialog() == DialogResult.OK)
                {
                    DataRowView newUser = _bsUser.AddNew() as DataRowView;

                    if (userForm.tbPass.Text != string.Empty && userForm.tbPass.Text == userForm.tbConfirmPass.Text)
                    {
                        newUser["Name"] = userForm.tbName.Text;
                        newUser["Pass"] = userForm.tbPass.Text;

                        _bsUser.EndEdit();
                        _bsUser.ResetCurrentItem();

                        _bsUser.Position = 0;
                        int indx = _bsUser.IndexOf(newUser);
                        _bsUser.Position = indx;
                    }
                    else
                    {
                        MessageBox.Show("Senha inválida!", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        _bsUser.CancelEdit();
                    }
                }
            }
        }
Beispiel #15
0
 private void btnUndo_Click(object sender, EventArgs e)
 {
     this.IsBusy = true;
     try
     {
         dataGridView2.CancelEdit();
         bindingSource1.CancelEdit();
         bindingSource2.CancelEdit();
         if ((this.EditState & EditState.Created) != 0)
         {
             this.BeginCreate();
         }
         else
         {
             //var rm =
             Undo();
             //if (rm.Result == false)
             //{
             //    Utility.ShowError(rm.Message, this);
             //}
             //else
             //{
             this.EditState = EditState.Unchanged;
             //}
         }
     }
     finally
     {
         this.IsBusy = false;
     }
 }
        //--- MENU ALTERAR ITEM
        //------------------------------------------------------------------------------------------------------------
        private void mnuItemAlterar_Click(object sender, EventArgs e)
        {
            //--- check selected item
            if (dgvListagem.SelectedRows.Count == 0)
            {
                AbrirDialog("Favor selecionar um registro para Alterar...",
                            "Selecionar Registro", DialogType.OK, DialogIcon.Information);
                return;
            }

            unCheckListagem();

            //--- get Selected item
            objAReceber item = (objAReceber)dgvListagem.SelectedRows[0].DataBoundItem;

            frmAReceberAlterar frm = new frmAReceberAlterar(item, this);

            frm.ShowDialog();

            if (frm.DialogResult != DialogResult.OK)
            {
                bindRec.CancelEdit();
            }
            else
            {
                bindRec.EndEdit();
                // save persist DB
                SalvarRegistro(item);
                CalculaTotais();
            }
        }
Beispiel #17
0
        //取消
        protected virtual void CancelButton_Click(object sender, System.EventArgs e)
        {
            FormStatus = "Cancel";
            DialogResult dr1 = MessageBox.Show("資料尚未儲存,確定取消??", "取消確認", MessageBoxButtons.YesNo);

            if (dr1 == System.Windows.Forms.DialogResult.No)
            {
                return;
            }
            ((DataSet)MasterBS.DataSource).RejectChanges();
            MasterBS.CancelEdit();
            if (ChildBS != null)
            {
                ((DataSet)ChildBS.DataSource).RejectChanges();
                ChildBS.CancelEdit();
            }
            FormStatus = "Search";
            bindingNavigatorNewButton.Enabled    = true;
            bindingNavigatorEditButton.Enabled   = true;
            bindingNavigatorDelButton.Enabled    = true;
            bindingNavigatorSaveButton.Enabled   = false;
            bindingNavigatorCanceButton.Enabled  = false;
            bindingNavigatorSearchButton.Enabled = true;
            if (enable_string.IndexOf("E0") > -1)
            {
                bindingNavigatorAddItemButton.Visible = false;
                bindingNavigatorDelItemButton.Visible = false;
            }
            Object_Enable(MasterObj, false);
        }
Beispiel #18
0
        private void IncluirPrd()
        {
            if (StaFormEdicao)
            {
                MessageBox.Show("Cadastro de Produção em edição", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                if (CadProducao.IdProducao > 0)
                {
                    FrmBuscaProduto BuscaPrd = new FrmBuscaProduto();
                    BuscaPrd.FrmPrincipal = this.FrmPrincipal;
                    BuscaPrd.IdProduto    = 0;
                    BuscaPrd.LstMvEst     = true;
                    BuscaPrd.ShowDialog();

                    if (BuscaPrd.IdProduto > 0)
                    {
                        ProdPrd.IdLanc     = 0;
                        ProdPrd.IdProducao = CadProducao.IdProducao;
                        ProdPrd.IdProduto  = BuscaPrd.IdProduto;
                        ProdPrd.GravarDados();
                        PopularGridPrd();
                    }
                    else
                    {
                        Source_Prd.CancelEdit();
                    }
                    BuscaPrd.Dispose();
                }
            }
        }
Beispiel #19
0
        // FECHAR FORM
        //------------------------------------------------------------------------------------------------------------
        private void btnFechar_Click(object sender, EventArgs e)
        {
            if (Sit == EnumFlagEstado.NovoRegistro)
            {
                AbrirDialog("Esse registro ainda não foi salvo... \n" +
                            "Favor SALVAR ou CANCELAR a edição do registro atual antes de fechar.",
                            "Registro Novo", DialogType.OK, DialogIcon.Exclamation);
                return;
            }
            else if (Sit == EnumFlagEstado.Alterado)
            {
                AbrirDialog("Esse registro de Entrada não pode ser alterado... \n" +
                            "O formulário será fechado, e não será salvo.",
                            "Registro Alterado", DialogType.OK, DialogIcon.Exclamation);
                bind.CancelEdit();
                Sit = EnumFlagEstado.RegistroSalvo;
            }

            if (!Modal)
            {
                new frmEntradaListagem()
                {
                    MdiParent = Application.OpenForms[0]
                }
            }
Beispiel #20
0
        private void btnCancelar_Click(object sender, EventArgs e)
        {
            bsVacina.CancelEdit();



            txtNomeVacina.Enabled     = false;
            txtDataNascVacina.Enabled = false;
            txtEndVacina.Enabled      = false;
            cbxCidade.Enabled         = false;
            mskbxCpfVacina.Enabled    = false;
            mskbxRgVacina.Enabled     = false;
            txtDataVacina.Enabled     = false;
            cbxTipoVacina.Enabled     = false;
            cbxComorbiVacina.Enabled  = false;
            cbxPrioriVacina.Enabled   = false;
            cbxEnfermeiro.Enabled     = false;



            btnNovoRegistro.Enabled = true;
            btnSalvar.Enabled       = false;
            btnAlterar.Enabled      = true;
            btnExcluir.Enabled      = true;
            btnCancelar.Enabled     = false;



            bInclusao = false;
        }
Beispiel #21
0
        /// <summary>
        /// 取消按钮事件
        /// </summary>
        public void btnCancel_Click(object sender, EventArgs e)
        {
            try
            {
                if (!FrmMainDAO.QueryUserButtonPower(this.ParentForm.Name, this.Text, sender, true))
                {
                    return;
                }

                if (masterBindingSource.Current != null)
                {
                    masterBindingSource.CancelEdit();
                    EditState = false;
                    ((DataRowView)masterBindingSource.Current).Row.RejectChanges();
                    newState = false;
                    if (CancelAfter != null)
                    {
                        CancelAfter();
                    }
                    Set_Button_State(true);
                    Set_EditZone_ControlReadOnly(true);
                    pnlButton.Focus();
                }
            }
            catch (Exception ex)
            {
                //ExceptionHandler.HandleException(this.Text + "--取消按钮事件错误。", ex);
                ExceptionHandler.HandleException(this.Text + "--" + f.tsmiQxansj.Text, ex);
            }
        }
Beispiel #22
0
 private void dgvFiles_DataError(object sender, DataGridViewDataErrorEventArgs e)
 {
     MessageBox.Show("Error. The information you entered and the property don't have the same type " +
                     "\nColumn : [" + dgvFiles.Columns[e.ColumnIndex].HeaderText + "] -- Value : [" + e.Context.ToString() + "].  " +
                     "\nDon't write characters in number property for example", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     bs.CancelEdit();
 }
Beispiel #23
0
 public void Dispose()
 {
     if (!Util.ObjectIsNull(cda))
     {
         cda.Dispose();
     }
     if (!Util.ObjectIsNull(ds))
     {
         ds.Dispose();
     }
     if (!Util.ObjectIsNull(bs))
     {
         bs.CancelEdit();
         bs.Dispose();
     }
     if (!Util.ObjectIsNull(epda))
     {
         epda.Connection.Close();
         epda.Dispose();
     }
     if (!Util.ObjectIsNull(eda))
     {
         eda.Connection.Close();
         eda.Dispose();
     }
     if (!Util.ObjectIsNull(pda))
     {
         pda.Connection.Close();
         pda.Dispose();
     }
 }
Beispiel #24
0
 void button2_Click(object sender, EventArgs e)
 {
     try
     {
         if (MessageBox.Show("Etes vous sûres d'annuler l'opération?", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
         {
             bs.CancelEdit();
             (bs.DataSource as DataTable).RejectChanges();
             Close();
         }
     }
     catch (Exception er)
     {
         MessageBox.Show(er.Message, this.Text);
     }
 }
Beispiel #25
0
        /// <summary>
        /// 单击辅助按钮,选择分区
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnBlock_Click(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;
            frmSelectBlock frm = new frmSelectBlock(this.blockList, this.seatingChartList, cbHall.SelectedValue.ToString());

            this.Cursor = Cursors.Default;

            if (frm.ShowDialog() == DialogResult.OK)
            {
                if (this.dgvList.CurrentRow.IsNewRow == true)
                {
                    blockPriceList = bsList.DataSource as List <BlockPrice>;

                    foreach (var row in blockPriceList)
                    {
                        //  判断是否已经设置了这个区域的票价
                        if (row.BlockId != null && row.BlockId.Trim() == frm.blockId)
                        {
                            MessageBox.Show("列表中已存在相同的区域!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error);

                            return;
                        }
                    }
                    bsList.CancelEdit();
                    bsList.AddNew();
                }

                this.dgvList.CurrentRow.Cells["BlockId"].Value   = frm.blockId;
                this.dgvList.CurrentRow.Cells["BlockName"].Value = blockList.Where(p => p.BlockId == this.dgvList.CurrentRow.Cells["BlockId"].Value.ToString().Trim()).FirstOrDefault().BlockName;

                SetPrice();
            }
        }
        // CANCELAR ALTERACAO
        //------------------------------------------------------------------------------------------------------------
        private void btnCancelar_Click(object sender, EventArgs e)
        {
            if (Sit == EnumFlagEstado.NovoRegistro)
            {
                var response = AbrirDialog("Deseja cancelar a inserção de um novo registro?",
                                           "Cancelar", DialogType.SIM_NAO, DialogIcon.Question);

                if (response == DialogResult.Yes)
                {
                    new frmCartaoControle().Show();
                    MostraMenuPrincipal();
                    Close();
                }
            }
            else if (Sit == EnumFlagEstado.Alterado)
            {
                bind.CancelEdit();
                Sit = EnumFlagEstado.RegistroSalvo;
                AtivoButtonImage();
            }
            else
            {
                Sit = EnumFlagEstado.RegistroSalvo;
            }
        }
Beispiel #27
0
 private void bindingNavigatorDeleteItem_Click(object sender, EventArgs e)
 {
     ID = (int)((DataRowView)bsEmployer.Current).Row.ItemArray[0];
     bsEmployer.CancelEdit();
     (this.MdiParent as MainForm).MainForm_DelEmployer(ID, e);
     (this.MdiParent as MainForm).employersToolStripMenuItem_Click(sender, e);
 }
Beispiel #28
0
 private void toolStripButton9_Click(object sender, EventArgs e)//取消
 {
     source.CancelEdit();
     data.RejectChanges();
     ////////////////////////////////////////////
     this.ToolButtonEnabled(false);
 }
Beispiel #29
0
        protected virtual bool IsEditKeyValid(string key, string keyFld)
        {
            if (myMasterSource == null)
            {
                return(false);
            }
            int row = myMasterSource.Find(keyFld, key);

            if (row < 0)
            {
                return(true);
            }
            if (row != myMasterSource.Position)
            {
                if (MessageBox.Show("Đã có mã số [" + key + "] trong hệ thống, xem lại dữ liệu ? ", common.settings.sysApplicationName,
                                    MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    myMasterSource.CancelEdit();
                    myMasterSource.Position = row;
                    return(true);
                }
                return(false);
            }
            return(true);
        }
Beispiel #30
0
 private void BtnCancelar_Click(object sender, EventArgs e)
 {
     BtnNovo.Enabled    = true;
     BtnExcluir.Enabled = true;
     dados.CancelEdit();
     dados.RemoveCurrent();
     dados.MoveFirst();
 }