Ejemplo n.º 1
0
        void gridView2_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 selecteddatarow = (BMS_DAL.DS.BMSDS.TFixturesRow)((DataRowView)this.bindingSource1.Current).Row;
                var datarowitem     = (BMS_DAL.DS.BMSDS.TInvoicesRow)gv.GetDataRow(vi.RowHandle);
                datarowitem.OPER  = BMS_Component.UserInfo.UserName;
                datarowitem.OP_DT = DateTime.Now;
                InvoiceItem item = new InvoiceItem();
                item.Text                      = "Update Invoice";
                item.FixDataRow                = selecteddatarow;
                item.DataRowItem               = datarowitem;
                item.InvoiceDetailDV           = _ds.TInvoiceDetails.DefaultView;
                item.InvoiceDetailDV.RowFilter = string.Format("INVOICE_ID='{0}'", datarowitem.ID);
                switch (item.ShowDialog())
                {
                case DialogResult.OK:
                    MessageBox.Show(string.Format("Update {0} rows", this._daservice.UpdateFixtureWithRelation(_ds)));
                    this._ds.TFixtures.Clear();
                    this._ds.TInvoices.Clear();
                    this._ds.TInvoiceDetails.Clear();
                    this._ds.Merge(_daservice.GetFixtureWithRelation());
                    this.BindData1();
                    this.BindData2();
                    break;

                case DialogResult.Cancel:
                    this._ds.RejectChanges();
                    break;
                }
            }
        }
Ejemplo n.º 2
0
        void bindingNavigatorAddNewItem_Click(object sender, EventArgs e)
        {
            if (this.bindingSource1.Current == null)
            {
                MessageBox.Show("Please select a fix!");
                return;
            }
            var selecteddatarow = (BMS_DAL.DS.BMSDS.TFixturesRow)((DataRowView)this.bindingSource1.Current).Row;
            var datarowitem     = this._ds.TInvoices.NewTInvoicesRow();

            datarowitem.VSL_ID           = selecteddatarow.VSL_ID;
            datarowitem.CP_DATE          = selecteddatarow.CP_DATE;
            datarowitem.CP_TYPE          = selecteddatarow.CP_TYPE;
            datarowitem.CP_DESC          = selecteddatarow.CP_DESC;
            datarowitem.MESSES           = selecteddatarow.PAYER;
            datarowitem.HRORFRT          = selecteddatarow.HRORFRT;
            datarowitem.DAYSORMT         = selecteddatarow.DAYSORMT;
            datarowitem.BRKRATE_OWR      = selecteddatarow.BRKRATE_OWR;
            datarowitem.BRKAMOUNT_OWR    = selecteddatarow.BRKAMOUNT_OWR;
            datarowitem.BRKRATE_CHR      = selecteddatarow.BRKRATE_CHR;
            datarowitem.BRKAMOUNT_CHR    = selecteddatarow.BRKAMOUNT_CHR;
            datarowitem.OWR              = selecteddatarow.OWR;
            datarowitem.CHR              = selecteddatarow.CHR;
            datarowitem.FIXNO            = selecteddatarow.FIXNO;
            datarowitem.STATUS           = "PROGRESS";
            datarowitem.REMARK           = string.Empty;
            datarowitem.REFNO            = string.Format("CW{0}", DateTime.Now.ToString("yyMMdd"));
            datarowitem.OPER             = BMS_Component.UserInfo.UserName;
            datarowitem.INVOICE_DATE     = DateTime.Now;
            datarowitem.CWNO             = string.Empty;
            datarowitem.ATIN             = string.Empty;
            datarowitem.RECEIVABLEAMOUNT = 0;
            datarowitem.RECEIVABLEDATE   = DateTime.Now;
            datarowitem.PERIODS          = "1";
            datarowitem.BANKACCOUNT      = "bromar";
            datarowitem.FIX_ID           = selecteddatarow.ID;
            datarowitem.REMARK           = string.Empty;
            datarowitem.OP_DT            = DateTime.Now;
            InvoiceItem item = new InvoiceItem();

            item.Text                      = "Add Invoice";
            item.FixDataRow                = selecteddatarow;
            item.DataRowItem               = datarowitem;
            item.InvoiceDetailDV           = _ds.TInvoiceDetails.DefaultView;
            item.InvoiceDetailDV.RowFilter = string.Format("INVOICE_ID='{0}'", datarowitem.ID);
            this._ds.TInvoices.AddTInvoicesRow(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.BindData1();
                this.BindData2();
                break;

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