private void Initialise() { // Use order Gateway for all SQL I/O _ds = OrderGateway.Find(_orderId); if (_ds.Tables[0].Rows.Count > 0) { _isNewOrder = false; _customerId = _ds.Tables[0].Rows[0]["CustomerId"].ToString(); _buildingType = _ds.Tables[0].Rows[0]["BuildingType"].ToString(); _framePrice = (Decimal)_ds.Tables[0].Rows[0]["FramePrice"]; _status = (OrderStatus)Int32.Parse(_ds.Tables[0].Rows[0]["Status"].ToString()); } else { _isNewOrder = true; _ds.Tables[0].Rows.Add(_ds.Tables[0].NewRow()); _ds.Tables[0].Rows[0]["Created"] = DateTime.Now; _ds.Tables[0].Rows[0]["Status"] = OrderStatus.Unsubmitted; } }
private void Initialise() { DataSet ds = OrderGateway.Find(_orderId); if (ds.Tables[0].Rows.Count > 0) { _customerId = ds.Tables[0].Rows[0]["CustomerId"].ToString(); _buildingType = ds.Tables[0].Rows[0]["BuildingType"].ToString(); _framePrice = (Decimal)ds.Tables[0].Rows[0]["FramePrice"]; _created = (DateTime)ds.Tables[0].Rows[0]["Created"]; _status = (OrderStatus)Enum.Parse(typeof(OrderStatus), ds.Tables[0].Rows[0]["Status"].ToString()); if (string.IsNullOrEmpty(ds.Tables[0].Rows[0]["PlanningRejection"].ToString())) { _planningRejected = null; } else { _planningRejected = (Nullable <DateTime>)ds.Tables[0].Rows[0]["PlanningRejection"]; } if (string.IsNullOrEmpty(ds.Tables[0].Rows[0]["PlanningGranted"].ToString())) { _planningGranted = null; } else { _planningGranted = (Nullable <DateTime>)ds.Tables[0].Rows[0]["PlanningGranted"]; } if (string.IsNullOrEmpty(ds.Tables[0].Rows[0]["ContractSigned"].ToString())) { _contractSigned = null; } else { _contractSigned = (Nullable <DateTime>)ds.Tables[0].Rows[0]["ContractSigned"]; } if (string.IsNullOrEmpty(ds.Tables[0].Rows[0]["EstimateFabDate"].ToString())) { _estimatedFab = null; } else { _estimatedFab = (DateTime)ds.Tables[0].Rows[0]["EstimateFabDate"]; } if (string.IsNullOrEmpty(ds.Tables[0].Rows[0]["AssemblyDate"].ToString())) { _assemblyDate = null; } else { _assemblyDate = (Nullable <DateTime>)ds.Tables[0].Rows[0]["AssemblyDate"]; } if (string.IsNullOrEmpty(ds.Tables[0].Rows[0]["FoundationDate"].ToString())) { _foundationReady = null; } else { _foundationReady = (Nullable <DateTime>)ds.Tables[0].Rows[0]["FoundationDate"]; } if (string.IsNullOrEmpty(ds.Tables[0].Rows[0]["PlanningInvoice"].ToString())) { _planningInvoice = null; } else { _planningInvoice = (Nullable <DateTime>)ds.Tables[0].Rows[0]["PlanningInvoice"]; } if (string.IsNullOrEmpty(ds.Tables[0].Rows[0]["OrderInvoice"].ToString())) { _orderInvoice = null; } else { _orderInvoice = (Nullable <DateTime>)ds.Tables[0].Rows[0]["OrderInvoice"]; } if (string.IsNullOrEmpty(ds.Tables[0].Rows[0]["DelayInvoice"].ToString())) { _delayInvoice = null; } else { _delayInvoice = (Nullable <DateTime>)ds.Tables[0].Rows[0]["DelayInvoice"]; } } }