Exemplo n.º 1
0
        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.TVesselsRow)gv.GetDataRow(vi.RowHandle);
                datarowitem.OPER  = BMS_Component.UserInfo.UserName;
                datarowitem.OP_DT = DateTime.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._dt)));
                    this._dt.Clear();
                    this._dt.Merge(_daservice.GetVessel());
                    this.BindData();
                    break;

                case DialogResult.Cancel:
                    this._dt.RejectChanges();
                    break;
                }
            }
        }
Exemplo n.º 2
0
        void bindingNavigatorAddNewItem_Click(object sender, EventArgs e)
        {
            var datarowitem = this._dt.NewTVesselsRow();

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

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

            case DialogResult.Cancel:
                datarowitem = null;
                this._dt.RejectChanges();
                break;
            }
        }