void gridView1_DoubleClick(object sender, EventArgs e) { DevExpress.XtraGrid.Views.Grid.GridView gv = sender as DevExpress.XtraGrid.Views.Grid.GridView; Point pt = gv.GridControl.PointToClient(MousePosition); DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo vi = gv.CalcHitInfo(pt); if (vi.InRowCell || vi.InRow) { var datarowitem = (BMS_DAL.DS.BMSDS.TFixturesRow)gv.GetDataRow(vi.RowHandle); datarowitem.OPER = BMS_Component.UserInfo.UserName; datarowitem.OP_DT = DateTime.Now; FixtureItem item = new FixtureItem(); item.Text = "Update Fixture"; item.DataRowItem = datarowitem; switch (item.ShowDialog()) { case DialogResult.OK: MessageBox.Show(string.Format("Update {0} rows", this._daservice.UpdateFixtureWithRelation(this._ds))); this._ds.TFixtures.Clear(); this._ds.TInvoices.Clear(); this._ds.TInvoiceDetails.Clear(); this._ds.Merge(_daservice.GetFixtureWithRelation()); this.BindData(); break; case DialogResult.Cancel: this._ds.RejectChanges(); break; } } }
void bindingNavigatorAddNewItem_Click(object sender, EventArgs e) { var datarowitem = this._ds.TFixtures.NewTFixturesRow(); datarowitem.VSL_ID = 1; datarowitem.CP_DATE = DateTime.Now; datarowitem.CP_TYPE = "VC"; datarowitem.CP_DESC = string.Empty; datarowitem.PAYER = "OWR"; datarowitem.HRORFRT = 0; datarowitem.DAYSORMT = 0; datarowitem.BRKRATE_OWR = 1.25M; datarowitem.BRKAMOUNT_OWR = 0; datarowitem.BRKRATE_CHR = 1.25M; datarowitem.BRKAMOUNT_CHR = 0; datarowitem.OWR = "OWR"; datarowitem.CHR = "CHR"; datarowitem.ESTBRK = 0; datarowitem.BROKER1 = "BROKER1"; datarowitem.BROKER2 = "BROKER2"; datarowitem.SIGNOPER = "OP"; datarowitem.CAP_RATE = 0.5M; datarowitem.CAP_AMOUNT = 0; datarowitem.TFCB = 1; datarowitem.FIXNO = string.Format("P{0}", DateTime.Now.ToString("yyMMdd")); datarowitem.STATUS = "PROGRESS"; datarowitem.REMARK = string.Empty; datarowitem.OPER = BMS_Component.UserInfo.UserName; datarowitem.OP_DT = DateTime.Now; FixtureItem item = new FixtureItem(); item.Text = "Add Fixture"; item.DataRowItem = datarowitem; this._ds.TFixtures.AddTFixturesRow(datarowitem); switch (item.ShowDialog()) { case DialogResult.OK: MessageBox.Show(string.Format("Add {0} rows", this._daservice.UpdateFixtureWithRelation(this._ds))); this._ds.TFixtures.Clear(); this._ds.TInvoices.Clear(); this._ds.TInvoiceDetails.Clear(); this._ds.Merge(_daservice.GetFixtureWithRelation()); this.BindData(); break; case DialogResult.Cancel: datarowitem = null; this._ds.RejectChanges(); break; } }