Esempio n. 1
0
        public Item(Case Case)
        {
            this._id = Guid.NewGuid ();

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

            this._no = Helpers.NewNo ();
            this._catalogno = Helpers.NewCatalogNo (Case.Auction);

            this._caseid = Case.Id;
            this._auctionid = Case.AuctionId;

            this._title = string.Empty;
            this._description = string.Empty;

            this._vat = false;

            this._minimumbid = 0;

            this._appraisal1 = 0;
            this._appraisal2 = 0;
            this._appraisal3 = 0;

            this._fields = new Hashtable ();

            this._invoiced = false;
            this._approvedforinvoice = false;
            this._settled = false;

            this._pictureid = Guid.Empty;
        }
Esempio n. 2
0
 public Settlement(Case Case)
 {
     this._id = Guid.NewGuid ();
     this._createtimestamp = SNDK.Date.CurrentDateTimeToTimestamp ();
     this._updatetimestamp = SNDK.Date.CurrentDateTimeToTimestamp ();
     this._no = 0;
     this._auctionid = Case.AuctionId;
     this._caseid = Case.Id;
     this._customerid = Case.CustomerId;
     this._lines = new List<SettlementLine> ();
     this._caseno = Case.No;
     this._reference = Case.CustomerReference;
 }
Esempio n. 3
0
 public static List<Item> List(Case Case)
 {
     return List (Case.Id);
 }
Esempio n. 4
0
        public static List<Settlement> List(Case Case)
        {
            List<Settlement> result = new List<Settlement> ();

            foreach (string id in SorentoLib.Services.Datastore.ListOfShelfs (DatastoreAisle, new SorentoLib.Services.Datastore.MetaSearch ("caseid", SorentoLib.Enums.DatastoreMetaSearchComparisonOperator.Equal, Case.Id)))
            {
                try
                {
                    result.Add (Load (new Guid (id)));
                }
                catch (Exception exception)
                {
                    // LOG: LogDebug.ExceptionUnknown
                    SorentoLib.Services.Logging.LogDebug (string.Format (SorentoLib.Strings.LogDebug.ExceptionUnknown, "DIDIUS.SETTLEMENT", exception.Message));

                    // LOG: LogDebug.SettlementList
                    SorentoLib.Services.Logging.LogDebug (string.Format (Strings.LogDebug.SettlementList, id));
                }
            }

            return result;
        }
Esempio n. 5
0
        public static Settlement Create(Case Case, bool Simulate)
        {
            Settlement result = new Settlement (Case);

            List<Item> items = Item.List (Case.Id);

            foreach (Item item in items)
            {
                if (!item.Settled)
                {
                    result.Lines.Add (new SettlementLine (item));
                }
            }

            if (result.Lines.Count == 0)
            {
                // EXCEPTION: Exception.SettlementEmpty
                throw new Exception (string.Format (Strings.Exception.SettlementEmpty));
            }

            if (!Simulate)
            {
                foreach (SettlementLine line in result.Lines)
                {
                    Item item = Item.Load (line.ItemId);
                    item.Settled = true;
                    item.Save ();
                }

                result.Save ();
            }

            return result;
        }
Esempio n. 6
0
 public static Settlement Create(Case Case)
 {
     return Create (Case, false);
 }
Esempio n. 7
0
        public static Case Load(Guid Id)
        {
            Case result;

            try
            {
                Hashtable item = (Hashtable)SNDK.Convert.FromXmlDocument (SNDK.Convert.XmlNodeToXmlDocument (SorentoLib.Services.Datastore.Get<XmlDocument> (DatastoreAisle, Id.ToString ()).SelectSingleNode ("(//didius.case)[1]")));
                result = new Case ();

                result._id = new Guid ((string)item["id"]);

                if (item.ContainsKey ("createtimestamp"))
                {
                    result._createtimestamp = int.Parse ((string)item["createtimestamp"]);
                }

                if (item.ContainsKey ("updatetimestamp"))
                {
                    result._updatetimestamp = int.Parse ((string)item["updatetimestamp"]);
                }

                if (item.ContainsKey ("no"))
                {
                    result._no = (string)item["no"];
                }

                if (item.ContainsKey ("customerid"))
                {
                    result._customerid = new Guid ((string)item["customerid"]);
                }

                if (item.ContainsKey ("auctionid"))
                {
                    result._auctionid = new Guid ((string)item["auctionid"]);
                }

                if (item.ContainsKey ("title"))
                {
                    result._title = (string)item["title"];
                }

                if (item.ContainsKey ("customerreference"))
                {
                    result._customerreference = (string)item["customerreference"];
                }

                if (item.ContainsKey ("preparationfee"))
                {
                    result._preparationfee = decimal.Parse ((string)item["preparationfee"]);
                }

                if (item.ContainsKey ("commisionfeepercentage"))
                {
                    result._commisionfeepercentage = decimal.Parse ((string)item["commisionfeepercentage"]);
                }

                if (item.ContainsKey ("commisionfeeminimum"))
                {
                    result._commisionfeeminimum = decimal.Parse ((string)item["commisionfeeminimum"]);
                }

                if (item.ContainsKey ("settled"))
                {
                    result._settled = (bool)item["settled"];
                }
            }
            catch (Exception exception)
            {
                // LOG: LogDebug.ExceptionUnknown
                SorentoLib.Services.Logging.LogDebug (string.Format (SorentoLib.Strings.LogDebug.ExceptionUnknown, "DIDIUS.CASE", exception.Message));

                // EXCEPTION: Excpetion.PageLoadName
                throw new Exception (string.Format (Strings.Exception.CaseLoadGuid, Id));
            }

            return result;
        }
Esempio n. 8
0
        public static Case FromXmlDocument(XmlDocument xmlDocument)
        {
            Hashtable item;
            Case result = new Case ();

            try
            {
                item = (Hashtable)SNDK.Convert.FromXmlDocument (SNDK.Convert.XmlNodeToXmlDocument (xmlDocument.SelectSingleNode ("(//didius.Case)[1]")));
            }
            catch
            {
                item = (Hashtable)SNDK.Convert.FromXmlDocument (xmlDocument);
            }

            if (item.ContainsKey ("id"))
            {
                result._id = new Guid ((string)item["id"]);
            }
            else
            {
                throw new Exception (string.Format (Strings.Exception.CaseFromXmlDocument, "ID"));
            }

            if (item.ContainsKey ("createtimestamp"))
            {
                result._createtimestamp = int.Parse ((string)item["createtimestamp"]);
            }

            if (item.ContainsKey ("updatetimestamp"))
            {
                result._updatetimestamp = int.Parse ((string)item["updatetimestamp"]);
            }

            if (item.ContainsKey ("no"))
            {
                result._no = (string)item["no"];
            }

            if (item.ContainsKey ("customerid"))
            {
                result._customerid = new Guid ((string)item["customerid"]);
            }
            else
            {
                throw new Exception (string.Format (Strings.Exception.CaseFromXmlDocument, "CUSTOMERID"));
            }

            if (item.ContainsKey ("auctionid"))
            {
                result._auctionid = new Guid ((string)item["auctionid"]);
            }
            else
            {
                throw new Exception (string.Format (Strings.Exception.CaseFromXmlDocument, "AUCTIONID"));
            }

            if (item.ContainsKey ("auctionid"))
            {
                result._auctionid = new Guid ((string)item["auctionid"]);
            }

            if (item.ContainsKey ("title"))
            {
                result._title = (string)item["title"];
            }

            if (item.ContainsKey ("customerreference"))
            {
                result._customerreference = (string)item["customerreference"];
            }

            if (item.ContainsKey ("preparationfee"))
            {
                result._preparationfee = decimal.Parse ((string)item["preparationfee"]);
            }

            if (item.ContainsKey ("commisionfeepercentage"))
            {
                result._commisionfeepercentage = decimal.Parse ((string)item["commisionfeepercentage"]);
            }

            if (item.ContainsKey ("commisionfeeminimum"))
            {
                result._commisionfeeminimum = decimal.Parse ((string)item["commisionfeeminimum"]);
            }

            if (item.ContainsKey ("settled"))
            {
                result._settled = (bool)item["settled"];
            }

            return result;
        }