public static List <PlanAppoint> LoadListForTree(Database database, DateTime dateStart) { List <PlanAppoint> appointList = new List <PlanAppoint>(); string query = EntryControl.Resources.Doc.PlanAppoint.LoadList; QueryParameters parameters = CreateParametersForList(); if (database is EntryControlDatabase) { parameters["creator"] = ((EntryControlDatabase)database).ConnectedUser.Id; } parameters.Add("DateStart", dateStart); using (DbDataReader reader = database.ExecuteReader(query, parameters)) { while (reader.Read()) { PlanAppoint appoint = new PlanAppoint(reader); appoint.PermitState = (int)reader["permitState"]; appointList.Add(appoint); } reader.Close(); } return(appointList); }
public Permit(PlanAppoint appoint) : base() { PermitState = EntryControlDatabase.OneTimePermitState; DateFrom = appoint.DateFrom.AddDays(-1); DateTo = appoint.DateTo.AddDays(1); Cargo = (Cargo)appoint.Cargo; Vehicle = (Vehicle)appoint.Vehicle; DriverName = appoint.DriverName; Contact = appoint.Contact; MultiEntry = 0; planAppoint = appoint; comment = appoint.Comment; }
public PlanAppoint LoadCopy(Database database) { PlanAppoint planAppoint = null; string query = EntryControl.Resources.Doc.PlanAppoint.Load; QueryParameters parameters = new QueryParameters("id", Id); using (DbDataReader reader = database.ExecuteReader(query, parameters)) { if (reader.Read()) { planAppoint = new PlanAppoint(reader); } reader.Close(); } if (planAppoint == null) { throw new ArgumentOutOfRangeException(EntryControl.Resources.Message.Error.WrongIdentifier); } return(planAppoint); }