示例#1
0
        public AutoBid(Customer Customer, Item Item, decimal Amount)
        {
            this._id = Guid.NewGuid ();

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

            this._customerid = Customer.Id;
            this._itemid = Item.Id;

            this._sort = DateTime.Now.Ticks;

            this._amount = Amount;

            this._active = true;

            if (Item.Invoiced)
            {
                // EXCEPTION: Exception.BidItemInvoiced
                throw new Exception (Strings.Exception.BidItemInvoiced);
            }
            else if (Item.Settled)
            {
                // EXCEPTION: Exception.BidItemSettled
                throw new Exception (Strings.Exception.BidItemSettled);
            }
        }
示例#2
0
 public TurnoverReportSeller(Customer Customer)
 {
     this._id = Customer.Id;
     this._text = Customer.Name;
     this._amount = 0;
     this._vatamount = 0;
     this._commissionfee = 0;
     this._vatcommissionfee = 0;
 }
示例#3
0
        public Invoice(Customer Customer)
        {
            this._id = Guid.NewGuid ();

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

            this._no = 0;

            this._auctionids = new List<Guid> ();
            this._customerid = Customer.Id;

            this._lines = new List<InvoiceLine> ();
        }
示例#4
0
        public Creditnote(Customer Customer, List<CreditnoteLine> Lines)
        {
            this._id = Guid.NewGuid ();

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

            this._no = 0;

            this._customerid = Customer.Id;

            this._vat = 0;
            this._total = 0;

            this._lines = Lines;
        }
示例#5
0
文件: Case.cs 项目: sundowndk/Didius
        public Case(Auction Auction, Customer Customer)
        {
            this._id = Guid.NewGuid ();

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

            this._no = Helpers.NewNo ();

            this._customerid = Customer.Id;
            this._auctionid = Auction.Id;

            this._title = string.Empty;
            this._customerreference = string.Empty;

            this._preparationfee = 0;
            this._commisionfeepercentage = 0;
            this._commisionfeeminimum = 0;
            this._commisionfeepercentage = SorentoLib.Services.Settings.Get<int> (Enums.SettingsKey.didius_value_seller_commission_percentage);
            this._commisionfeeminimum = SorentoLib.Services.Settings.Get<int> (Enums.SettingsKey.didius_value_seller_commission_minimum);

            this._settled = false;
        }
示例#6
0
文件: Item.cs 项目: sundowndk/Didius
        public static void Bid(Customer Customer, Item Item, decimal Amount)
        {
            if (Amount > 0 && Amount > Item.NextBidAmount)
            {
                // Create new AutoBud.
                AutoBid autobid = new AutoBid (Customer, Item, Amount);
                autobid.Save ();

            //				Console.WriteLine ("[1]SENDMAIL: Autobid placed: "+ Amount);
                SorentoLib.Tools.Helpers.SendMail (SorentoLib.Services.Settings.Get<string> (Enums.SettingsKey.didius_email_sender), Customer.Email, "Autobud oprettet","Du har oprettet et autobud på:\n Katalog nr.: "+ Item.CatalogNo +"\n\n"+ Item.Title +"\n\n"+"Autobud max: "+ Amount +" kr.\n\n");

                // If no other bids have been made, place the first one.
            //				if (Item.BidAmount == 0)
            //				{
            //					decimal nextbidamount = Item.NextBidAmount;
            //					Bid bid = new Bid (Customer, Item, nextbidamount);
            //					bid.Save ();

            //					Console.WriteLine ("[2]SENDMAIL: Autobid Bid placed: "+ nextbidamount);
            //					SorentoLib.Tools.Helpers.SendMail ("*****@*****.**", Customer.Email, "Bud afgivet","Du har afgivet et autobud på effekt: "+ Item.Title +"\n\n"+"Bud sum: "+ nextbidamount +" kr.\n\n");
            //				}

                SorentoLib.Services.Logging.LogDebug ("[DIDIUS.ITEM]: Autobid placed on item "+ Item.Id);
            }
            else if (Amount > 0 && Amount < Item.NextBidAmount)
            {
                Bid bid = new Bid (Customer, Item, Amount);
                bid.Save ();

            //				Console.WriteLine ("[2]SENDMAIL: Bid placed: "+ Amount);
                SorentoLib.Tools.Helpers.SendMail (SorentoLib.Services.Settings.Get<string> (Enums.SettingsKey.didius_email_sender), Customer.Email, "Bud afgivet","Du har afgivet et bud på effekt: "+ Item.Title +"\n\n"+"Bud sum: "+ Amount +" kr.\n\n");
            //				Console.WriteLine ("[3]SENDMAIL: Bid overbid: "+ Amount +" < "+ Item.NextBidAmount);
                SorentoLib.Tools.Helpers.SendMail (SorentoLib.Services.Settings.Get<string> (Enums.SettingsKey.didius_email_sender), Customer.Email, "Overbudt","Din bud sum på "+ Amount +" kr. på effekt: "+ Item.Title +" er blevet overbudt.\n\n");

                SorentoLib.Services.Logging.LogDebug ("[DIDIUS.ITEM]: Low bid placed on item "+ Item.Id);
            }
            else
            {
                decimal nextbidamount = Item.NextBidAmount;
                bool autobidplaced = false;

                // Place any AutoBids that equal the next bid amount.
                {
                    List<AutoBid> autobids = AutoBid.List (Item);
                    foreach (AutoBid autobid in autobids)
                    {
                        if (autobid.Amount == nextbidamount)
                        {
                            Bid bid = new Bid (Customer.Load (autobid.CustomerId), Item, nextbidamount);
                            bid.Save ();

                            autobidplaced = true;

            //							Console.WriteLine ("[4]SENDMAIL: Autobid Bid placed: "+ nextbidamount +" ("+ Customer.Load (autobid.CustomerId).Name +")");
                            SorentoLib.Tools.Helpers.SendMail (SorentoLib.Services.Settings.Get<string> (Enums.SettingsKey.didius_email_sender), Customer.Load (autobid.CustomerId).Email, "Bud afgivet","Du har afgivet et autobud på effekt: "+ Item.Title +"\n\n"+"Bud sum: "+ nextbidamount +" kr.\n\n");
                        }
                    }
                }

                // Place single bid.
                {
                    Bid bid = new Bid (Customer, Item, nextbidamount);
                    bid.Save ();

            //					Console.WriteLine ("[5]SENDMAIL: Bid placed: "+ nextbidamount);
                    SorentoLib.Tools.Helpers.SendMail (SorentoLib.Services.Settings.Get<string> (Enums.SettingsKey.didius_email_sender), Customer.Email, "Bud afgivet","Du har afgivet et bud på effekt: "+ Item.Title +"\n\n"+"Bud sum: "+ nextbidamount +" kr.\n\n");

            //					if (autobidplaced)
            //					{
            //						Console.WriteLine ("[7]SENDMAIL: Bid overbid: "+ nextbidamount +" < ???");
            //						SorentoLib.Tools.Helpers.SendMail ("*****@*****.**", Customer.Email, "Overbudt","Din bud sum på "+ nextbidamount +" kr. på effekt: "+ Item.Title +" er blevet overbudt af et tidligere bud med samme sum.\n\n");
            //					}
                }

                SorentoLib.Services.Logging.LogDebug ("[DIDIUS.ITEM]: High bid placed on item "+ Item.Id);
            }

            // Place AutoBids
            {
                decimal nextbidamount = Item.NextBidAmount;
                decimal currentbidamount = Item.BidAmount;
                List<AutoBid> autobids = AutoBid.List (Item);

                // Place highest AutoBid.
                if (autobids.Count > 0)
                {
                    AutoBid high = autobids[0];
                    decimal low = currentbidamount;

                    // See if we have more than one Autobid.
                    if (autobids.Count > 1)
                    {
                        // Only AutoBids that are still above the current bid amount.
                        if (autobids[1].Amount > currentbidamount)
                        {
                            low = autobids[1].Amount;
                        }
                    }

                    if (high.Amount >= nextbidamount)
                    {
                        decimal bla = CalculateNextBidAmount (low);
            //						Console.WriteLine (bla);
                        if (bla > high.Amount)
                        {
                            bla = high.Amount;
                        }

                        Bid bid = new Bid (Customer.Load (high.CustomerId), Item, bla);
                        bid.Save ();
            //						Console.WriteLine ("[6]SENDMAIL: Autobid Bid placed: "+ bla +" ("+ Customer.Load (high.CustomerId).Name +")");
                        SorentoLib.Tools.Helpers.SendMail (SorentoLib.Services.Settings.Get<string> (Enums.SettingsKey.didius_email_sender), Customer.Load (high.CustomerId).Email, "Bud afgivet","Du har afgivet et autobud på effekt: "+ Item.Title +"\n\n"+"Bud sum: "+ CalculateNextBidAmount (low) +" kr.\n\n");

                        foreach (AutoBid autobid in autobids)
                        {
                            if (autobid.Id != high.Id && autobid.Amount == bla)
                            {
                                Bid bid2 = new Bid (Customer.Load (autobid.CustomerId), Item, bla);
                                bid2.Save ();
            //								Console.WriteLine ("[7]SENDMAIL: Autobid Bid placed: "+ bla +" ("+ Customer.Load (autobid.CustomerId).Name +")");
                                SorentoLib.Tools.Helpers.SendMail (SorentoLib.Services.Settings.Get<string> (Enums.SettingsKey.didius_email_sender), Customer.Email, "Bud afgivet","Du har afgivet et autobud på effekt: "+ Item.Title +"\n\n"+"Bud sum: "+ nextbidamount +" kr.\n\n");

            //								Console.WriteLine ("[9]SENDMAIL: Bid overbid by Autobid : "+ Amount +" < "+ bla +"("+ Customer.Load (autobid.CustomerId).Name +")");
                                SorentoLib.Tools.Helpers.SendMail (SorentoLib.Services.Settings.Get<string> (Enums.SettingsKey.didius_email_sender), Customer.Load (autobid.CustomerId).Email, "Overbudt","Din bud sum på "+ autobid.Amount +" kr. på effekt: "+ Item.Title +" er blevet overbudt.\n\n");

                            }
                        }
                    }
                }

                // Place any AutoBids that equal next bid amount.
                foreach (AutoBid autobid in autobids)
                {
                    if (autobid.Amount > currentbidamount && autobid.Amount < Item.BidAmount)
                    {
                        Bid bid = new Bid (Customer.Load (autobid.CustomerId), Item, autobid.Amount);
                        bid.Save ();
            //						Console.WriteLine ("[8]SENDMAIL: Autobid Bid placed: "+ autobid.Amount +" ("+ Customer.Load (autobid.CustomerId).Name +")");
                        SorentoLib.Tools.Helpers.SendMail (SorentoLib.Services.Settings.Get<string> (Enums.SettingsKey.didius_email_sender), Customer.Load (autobid.CustomerId).Email, "Bud afgivet","Du har afgivet et autobud på effekt: "+ Item.Title +"\n\n"+"Bud sum: "+ Amount +" kr.\n\n");

            //						Console.WriteLine ("[9]SENDMAIL: Bid overbid: "+ autobid.Amount +" < "+ Item.NextBidAmount +"("+ Customer.Load (autobid.CustomerId).Name +")");
                        SorentoLib.Tools.Helpers.SendMail (SorentoLib.Services.Settings.Get<string> (Enums.SettingsKey.didius_email_sender), Customer.Load (autobid.CustomerId).Email, "Overbudt","Din bud sum på "+ Amount +" kr. på effekt: "+ Item.Title +" er blevet overbudt.\n\n");
                    }
                }
            }
        }
示例#7
0
文件: Item.cs 项目: sundowndk/Didius
 public static void Bid(Customer Customer, Item Item)
 {
     Bid (Customer, Item, 0);
 }
示例#8
0
文件: Item.cs 项目: sundowndk/Didius
 public static void OnlineBid(Customer Customer, Item Item)
 {
     Bid bid = new Bid (Customer, Item, Item.NextBidAmount);
     bid.Save ();
 }
示例#9
0
        public static Invoice Create(Auction Auction, Customer Customer, bool Simulate)
        {
            Invoice result = new Invoice (Customer);

            List<Item> items;

            if (Auction != null)
            {
                items = Item.List (Auction);
            }
            else
            {
                items = Item.List ();
            }

            foreach (Item item in items)
            {
                if (item.AppovedForInvoice)
                {
                    if (!item.Invoiced)
                    {
                        if (item.CurrentBid != null)
                        {
                            if (item.CurrentBid.CustomerId == Customer.Id)
                            {
                                Case _case = Case.Load (item.CaseId);
                                result._auctionids.Add (_case.AuctionId);

                                result.Lines.Add (new InvoiceLine (item));
                            }
                        }
                    }
                }
            }

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

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

                result.Save ();
            }

            return result;
        }
示例#10
0
        public static List<Creditnote> List(Customer Customer)
        {
            List<Creditnote> result = new List<Creditnote> ();

            foreach (string id in SorentoLib.Services.Datastore.ListOfShelfs (DatastoreAisle, new SorentoLib.Services.Datastore.MetaSearch ("customerid", SorentoLib.Enums.DatastoreMetaSearchComparisonOperator.Equal, Customer.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.CREDITNOTE", exception.Message));

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

            return result;
        }
示例#11
0
 public static Creditnote Create(Customer Customer, List<CreditnoteLine> Lines)
 {
     return Create (Customer, Lines, false);
 }
示例#12
0
 public static Creditnote Create(Customer Customer, List<Item> Items)
 {
     return Create (Customer, Items, false);
 }
示例#13
0
        public static Bid GetCustomersHighBidOnItem(Customer Customer, Item Item)
        {
            Bid result = null;

            foreach (Bid bid in Bid.List (Item))
            {
                if (bid.CustomerId == Customer.Id)
                {
                    result = bid;
                    break;
                }
            }

            return result;
        }
示例#14
0
        public static List<Auction> GetAuctionsCustomerBidOn(Customer Customer)
        {
            List<Auction> result = new List<Auction> ();
            List<Guid> auctionids = new List<Guid> ();

            foreach (Bid bid in Bid.List (Customer))
            {
                Guid auctionid = Item.Load (bid.ItemId).Case.AuctionId;

                if (!auctionids.Contains (auctionid))
                {
                    auctionids.Add (auctionid);
                }
            }

            foreach (Guid id in auctionids)
            {
                result.Add (Auction.Load (id));
            }

            return result;
        }
示例#15
0
 public static Invoice Create(Customer Customer)
 {
     return Create (null, Customer, false);
 }
示例#16
0
文件: Case.cs 项目: sundowndk/Didius
 public static List<Case> List(Customer Customer)
 {
     return List (Customer.Id);
 }
示例#17
0
 public static Invoice Create(Customer Customer, bool Simulate)
 {
     return Create (null, Customer, Simulate);
 }
示例#18
0
 public static Creditnote Create(Customer Customer, Item Item)
 {
     return Create (Customer, Item, false);
 }
示例#19
0
        public static List<Item> GetItemsCustomerBidOn(Customer Customer, Auction Auction)
        {
            List<Item> result = new List<Item> ();
            List<Guid> itemids = new List<Guid> ();

            foreach (Bid bid in Bid.List (Customer))
            {
                if (!itemids.Contains (bid.ItemId))
                {
                    Item item = Item.Load (bid.ItemId);
                    if (item.Case.AuctionId == Auction.Id)
                    {
                        itemids.Add (bid.ItemId);
                        result.Add (item);
                    }
                }
            }

            return result;
        }
示例#20
0
        public static Creditnote Create(Customer Customer, Item Item, bool Simulate)
        {
            List<Item> items = new List<Didius.Item> ();
            items.Add (Item);

            return Create (Customer, items, Simulate);
        }
示例#21
0
        public static List<AutoBid> List(Customer Customer)
        {
            List<AutoBid> result = new List<AutoBid> ();

            //			foreach (string id in SorentoLib.Services.Datastore.ListOfShelfs (DatastoreAisle, new SorentoLib.Services.Datastore.MetaSearch ("customerid", SorentoLib.Enums.DatastoreMetaSearchComparisonOperator.Equal, Customer.Id)))
            foreach (SorentoLib.Services.DatastoreItem item in SorentoLib.Services.Datastore.ListOfShelfsNew (DatastoreAisle, new SorentoLib.Services.Datastore.MetaSearch ("customerid", SorentoLib.Enums.DatastoreMetaSearchComparisonOperator.Equal, Customer.Id)))
            {
                try
                {
            //					result.Add (Load (new Guid (id)));
                    result.Add (FromXmlDocument (item.Get<XmlDocument> ()));
                }
                catch (Exception exception)
                {
                    // LOG: LogDebug.ExceptionUnknown
                    SorentoLib.Services.Logging.LogDebug (string.Format (SorentoLib.Strings.LogDebug.ExceptionUnknown, "DIDIUS.AUTOBID", exception.Message));

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

            result = result.OrderByDescending (o => o._amount).ThenBy(o => o._sort).ToList<AutoBid> ();

            //			result.Sort (delegate(AutoBid b1, AutoBid b2) { return b1.CreateTimestamp.CompareTo (b2.CreateTimestamp); });
            //			result.Reverse ();

            return result;
        }
示例#22
0
        public static Creditnote Create(Customer Customer, List<Item> Items, bool Simulate)
        {
            List<CreditnoteLine> lines = new List<CreditnoteLine> ();

            foreach (Item item in Items)
            {
                lines.Add (new CreditnoteLine (item));
            }

            return Create (Customer, lines, Simulate);
        }
示例#23
0
        private static Customer FromXmlDocument(XmlDocument xmlDocument, bool skip)
        {
            Hashtable item;
            Customer result = new Customer ();

            try
            {
                item = (Hashtable)SNDK.Convert.FromXmlDocument (SNDK.Convert.XmlNodeToXmlDocument (xmlDocument.SelectSingleNode ("(//didius.customer)[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.CustomerFromXmlDocument, "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 ("groups"))
            {
                result._groups.Clear ();

                foreach (XmlDocument customergroup in (List<XmlDocument>)item["groups"])
                {
                    result._groups.Add (CustomerGroup.FromXmlDocument (customergroup));
                }
            }

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

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

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

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

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

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

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

            if (item.ContainsKey ("att"))
            {
                result._att = (string)item["att"];
            }

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

            if (item.ContainsKey ("mobile"))
            {
                result._mobile = (string)item["mobile"];
            }

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

            //			if (item.ContainsKey ("phonenumbers"))
            //			{
            //				result._phonenumbers = new List<string> ();
            //				foreach (XmlDocument phonenumber in (List<XmlDocument>)item["phonenumbers"])
            //				{
            //					result._phonenumbers.Add ((string)((Hashtable)SNDK.Convert.FromXmlDocument (phonenumber))["value"]);
            //				}
            //			}

            if (item.ContainsKey ("newsemail"))
            {
                result._newsemail = (bool)item["newsemail"];
            }

            if (item.ContainsKey ("newssms"))
            {
                result._newssms = (bool)item["newssms"];
            }

            if (item.ContainsKey ("vat"))
            {
                result._vat = (bool)item["vat"];
            }

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

            if (item.ContainsKey ("bankname"))
            {
                result._bankname = (string)item["bankname"];
            }

            if (item.ContainsKey ("bankregistrationno"))
            {
                result._bankregistrationno = (string)item["bankregistrationno"];
            }

            if (item.ContainsKey ("bankaccountno"))
            {
                result._bankaccountno = (string)item["bankaccountno"];
            }

            if (item.ContainsKey ("notes"))
            {
                result._notes = (string)item["notes"];
            }

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

            if (item.ContainsKey ("status"))
            {
                if (skip)
                {
                    result._status = SNDK.Convert.StringToEnum<Enums.CustomerStatus> ((string)item["status"]);
                }
                else
                {
                    result.Status = SNDK.Convert.StringToEnum<Enums.CustomerStatus> ((string)item["status"]);
                }
            }

            return result;
        }
示例#24
0
        public static Creditnote Create(Customer Customer, List<CreditnoteLine> Lines, bool Simulate)
        {
            foreach (CreditnoteLine line in Lines)
            {
                if (!Item.Load (line.ItemId).Invoiced)
                {
                    // EXCEPTION: Exception.CreditnoteCreateItemNotInvoiced
                    throw new Exception (string.Format (Strings.Exception.CreditnoteCreateItemNotInvoiced));
                }
            }

            Creditnote result = new Creditnote (Customer, Lines);

            if (result.Total == 0)
            {
                // EXCEPTION: Exception.CreditnoteCreateEmpty
                throw new Exception (string.Format (Strings.Exception.CreditnoteCreateEmpty));
            }

            if (!Simulate)
            {
                foreach (CreditnoteLine line in result.Lines)
                {
                    Item item = Item.Load (line.ItemId);
                    item.Invoiced = false;
                    item.Save ();
                }
                result.Save ();
            }

            return result;
        }
示例#25
0
        public static Customer CreateProfile(string Name, string Email)
        {
            Customer customer = new Customer ();
            customer.Name = Name;
            customer.Email = Email;
            customer.Status = Didius.Enums.CustomerStatus.Disabled;
            customer.Save ();

            SorentoLib.User user = SorentoLib.User.Load (customer.UserId);
            user.Status = SorentoLib.Enums.UserStatus.NotVerified;
            user.Save ();

            string from_ = SorentoLib.Services.Settings.Get<string> (Enums.SettingsKey.didius_email_sender);
            string subject = SorentoLib.Services.Settings.Get<string> (Enums.SettingsKey.didius_email_template_profile_confirm_subject);
            string body = SorentoLib.Services.Settings.Get<string> (Enums.SettingsKey.didius_email_template_profile_confirm_body);

            body = body.Replace ("%%NAME%%", customer.Name);
            body = body.Replace ("%%VERIFICATIONCODE%%", customer.User.Id.ToString ());

            SorentoLib.Tools.Helpers.SendMail (from_, customer.Email, subject, body, SorentoLib.Services.Settings.Get<bool> (Enums.SettingsKey.didius_email_template_profile_confirm_isbodyhtml));

            return customer;
        }
示例#26
0
        public static void MailFileToCustomer(Customer Customer, string Filename, string EmailTemplate)
        {
            List<SorentoLib.Tools.Helpers.SendMailAttatchment> attatchments = new List<SorentoLib.Tools.Helpers.SendMailAttatchment> ();
            attatchments.Add (new SorentoLib.Tools.Helpers.SendMailAttatchment (SNDK.IO.FileToByteArray (Filename), "salgsaftale.pdf", SNDK.IO.GetMimeType (Filename)));

            string from_ = SorentoLib.Services.Settings.Get<string> (Enums.SettingsKey.didius_email_sender);
            //SorentoLib.Tools.Helpers.SendMail ("*****@*****.**", Customer.Email, "Salgsaftale", "Salgs aftale er vedhæftet.\n\nMed venlig hilsen\nYork Auktion ApS", false, attatchments);
            SorentoLib.Tools.Helpers.SendMail (from_, "*****@*****.**", "Salgsaftale", "Salgs aftale er vedhæftet.\n\nMed venlig hilsen\nYork Auktion ApS", false, attatchments);
        }
示例#27
0
 public static Invoice Create(Auction Auction, Customer Customer)
 {
     return Create (Auction, Customer, false);
 }
示例#28
0
        public static void MailSettlement(Customer Customer, string PdfFilename)
        {
            string _from = SorentoLib.Services.Settings.Get<string> (Enums.SettingsKey.didius_email_sender);

            string to = Customer.Email;
            //			string to = "*****@*****.**";

            string subject = SorentoLib.Services.Settings.Get<string> (Enums.SettingsKey.didius_email_template_settlement_subject);
            subject = ReplacePlaceholders (Customer, subject);

            string body = SorentoLib.Services.Settings.Get<string> (Enums.SettingsKey.didius_email_template_settlement_body);
            body = ReplacePlaceholders (Customer, body);

            bool isbodyhtml = SorentoLib.Services.Settings.Get<bool> (Enums.SettingsKey.didius_email_template_settlement_isbodyhtml);

            List<SorentoLib.Tools.Helpers.SendMailAttatchment> attatchments = new List<SorentoLib.Tools.Helpers.SendMailAttatchment> ();
            attatchments.Add (new SorentoLib.Tools.Helpers.SendMailAttatchment (SNDK.IO.FileToByteArray (PdfFilename), "afregning.pdf", SNDK.IO.GetMimeType (PdfFilename)));

            SorentoLib.Tools.Helpers.SendMail (_from, to, subject, body, isbodyhtml, attatchments);
        }
示例#29
0
        private static Customer Load(Guid Id, SorentoLib.User User)
        {
            Customer result;

            try
            {
                Hashtable item;

                if (Id != Guid.Empty)
                {
                    item = (Hashtable)SNDK.Convert.FromXmlDocument (SNDK.Convert.XmlNodeToXmlDocument (SorentoLib.Services.Datastore.Get<XmlDocument> (DatastoreAisle, Id.ToString ()).SelectSingleNode ("(//didius.customer)[1]")));
                }
                else
                {
                    item = (Hashtable)SNDK.Convert.FromXmlDocument (SNDK.Convert.XmlNodeToXmlDocument (SorentoLib.Services.Datastore.Get<XmlDocument> (DatastoreAisle, new SorentoLib.Services.Datastore.MetaSearch ("userid", SorentoLib.Enums.DatastoreMetaSearchComparisonOperator.Equal, User.Id)).SelectSingleNode ("(//didius.customer)[1]")));
                }

                result = new Customer ();

                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 ("groupids"))
                {
                    result._groupsasstring = (string)item["groupids"];
                }

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

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

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

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

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

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

                if (item.ContainsKey ("att"))
                {
                    result._att = (string)item["att"];
                }

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

                if (item.ContainsKey ("mobile"))
                {
                    result._mobile = (string)item["mobile"];
                }

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

            //				if (item.ContainsKey ("phonenumbers"))
            //				{
            //					result._phonenumbers = new List<string> ();
            //					foreach (XmlDocument phonenumber in (List<XmlDocument>)item["phonenumbers"])
            //					{
            //						result._phonenumbers.Add ((string)((Hashtable)SNDK.Convert.FromXmlDocument (phonenumber))["value"]);
            //					}
            //				}

            //				if (item.ContainsKey ("newsemail"))
            //				{
            //					result._newsemail = (bool)item["newsemail"];
            //				}

                if (item.ContainsKey ("newssms"))
                {
                    result._newssms = (bool)item["newssms"];
                }

                if (item.ContainsKey ("vat"))
                {
                    result._vat = (bool)item["vat"];
                }

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

                if (item.ContainsKey ("bankname"))
                {
                    result._bankname = (string)item["bankname"];
                }

                if (item.ContainsKey ("bankregistrationno"))
                {
                    result._bankregistrationno = (string)item["bankregistrationno"];
                }

                if (item.ContainsKey ("bankaccountno"))
                {
                    result._bankaccountno = (string)item["bankaccountno"];
                }

                if (item.ContainsKey ("notes"))
                {
                    result._notes = (string)item["notes"];
                }

                if (item.ContainsKey ("status"))
                {
                    result._status = SNDK.Convert.StringToEnum<Enums.CustomerStatus> ((string)item["status"]);
                }

                if (item.ContainsKey ("userid"))
                {
                    result._userid = new Guid ((string)item["userid"]);
                }
            }
            catch (Exception exception)
            {
                // LOG: LogDebug.ExceptionUnknown
                SorentoLib.Services.Logging.LogDebug (string.Format (SorentoLib.Strings.LogDebug.ExceptionUnknown, "DIDIUS.CUSTOMER", exception.Message));

                if (Id != Guid.Empty)
                {
                    // EXCEPTION: Excpetion.PageLoadName
                    throw new Exception (string.Format (Strings.Exception.CustomerLoadGuid, Id));
                }
                else
                {
                    // EXCEPTION: Excpetion.PageLoadName
                    throw new Exception (string.Format (Strings.Exception.CustomerLoadUserId, User.Id));
                }
            }

            return result;
        }