public Job(Database db, string id = "") : base(db, "jobs", "Aufträge", id) { if (String.IsNullOrEmpty(id)) { base.Name = ""; this.services = new Dictionary<Service, int>(); this.reminders = new Dictionary<Reminder, DateTime>(); this.discounts = new List<Discount>(); this.bill = new Bill(db); this.items = new Dictionary<Item, int>(); this.status = JobStatus.S0_SAVED; this.offer_sent = DateTime.MinValue; this.delivery_date = DateTime.MinValue; this.offer_created = DateTime.Now; this.customer = new Customer(db); this.worker = new Worker(db); this.address = "C"; } else { Result d = base.DB.getRow(base.Tablename, new string[] { "name", "address", "jdate_sent", "worker_id", "jstatus", "customer_id", "jdate_created","jdate_target" }, "`id`='" + id + "'", "", 1); base.Name = d.FirstRow["name"]; this.status = (JobStatus)Enum.Parse(typeof(JobStatus), d.FirstRow["jstatus"]); this.offer_sent = DateTime.Parse(d.FirstRow["jdate_sent"]); this.offer_created = DateTime.Parse(d.FirstRow["jdate_created"]); this.delivery_date = DateTime.Parse(d.FirstRow["jdate_target"]); this.customer = new Customer(db, d.FirstRow["customer_id"]); this.worker = new Worker(db, d.FirstRow["worker_id"]); this.address = d.FirstRow["address"]; this.services = loadServices(); this.reminders = loadReminders(); this.discounts = loadDiscounts(); this.bill = loadBill(); this.items = loadItems(); } }
public override void Unload() { base.ID = ""; base.Name = ""; this.services = new Dictionary<Service, int>(); this.reminders = new Dictionary<Reminder, DateTime>(); this.discounts = new List<Discount>(); this.bill = new Bill(base.DB); this.items = new Dictionary<Item, int>(); this.status = JobStatus.S0_SAVED; this.offer_sent = DateTime.MinValue; this.delivery_date = DateTime.MinValue; this.offer_created = DateTime.Now; this.customer = new Customer(base.DB); this.worker = new Worker(base.DB); this.address = "C"; }
public void setWorker(string id) { this.worker = new Worker(base.DB, id); }
public override bool Load(string id) { base.ID = id; Result d = base.DB.getRow(base.Tablename, new string[] { "name", "address", "jdate_sent", "worker_id", "jstatus", "customer_id", "jdate_created", "jdate_target" }, "`id`='" + id + "'", "", 1); if (d.RowCount > 0) { base.Name = d.FirstRow["name"]; this.status = (JobStatus)Enum.Parse(typeof(JobStatus), d.FirstRow["jstatus"]); this.offer_sent = DateTime.Parse(d.FirstRow["jdate_sent"]); this.offer_created = DateTime.Parse(d.FirstRow["jdate_created"]); this.delivery_date = DateTime.Parse(d.FirstRow["jdate_target"]); this.customer = new Customer(base.DB, d.FirstRow["customer_id"]); this.worker = new Worker(base.DB, d.FirstRow["worker_id"]); this.address = d.FirstRow["address"]; this.services = loadServices(); this.reminders = loadReminders(); this.discounts = loadDiscounts(); this.bill = loadBill(); this.items = loadItems(); return true; } else return false; }