public int UpdateVessel(BMS_DAL.DS.BMSDS.TVesselsDataTable dt) { int r = 0; if (dt.GetChanges() != null) { using (BMS_DAL.DS.BMSDSTableAdapters.TVesselsTableAdapter ta = new BMS_DAL.DS.BMSDSTableAdapters.TVesselsTableAdapter()) { r = ta.UpdateWithTrans(dt); } } return(r); }
public int UpdateWithTrans(BMS_DAL.DS.BMSDS.TVesselsDataTable dt) { int r = 0; using (System.Transactions.TransactionScope ts = new System.Transactions.TransactionScope()) { try { r = this.Adapter.Update(dt); ts.Complete(); } catch (Exception ex) { throw ex; } } return(r); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); BMS_DAL.DS.BMSDS.TVesselsDataTable vesselDT = _service.GetVessel(); this.searchLookUpEdit_VSL.Properties.DataSource = vesselDT; this.searchLookUpEdit_VSL.Properties.DisplayMember = "NAME"; this.searchLookUpEdit_VSL.Properties.ValueMember = "ID"; foreach (var item in BMS_Component.StaticMethods.GetEnumDict(typeof(BMS_Component.CPTYPE)).ToList()) { this.comboBoxEdit_CPTYPE.Properties.Items.Add(item.Value); } foreach (var item in BMS_Component.StaticMethods.GetEnumDict(typeof(BMS_Component.PAYER)).ToList()) { this.comboBoxEdit_PAYER.Properties.Items.Add(item.Value); } this.searchLookUpEdit_VSL.DataBindings.Add(new Binding("EditValue", DataRowItem, "VSL_ID", false, DataSourceUpdateMode.OnPropertyChanged)); this.dateEdit_CPDATE.DataBindings.Add(new Binding("EditValue", DataRowItem, "CP_DATE", false, DataSourceUpdateMode.OnPropertyChanged)); this.comboBoxEdit_CPTYPE.DataBindings.Add(new Binding("EditValue", DataRowItem, "CP_TYPE", false, DataSourceUpdateMode.OnPropertyChanged)); this.comboBoxEdit_PAYER.DataBindings.Add(new Binding("EditValue", DataRowItem, "PAYER", false, DataSourceUpdateMode.OnPropertyChanged)); this.textEdit_FIXNO.DataBindings.Add(new Binding("EditValue", DataRowItem, "FIXNO", false, DataSourceUpdateMode.OnPropertyChanged)); this.memoEdit_CPDESC.DataBindings.Add(new Binding("EditValue", DataRowItem, "CP_DESC", false, DataSourceUpdateMode.OnPropertyChanged)); this.textEdit_HRORFRT.DataBindings.Add(new Binding("EditValue", DataRowItem, "HRORFRT", false, DataSourceUpdateMode.OnPropertyChanged)); this.textEdit_DAYSORMT.DataBindings.Add(new Binding("EditValue", DataRowItem, "DAYSORMT", false, DataSourceUpdateMode.OnPropertyChanged)); this.textEdit_ESTBRK.DataBindings.Add(new Binding("EditValue", DataRowItem, "ESTBRK", false, DataSourceUpdateMode.OnPropertyChanged)); this.searchLookUpEdit_OWR.DataBindings.Add(new Binding("EditValue", DataRowItem, "OWR", false, DataSourceUpdateMode.OnPropertyChanged)); this.textEdit_OWRRATE.DataBindings.Add(new Binding("EditValue", DataRowItem, "BRKRATE_OWR", false, DataSourceUpdateMode.OnPropertyChanged)); this.textEdit_OWRAMOUNT.DataBindings.Add(new Binding("EditValue", DataRowItem, "BRKAMOUNT_OWR", false, DataSourceUpdateMode.OnPropertyChanged)); this.searchLookUpEdit_CHR.DataBindings.Add(new Binding("EditValue", DataRowItem, "CHR", false, DataSourceUpdateMode.OnPropertyChanged)); this.textEdit_CHRRATE.DataBindings.Add(new Binding("EditValue", DataRowItem, "BRKRATE_CHR", false, DataSourceUpdateMode.OnPropertyChanged)); this.textEdit_CHRAMOUNT.DataBindings.Add(new Binding("EditValue", DataRowItem, "BRKAMOUNT_CHR", false, DataSourceUpdateMode.OnPropertyChanged)); this.searchLookUpEdit_BROKER1.DataBindings.Add(new Binding("EditValue", DataRowItem, "BROKER1", false, DataSourceUpdateMode.OnPropertyChanged)); this.searchLookUpEdit_BROKER2.DataBindings.Add(new Binding("EditValue", DataRowItem, "BROKER2", false, DataSourceUpdateMode.OnPropertyChanged)); this.searchLookUpEdit_SIGNOP.DataBindings.Add(new Binding("EditValue", DataRowItem, "SIGNOPER", false, DataSourceUpdateMode.OnPropertyChanged)); this.textEdit_TFCB.DataBindings.Add(new Binding("EditValue", DataRowItem, "TFCB", false, DataSourceUpdateMode.OnPropertyChanged)); this.memoEdit_REMARK.DataBindings.Add(new Binding("EditValue", DataRowItem, "REMARK", false, DataSourceUpdateMode.OnPropertyChanged)); this.textEdit_CAPRATE.DataBindings.Add(new Binding("EditValue", DataRowItem, "CAP_RATE", false, DataSourceUpdateMode.OnPropertyChanged)); this.textEdit_CAPAMOUNT.DataBindings.Add(new Binding("EditValue", DataRowItem, "CAP_AMOUNT", false, DataSourceUpdateMode.OnPropertyChanged)); this.AttachEvent(); }