Ejemplo n.º 1
0
        public Subscription(Customer customer)
        {
            this._id = Guid.NewGuid ();

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

            this._type = Enums.SubscriptionType.Monthly;
            this._customerid = customer.Id;

            this._title = string.Empty;
            this._nextbilling = SNDK.Date.DateTimeToTimestamp (DateTime.Today.AddDays (2));

            this._status = Enums.SubscriptionStatus.Active;
        }
Ejemplo n.º 2
0
 public static List<Subscription> List(Customer customer)
 {
     return List (customer.Id);
 }
Ejemplo n.º 3
0
        public static Customer FromXmlDocument(XmlDocument xmlDocument)
        {
            Hashtable item = (Hashtable)SNDK.Convert.FromXmlDocument (xmlDocument);

            Customer result;

            if (item.ContainsKey ("id"))
            {
                try
                {
                    result = Customer.Load (new Guid ((string)item["id"]));
                }
                catch
                {
                    result = new Customer ();
                    result._id = new Guid ((string)item["id"]);
                }
            }
            else
            {
                result = new Customer ();
            }

            if (item.ContainsKey ("erpid"))
            {
                result._erpid = (string)item["erpid"];
            }

            if (item.ContainsKey ("name"))
            {
                result._c5debitor.Name = (string)item["name"];
            }

            if (item.ContainsKey ("address1"))
            {
                result._c5debitor.Address1 = (string)item["address1"];
            }

            if (item.ContainsKey ("address2"))
            {
                result._c5debitor.Address2 = (string)item["address2"];
            }

            if (item.ContainsKey ("postcode"))
            {
                result._c5debitor.PostCode = (string)item["postcode"];
            }

            if (item.ContainsKey ("city"))
            {
                result._c5debitor.City = (string)item["city"];
            }

            if (item.ContainsKey ("country"))
            {
                result._c5debitor.Country = (string)item["country"];
            }

            if (item.ContainsKey ("attention"))
            {
                result._c5debitor.Attention = (string)item["attention"];
            }

            if (item.ContainsKey ("phone"))
            {
                result._c5debitor.Phone = (string)item["phone"];
            }

            if (item.ContainsKey ("email"))
            {
                result._c5debitor.Email = (string)item["email"];
            }

            if (item.ContainsKey ("invoiceemail"))
            {
                result._c5debitor.Url = (string)item["invoiceemail"];
            }

            //			if (item.ContainsKey ("creditpolicy"))
            //			{
            //				result._c5debitor.CreditPolicy = (string)item["creditpolicy"];
            //			}

            if (item.ContainsKey ("vatno"))
            {
                result._c5debitor.VatNo = (string)item["vatno"];
            }

            //			if (item.ContainsKey ("vatcode"))
            //			{
            //				result._c5debitor.VatCode = (string)item["vatcode"];
            //			}

            return result;
        }
Ejemplo n.º 4
0
        public static Customer Load(Guid Id)
        {
            bool success = false;
            Customer result = new Customer ();

            QueryBuilder qb = new QueryBuilder (QueryBuilderType.Select);
            qb.Table (DatabaseTableName);
            qb.Columns
                (
                    "id",
                    "createtimestamp",
                    "updatetimestamp",
                    "erpid"
                    );

            qb.AddWhere ("id", "=", Id);

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

            if (query.Success)
            {
                if (query.NextRow ())
                {
                    result._id = query.GetGuid (qb.ColumnPos ("id"));
                    result._createtimestamp = query.GetInt (qb.ColumnPos ("createtimestamp"));
                    result._updatetimestamp = query.GetInt (qb.ColumnPos ("updatetimestamp"));
                    result._erpid = query.GetString (qb.ColumnPos ("erpid"));

                    success = true;
                }
            }

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

            result._c5debitor = C5.Debitor.Load (result._erpid);

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

            return result;
        }
Ejemplo n.º 5
0
 public static void Delete(Customer Customer)
 {
     Delete (Customer.Id);
 }