// SUB NEW //------------------------------------------------------------------------------------------------------------ public frmCartaoCreditoDespesa(Form formOrigem) { InitializeComponent(); _formOrigem = formOrigem; ObterDados(); GetBandeiraList(); GetFormasList(); bind.DataSource = typeof(objAPagarCartao); bind.DataSource = list; PreencheListagem(); BindingCreator(); HandlerKeyDownControl(this); // check bind position and addNew if (bind.Position == -1) { bind.AddNew(); } // add handler bind.CurrentChanged += (a, b) => ChangeCurrent(); txtCartaoDescricao.Validating += (a, b) => PrimeiraLetraMaiuscula(txtCartaoDescricao); ChangeCurrent(); }
private void TsbRuleNewClick(object sender, EventArgs e) { using (RuleForm ruleForm = new RuleForm()) { if (ruleForm.ShowDialog() == DialogResult.OK) { DataRowView currentGroup = _bsGroup.Current as DataRowView; DataRowView newRule = _bsRule.AddNew() as DataRowView; newRule["GroupName"] = currentGroup["Name"]; newRule["Name"] = ruleForm.tbName.Text; newRule["Description"] = ruleForm.tbDescription.Text; _bsRule.EndEdit(); _bsRule.ResetCurrentItem(); DataTable dtRl = _dsSecurity.Tables["Rule"]; DataRow newRl = dtRl.NewRow(); newRl["Name"] = newRule["Name"]; newRl["Description"] = newRule["Description"]; dtRl.Rows.Add(newRl); DataTable dtGrpRl = _dsSecurity.Tables["GrpRl"]; DataRow newGrpRl = dtGrpRl.NewRow(); newGrpRl["RuleName"] = newRule["Name"]; newGrpRl["GroupName"] = newRule["GroupName"]; dtGrpRl.Rows.Add(newGrpRl); } } }
private void btnNovo_Click(object sender, EventArgs e) { if (tbVacina.SelectedIndex == 0) { tbVacina.SelectTab(1); } bnVacina.AddNew(); txtNameVacina.Enabled = true; txtEndVacina.Enabled = true; dtNascVacina.Enabled = true; dtVacina.Enabled = true; mskbxCPFVacina.Enabled = true; mskbxRGVacina.Enabled = true; cbxCidade.Enabled = true; cbxEnfermeiro.Enabled = true; cbxComorbidadeVacina.Enabled = true; cbxGrupoPrioritarioVacina.Enabled = true; cbxTipoVacina.Enabled = true; cbxComorbidadeVacina.SelectedIndex = 0; cbxGrupoPrioritarioVacina.SelectedIndex = 0; cbxTipoVacina.SelectedIndex = 0; cbxCidade.SelectedIndex = 0; cbxEnfermeiro.SelectedIndex = 0; btnSalvar.Enabled = true; btnAlterar.Enabled = false; btnNovo1.Enabled = false; btnExcluir.Enabled = false; btnCancelar.Enabled = true; bInclusao = true; }
private void btnUndo_Click(object sender, EventArgs e) { if (actions.Count() > 0) { var action = actions[actions.Count() - 1]; switch (action.type) { case ClassAction.ClassActionType.ADD: var index = bds.Find("MALOP", action.malop); if (index > -1) { bds.RemoveAt(index); } break; case ClassAction.ClassActionType.DELETE: if (bds.Find("MALOP", action.malop) == -1) { DataRowView row = (DataRowView)bds.AddNew(); gridView.BeginEdit(false); row["MALOP"] = action.malop; row["TENLOP"] = action.tenlop; gridView.Refresh(); } else { MessageBox.Show("Lớp đã tồn tại", "Lỗi!", MessageBoxButtons.OK, MessageBoxIcon.Error); } break; } actions.RemoveLast(); } }
private void TsbGroupNewClick(object sender, EventArgs e) { using (GroupForm groupForm = new GroupForm()) { if (groupForm.ShowDialog() == DialogResult.OK) { DataRowView currentUser = _bsUser.Current as DataRowView; DataRowView newGroup = _bsGroup.AddNew() as DataRowView; newGroup["UserName"] = currentUser["Name"]; newGroup["Name"] = groupForm.tbName.Text; newGroup["Description"] = groupForm.tbDescription.Text; _bsGroup.EndEdit(); _bsGroup.ResetCurrentItem(); DataTable dtGrp = _dsSecurity.Tables["Group"]; DataRow newGrp = dtGrp.NewRow(); newGrp["Name"] = newGroup["Name"]; newGrp["Description"] = newGroup["Description"]; dtGrp.Rows.Add(newGrp); DataTable dtUsrGrp = _dsSecurity.Tables["UsrGrp"]; DataRow newUsrGrp = dtUsrGrp.NewRow(); newUsrGrp["GroupName"] = newGroup["Name"]; newUsrGrp["UserName"] = newGroup["UserName"]; dtUsrGrp.Rows.Add(newUsrGrp); } } }
void bareCodeReader1_OnRead(string CodeABarre) { try { DataTable dt = CLIENT_APP_PARAM.gcws.SELECT_BY_BARCODE_BY_MAGASIN(CodeABarre, CLIENT_APP_PARAM.CODE_MAG); if (dt.Rows.Count > 0) { DataRow dr = dt.Rows[0]; bool trouve = false; foreach (DataRow item in dS_MOUV1.V_LG_DC.Rows) { if (item["CODE_ARTICLE"].ToString() == dr["CODE_ARTICLE"].ToString()) { trouve = true; break; } } if (!trouve) { bsDetail.AddNew(); DataRowView drv = (DataRowView)bsDetail.Current; drv["CODE_DC"] = ""; drv["CODE_ARTICLE"] = dr["CODE_ARTICLE"]; drv["REF_ARTICLE"] = dr["REF_ARTICLE"]; drv["DESIGNATION_ARTICLE"] = dr["DESIGNATION_ARTICLE"]; drv["UNITE"] = dr["LIB_UNITE"]; drv["QTE"] = 1; drv["TVA"] = dr["TVA_ARTICLE"]; drv["PRIX_U_HT"] = dr["PRIX_HT_V_ARTICLE"]; drv["REMISE"] = 0; drv["MAX_REMISE"] = dr["MAX_REMISE"]; drv["PRIX_HT_ACHAT"] = dr["PRIX_HT_A_ARTICLE"]; drv["TVA_ACHAT"] = dr["TVA_ACHAT"]; //calculerLigne(); bsDetail.EndEdit(); (bsDetail.DataSource as DataTable).AcceptChanges(); } else { bsDetail.Position = bsDetail.Find("CODE_ARTICLE", dr["CODE_ARTICLE"]); DataRowView drv = (DataRowView)bsDetail.Current; drv["QTE"] = (decimal)drv["QTE"] + 1; //calculerLigne(); bsDetail.EndEdit(); (bsDetail.DataSource as DataTable).AcceptChanges(); } } } catch (Exception er) { MessageBox.Show(er.Message, this.Text); } }
private void button2_Click(object sender, EventArgs e) { bs.AddNew(); OleDbCommand cmd2 = new OleDbCommand("select max(m_id) from mord", con); int x = int.Parse(cmd2.ExecuteScalar().ToString()); txt_id.Text = x.ToString() + 5; groupBox1.Enabled = false; }
private void AddNewToolStripButton_Click(object sender, EventArgs e) { AddRecord(); MainBs.AddNew(); //MainBs.ResetCurrentItem(); //MainBs.MoveFirst(); ResetBindings(this); }
private void buttonENREGISTRER_Click(object sender, EventArgs e) { bs.AddNew(); ((DataRowView)bs.Current)["CODE_ARTICLE"] = "-1"; CHM_NV_ARTICLE fiche = new CHM_NV_ARTICLE(bs); fiche.Enregistrer += new CHM_NV_ARTICLE.Enregistrer_event(fiche_Enregistrer); fiche.ShowDialog(); }
void bareCodeReader1_OnRead(string CodeABarre) { try { DataTable dt = CLIENT_APP_PARAM.gcws.SELECT_BY_BARCODE(CodeABarre); if (dt.Rows.Count > 0) { DataRow dr = dt.Rows[0]; bool exist = false; foreach (DataRow item in dS_MOUV1.V_LG_CMD_FR.Rows) { if (item["CODE_ARTICLE"].ToString() == dr["CODE_ARTICLE"].ToString()) { exist = true; break; } } if (!exist) { bsDetails.AddNew(); DataRowView drv = (DataRowView)bsDetails.Current; drv["CODE_COMMANDE_FOURNISSEUR"] = -1; drv["CODE_ARTICLE"] = dr["CODE_ARTICLE"]; drv["QTE"] = 1; drv["DESIGNATION_ARTICLE"] = dr["DESIGNATION_ARTICLE"]; drv["DESCRIPTION_ARTICLE"] = dr["DESCRIPTION_ARTICLE"]; drv["REF_ARTICLE"] = dr["REF_ARTICLE"]; drv["TAUX_TVA"] = dr["TAUX_TVA_ACHAT"]; drv["UNITE"] = dr["LIB_UNITE"]; drv["CODE_ARTICLE"] = dr["CODE_ARTICLE"]; drv["PRIX_HT"] = dr["PRIX_HT_A_ARTICLE"]; drv["REMISE"] = 0; drv["FODEC"] = 0; bsDetails.EndEdit(); (bsDetails.DataSource as DataTable).AcceptChanges(); gridView1.UpdateCurrentRow(); } else { bsDetails.Position = bsDetails.Find("CODE_ARTICLE", dr["CODE_ARTICLE"]); DataRowView drv = (DataRowView)bsDetails.Current; drv["QTE"] = (decimal)drv["QTE"] + 1; bsDetails.EndEdit(); (bsDetails.DataSource as DataTable).AcceptChanges(); gridView1.UpdateCurrentRow(); } } calculMontantTotal(); } catch (Exception er) { MessageBox.Show(er.Message, this.Text); } }
public override void InsertRecord() { if (!ChangeViewportStateTo(ViewportState.NewRowState)) { return; } _isEditable = false; dataGridView.RowCount = dataGridView.RowCount + 1; _vSoftware.AddNew(); dataGridView.Enabled = false; _isEditable = true; _softwareDm.EditingNewRecord = true; }
/// <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(); } }
private void btn_Nouveau_Click(object sender, EventArgs e) { //foreach (Control c in Controls) // if (c is TextBox) // c.Text = ""; bs.AddNew(); }
private void simpleButton4_Click(object sender, EventArgs e) { if (Convert.ToDecimal(txt_MntRecu.Text) > 0) { bsPaiement.AddNew(); DataRowView drv = bsPaiement.Current as DataRowView; drv["MODE_REGLEMENT_CLT"] = ModePaiment; drv["MONTANT_REG_CLIENT"] = lbn_total_apres_remise.Value; drv["MONTANT_PIECE"] = Convert.ToDecimal(txt_MntRecu.Text); drv["NUM_PIECE_CLIENT"] = txt_numCheque.Text; drv["BANQUE_CLIENT"] = txt_banque.Text; drv["RESTE"] = lbCurrentReste.Value; drv["TYPE_PIECE"] = TypePiece; drv["CODE_REGLEMENT_CLIENT"] = bsPaiement.Count + 1; bsPaiement.EndEdit(); (bsPaiement.DataSource as DataTable).AcceptChanges(); grpPaiement.Visible = false; } else { MessageBox.Show("Montant non valid!"); } }
private void cmdAdd_Click(object sender, EventArgs e) { NewRecord = true; Dirty = true; bs.AddNew(); }
public FrmSingleDt(CDTData data, BindingSource bs) { InitializeComponent(); this._data = data; AddICDTData(_data); this._frmDesigner = new FormDesigner(this._data); _frmDesigner.formAction = FormAction.New; _bindingSource = bs; //_bindingSource.DataSource = this._data.DsData.Tables[0]; _frmDesigner.bindingSource = _bindingSource; dataNavigatorMain.DataSource = _frmDesigner.bindingSource; dxErrorProviderMain.DataSource = _frmDesigner.bindingSource; _bindingSource.AddNew(); _bindingSource.EndEdit(); //_data.DsData.Tables[0].Rows[_data.DsData.Tables[0].Rows.Count - 1]["MaKH"] = "XXXX"; InitializeLayout(); this.Load += new EventHandler(FrmSingleDt_Load); if (Config.GetValue("Language").ToString() == "1") { DevLocalizer.Translate(this); } else { this.dataNavigatorMain.TextStringFormat = "Mục {0} của {1}"; } dataNavigatorMain.PositionChanged += new EventHandler(dataNavigatorMain_PositionChanged); }
private void AddNew() //新增 { mState = "NEW"; myBDS1.AddNew(); txtID.Focus(); SetButtonSatus(false); Set_Grid_Status(true); SetObjValue.SetEditBackColor(panel1.Controls, true); SetObjValue.ClearObjValue(panel1.Controls, "1"); //DataRow dr = dtMostly.NewRow(); //插一空行 //dtMostly.Rows.InsertAt(dr, 0); txtID.Text = clsApp.ExecuteSqlReturnObject(@"Select dbo.fn_get_max_no('T') AS max_no"); //GetID_No(); txtID.Properties.ReadOnly = true; txtID.BackColor = Color.White; txtremark.Text = ""; txtState.Text = "0"; dtDelivery_date.EditValue = DateTime.Now.Date.ToString("yyyy-MM-dd").Substring(0, 10); dtDetails.Clear(); gridControl1.DataSource = myBDS2; tabControl1.SelectTab(0);//跳至第一頁 }
private void btnAddRow_Click(object sender, EventArgs e) { bsPurchaseReturnLine.AddNew(); ORD_PurchaseReturnLineResult rst = bsPurchaseReturnLine.Current as ORD_PurchaseReturnLineResult; InitNewData(rst); }
private void btnThem_Click(object sender, EventArgs e) { DataRowView dataRowView = (DataRowView)m_objBindingSrc.AddNew(); //dataRowView.Row[1] = "VT1"; m_objBindingSrc.MoveLast(); }
private void btnAddRow_Click(object sender, EventArgs e) { bsStkInLine.AddNew(); STK_InLineResult rst = bsStkInLine.Current as STK_InLineResult; InitNewData(rst); }
public void AddNew() { if (!Validate()) { return; } if (BindingSource == null) { return; } if (DataGrid != null) { if (!DataGrid.AllowUserToAddRows || DataGrid.ReadOnly) { return; } DataGrid.Focus(); DataGrid.MoveToNewRow(); } else { BindingSource.AddNew(); } RefreshItemsInternal2(); }
private void addOrgStripButton_Click(object sender, EventArgs e) { try { EditOrgForm tmpForm = new EditOrgForm(_connection); tmpForm.Owner = this; DialogResult dRes = tmpForm.ShowDialog(this); if (dRes == DialogResult.OK) { DataRowView row = _orgBS.AddNew() as DataRowView; if (row != null) { row.BeginEdit(); row[Org.regnum] = tmpForm.RegnumOrg; row[Org.name] = tmpForm.NameOrg; row[Org.chief_post] = tmpForm.ChiefpostOrg; row[Org.chief_fio] = tmpForm.ChieffioOrg; row[Org.booker_fio] = tmpForm.BookerfioOrg; row.EndEdit(); int pos = _orgBS.Position; _orgAdapter.Update(_orgTable); _orgTable.Clear(); _orgAdapter.Fill(_orgTable); _orgBS.Position = pos; MainForm.ShowInfoMessage("Организация успешно добавлена!", "Добавление организации"); _dialogResult = DialogResult.OK; } } } catch (Exception ex) { MainForm.ShowErrorMessage(ex.Message, "Ошибка добавления организации"); } }
private void toolStripButton5_Click(object sender, EventArgs e)//添加 { source.AddNew(); this.ToolButtonEnabled(true); this.style.Enabled = true; this.style.Focus(); }
private void btnNovoRegistro_Click(object sender, EventArgs e) { if (TabControl1.SelectedIndex == 0) { TabControl1.SelectTab(1); } bnDespesa.AddNew(); txtDataDespesa.Enabled = true; cbxTipoDespesa.Enabled = true; cbxTipoDespesa.SelectedIndex = 0; cbxMembro.Enabled = true; cbxMembro.SelectedIndex = 0; txtValor.Enabled = true; txtObs.Enabled = true; txtDataDespesa.Focus(); btnSalvar.Enabled = true; btnAlterar.Enabled = false; btnNovoRegistro.Enabled = false; btnExcluir.Enabled = false; btnCancelar.Enabled = true; bInclusao = true;; }
private void button5_Click(object sender, EventArgs e) { bs.AddNew(); dgUpdate(); records(); button5.Enabled = false; }
private void ButtonAddNewClick(object sender, EventArgs e) { if (_bindingSource.AllowNew && dataGridView.Rows.Count < _maxRowsAllowed) { _bindingSource.AddNew(); } }
private void btnAddRow_Click(object sender, EventArgs e) { bsOrderLine.AddNew(); ORD_SalesOrderLineResult rst = bsOrderLine.Current as ORD_SalesOrderLineResult; InitNewData(rst); }
public void ClearTests() { BindingSource binding = new BindingSource(); binding.AddNew(); SetGridDatasouce datasouce = SetDatasource; if (GridTests.InvokeRequired) { GridTests.Invoke(datasouce, new object[] { binding }); } else { GridTests.DataSource = binding; } cboFilter.Items.Clear(); cboFilter.Items.Add(Resources.FilterByAllTestsText); cboFilter.SelectedIndex = 0; lblTime.Text = ""; lblTestNum.Text = ""; lblTestDetails.Text = ""; lblProject.Text = ""; lblPassingTests.Text = ""; lblFailingTests.Text = ""; //check if a failurewindow exists and if it does clear it. TestFailure failureWindow = TestPackage.GetTestFailureWindow(); if (failureWindow != null) { failureWindow.Clear(); } }
public void New() { var contact = ContactBindingSource.AddNew() as Contact; contact.DateOfBirth = DateTime.Now; contact.ContactName = "new contact"; }
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(); } } } }