public void Fill(States State) { int IdArrive = 0; try { IdArrive = (int)ds_master.Tables["ARRIVE"].Rows[BS_ARRIVE.Position]["IdArrive"]; } catch (Exception e) { Console.WriteLine(e.StackTrace); } this.TA_CLIENT.Fill(this.ds_master.CLIENT); this.TA_DE.FillBy(ds_master.DE); if (State == States.ADD || State == States.EDIT) { this.TA_RESERVATION.FillByArriveDate(this.ds_master.RESERVATION, ds_master.ARRIVE[BS_ARRIVE.Position].DateArrive.ToString()); } else if (State == States.CONSULT) { this.TA_ARRIVE.Fill(this.ds_master.ARRIVE); this.TA_CHAMBRE.FillByARRIVE(this.ds_master.CHAMBRE); this.TA_RESERVATION.FillByARRIVE(this.ds_master.RESERVATION); } if (BS_ARRIVE.DataSource != null) { BS_ARRIVE.Position = BS_ARRIVE.Find("IdArrive", IdArrive); } Sync_ForeignTables(); }
public bool Delete() { bool hasDepartB = hasDepart(ds_master.ARRIVE[BS_ARRIVE.Position]["IdArrive"].ToString()); bool hasTrxB = hasTrx(ds_master.ARRIVE[BS_ARRIVE.Position]["IdArrive"].ToString()); if (!hasDepartB && !hasTrxB) { DialogResult result = MessageBox.Show("Do you want to delete the arrive?", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question); switch (result) { case DialogResult.Yes: DataRowView De = (DataRowView)BS_CHAMBRE[BS_CHAMBRE.Find("NoCham", ds_master.ARRIVE[BS_ARRIVE.Position]["NoCham"])]; DTR_De = De.Row; DTR_De.BeginEdit(); DTR_De["Attribuee"] = false; DTR_De.EndEdit(); BS_ARRIVE.RemoveCurrent(); TA_ARRIVE.Update(ds_master.ARRIVE); TA_DE.Update(ds_master.DE); if (BS_ARRIVE.Count == 0) { Link_All(false); ic_arrive.WipeInformation(); ir_arrive.WipeInformation(); } Sync_ForeignTables(); MessageBox.Show("Deletion successful"); return(true); case DialogResult.No: return(false); default: return(false); } } else { MessageBox.Show("Can't delete an arrive with a " + (hasDepartB ? (hasTrxB ? "depart and a transaction" : "depart") : "transaction"), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } }
public void Fill() { string idArrive = null; if (BS_ARRIVE.Position >= 0) { try { idArrive = dS_Master.Tables["ARRIVE"].Rows[BS_ARRIVE.Position]["IdArrive"].ToString(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } if (State == States.ADD) { TA_ARRIVE.FillBy(this.dS_Master.ARRIVE, DateTime.Today.ToString()); } else { TA_ARRIVE.Fill(this.dS_Master.ARRIVE); } TA_CLIENT.Fill(this.dS_Master.CLIENT); TA_RESERVATION.Fill(this.dS_Master.RESERVATION); TA_DE.Fill(this.dS_Master.DE); if (State == States.CONSULT) { TA_DEPART.FillByDEPART(this.dS_Master.DEPART); } if (BS_ARRIVE != null && idArrive != null) { BS_ARRIVE.Position = BS_ARRIVE.Find("IdArrive", idArrive); } else { BS_ARRIVE.Position = 0; } Sync_ForeignTables(); }
public void Go_End() { BS_ARRIVE.MoveLast(); Sync_ForeignTables(); }
public void Go_Forward() { BS_ARRIVE.MoveNext(); Sync_ForeignTables(); }
public void Go_Back() { BS_ARRIVE.MovePrevious(); Sync_ForeignTables(); }
public void Go_Start() { BS_ARRIVE.MoveFirst(); Sync_ForeignTables(); }