Ejemplo n.º 1
0
        public OrderLine(Order Order)
        {
            this._id = C5.Helpers.NewSequenceNumber ().ToString ();

            this._createtimestamp = SNDK.Date.CurrentDateTimeToTimestamp ();
            this._updatetimestamp = SNDK.Date.CurrentDateTimeToTimestamp ();

            this._orderid = Order.Id;
            this._productid = string.Empty;

            this._sort = 0;

            this._periodbegin = DateTime.Now;
            this._periodend = DateTime.Now;

            this._text = string.Empty;

            this._amount = 0;
            this._unit = string.Empty;

            this._price = 0;
            this._total = 0;

            this._notes = string.Empty;
        }
Ejemplo n.º 2
0
 public static List<OrderLine> List(Order Order)
 {
     return List (Order.Id);
 }
Ejemplo n.º 3
0
        public static Order Load(string Id)
        {
            bool success = false;
            Order result = new Order ();

            QueryBuilder qb = new QueryBuilder (QueryBuilderType.Select);
            qb.Table ("ordkart");
            qb.Columns
                (
                    "sidstrettet",
                    "oprettet",
                    "konto"
                );

            qb.AddWhere ("nummer like '%"+ Id +"'");

            Query query = Runtime.DBConnection.Query (qb.QueryString);

            if (query.Success)
            {
                if (query.NextRow ())
                {
                    result._id = Id;
                    result._createtimestamp = SNDK.Date.DateTimeToTimestamp (query.GetDateTime (qb.ColumnPos ("oprettet")));
                    result._updatetimestamp = SNDK.Date.DateTimeToTimestamp (query.GetDateTime (qb.ColumnPos ("sidstrettet")));
                    result._debitor = C5.Debitor.Load (query.GetString (qb.ColumnPos ("konto")).Replace (" ", ""));

                    success = true;
                }
            }

            query.Dispose ();
            query = null;
            qb = null;

            if (!success)
            {
                // Exception: OrderLoadId
                throw new Exception (string.Format (Strings.Exception.OrderLoadId, Id));
            }

            // Load orderlines.
            result._orderlines = OrderLine.List (result);

            // TEMP2
            result._temp2 = false;

            return result;
        }