public CloneOrderTableCollection FetchAll()
 {
     CloneOrderTableCollection coll = new CloneOrderTableCollection();
     Query qry = new Query(CloneOrderTable.Schema);
     coll.LoadAndCloseReader(qry.ExecuteReader());
     return coll;
 }
    /// <summary>
    /// clone form is just ReadOnly we do not need any other functionality as it is for identical copies of an existing order
    /// if orderid is passed as param (pid) get data from order table
    /// </summary>
    /// <param name="ordertemplateid"></param>
    protected void bind_formview(int orderid)
    {
        string[] _key = { "OrderNumber" };
        CloneOrderTableCollection _col = new CloneOrderTableCollection();

        if (this.fmvTemplate.CurrentMode == FormViewMode.ReadOnly)
        {
            //blank template
            CloneOrderTable _clone = new CloneOrderTable();
 
            //create clone from selected order number (the clone table does not contain order id)
            int _orderid = wwi_func.vint(wwi_security.DecryptString(get_token("pid"), "publiship"));
            
            if (_orderid > 0)
            {
                //copy from order to template
                OrderTable _order = new OrderTable(_orderid);

                _clone.DateOrderCreated = DateTime.Now;
                _clone.PublishipOrder = _order.PublishipOrder;
                _clone.OfficeIndicator = _order.OfficeIndicator;
                _clone.CompanyID = _order.CompanyID;
                _clone.ConsigneeID = _order.ConsigneeID;
                _clone.NotifyPartyID = _order.NotifyPartyID;
                _clone.AgentAtOriginID = _order.AgentAtOriginID;
                _clone.AgentAtDestinationID = _order.AgentAtDestinationID;
                _clone.PrinterID = _order.PrinterID;
                _clone.ClearingAgentID = _order.ClearingAgentID;
                _clone.OnCarriageID = _order.OnCarriageID;
                _clone.OrderControllerID = _order.OrderControllerID;
                _clone.OperationsControllerID = _order.OperationsControllerID;
                _clone.OriginPortControllerID = _order.OriginPortControllerID;
                _clone.DestinationPortControllerID = _order.DestinationPortControllerID;
                _clone.CustomersRef = _order.CustomersRef;
                _clone.ContactID = _order.ContactID;
                _clone.OriginPointID = _order.OriginPointID;
                _clone.PortID = _order.PortID;
                _clone.DestinationPortID = _order.DestinationPortID;
                _clone.FinalDestinationID = _order.FinalDestinationID;
                _clone.CountryID = _order.CountryID;
                _clone.DestinationCountryID = _order.DestinationCountryID;
            }
            
            _col.Add(_clone);

            this.fmvTemplate.DataSource = _col;
            this.fmvTemplate.DataKeyNames = _key;
            this.fmvTemplate.DataBind(); 

        }
        else
        {
            //_col.Add(new CloneOrderTable());
            //error we must have an order number to clone from
            this.dxlblErr.Text = "No order number has been selected for cloning";
            this.dxpnlErr.ClientVisible = true;
        }
    }
 public CloneOrderTableCollection FetchByQuery(Query qry)
 {
     CloneOrderTableCollection coll = new CloneOrderTableCollection();
     coll.LoadAndCloseReader(qry.ExecuteReader()); 
     return coll;
 }
 public CloneOrderTableCollection FetchByID(object OrderNumber)
 {
     CloneOrderTableCollection coll = new CloneOrderTableCollection().Where("OrderNumber", OrderNumber).Load();
     return coll;
 }