Ejemplo n.º 1
0
        void bindingNavigatorAddNewItem_Click(object sender, EventArgs e)
        {
            var datarowitem = this._tvesselDT.NewTVesselsRow();

            datarowitem.NAME  = "New Vessel";
            datarowitem.SIZE  = "PMX";
            datarowitem.DESC  = string.Empty;
            datarowitem.OPER  = BMS_Component.UserInfo.UserName;
            datarowitem.OP_DT = DateTimeOffset.Now;
            VesselItem item = new VesselItem();

            item.Text        = "Add Vessel";
            item.DataRowItem = datarowitem;
            this._tvesselDT.AddTVesselsRow(datarowitem);
            switch (item.ShowDialog())
            {
            case DialogResult.OK:
                MessageBox.Show(string.Format("Add {0} rows", this._daService.UpdateVessel(this._tvesselDT)));
                this.RefreshData();
                this.BindData();
                break;

            case DialogResult.Cancel:
                datarowitem = null;
                this._tvesselDT.RejectChanges();
                break;
            }
        }
Ejemplo n.º 2
0
        void gridView_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.TVesselsRow)gv.GetDataRow(vi.RowHandle);
                datarowitem.OPER  = BMS_Component.UserInfo.UserName;
                datarowitem.OP_DT = DateTimeOffset.Now;
                VesselItem item = new VesselItem();
                item.Text        = "Update Vessel";
                item.DataRowItem = datarowitem;
                switch (item.ShowDialog())
                {
                case DialogResult.OK:
                    MessageBox.Show(string.Format("Update {0} rows", this._daService.UpdateVessel(this._tvesselDT)));
                    this.RefreshData();
                    this.BindData();
                    break;

                case DialogResult.Cancel:
                    this._tvesselDT.RejectChanges();
                    break;
                }
            }
        }