Ejemplo n.º 1
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (PayeeUType != null)
         {
             hashCode = hashCode * 59 + PayeeUType.GetHashCode();
         }
         if (Domestic != null)
         {
             hashCode = hashCode * 59 + Domestic.GetHashCode();
         }
         if (Biller != null)
         {
             hashCode = hashCode * 59 + Biller.GetHashCode();
         }
         if (International != null)
         {
             hashCode = hashCode * 59 + International.GetHashCode();
         }
         return(hashCode);
     }
 }
Ejemplo n.º 2
0
        public async Task <IHttpActionResult> PostBiller(Biller biller)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.Billers.Add(biller);

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (BillerExists(biller.BillerID))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = biller.BillerID }, biller));
        }
Ejemplo n.º 3
0
 public async Task <ReplaceOneResult> UpdateBiller(int id, Biller item)
 {
     return(await _context.Billers
            .ReplaceOneAsync(n => n.id.Equals(id)
                             , item
                             , new UpdateOptions { IsUpsert = true }));
 }
Ejemplo n.º 4
0
        public async Task <IHttpActionResult> PutBiller(Guid id, Biller biller)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != biller.BillerID)
            {
                return(BadRequest());
            }

            db.Entry(biller).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!BillerExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Ejemplo n.º 5
0
    /// <summary>
    /// Visible only for unit testing.
    /// Do NOT call this method.
    /// </summary>
    public static void _internal_doInitialise(Biller biller)
    {
        Unibiller.biller      = biller;
        biller.onBillerReady += (success) => {
            if (onBillerReady != null)
            {
                if (success)
                {
                    onBillerReady(biller.State == Unibill.Impl.BillerState.INITIALISED ? UnibillState.SUCCESS : UnibillState.SUCCESS_WITH_ERRORS);
                }
                else
                {
                    onBillerReady(UnibillState.CRITICAL_ERROR);
                }
            }
        };


        biller.onPurchaseCancelled    += _onPurchaseCancelled;
        biller.onPurchaseComplete     += _onPurchaseComplete;
        biller.onPurchaseFailed       += _onPurchaseFailed;
        biller.onPurchaseRefunded     += _onPurchaseRefunded;
        biller.onTransactionsRestored += _onTransactionsRestored;

        biller.Initialise();
    }
Ejemplo n.º 6
0
        /// <summary>
        /// Returns true if BankingPayeeDetail instances are equal
        /// </summary>
        /// <param name="other">Instance of BankingPayeeDetail to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(BankingPayeeDetail other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     PayeeUType == other.PayeeUType ||
                     PayeeUType != null &&
                     PayeeUType.Equals(other.PayeeUType)
                     ) &&
                 (
                     Domestic == other.Domestic ||
                     Domestic != null &&
                     Domestic.Equals(other.Domestic)
                 ) &&
                 (
                     Biller == other.Biller ||
                     Biller != null &&
                     Biller.Equals(other.Biller)
                 ) &&
                 (
                     International == other.International ||
                     International != null &&
                     International.Equals(other.International)
                 ));
        }
Ejemplo n.º 7
0
        public DownloadManager instantiateDownloadManager(Biller biller)
        {
            var result = new DownloadManager(biller, util, storage, new UnityURLFetcher(), logger, biller.InventoryDatabase.CurrentPlatform, biller.InventoryDatabase.UnibillAnalyticsAppSecret);

            util.InitiateCoroutine(result.monitorDownloads());
            return(result);
        }
Ejemplo n.º 8
0
 public void testInit()
 {
     taxCalculatorObj = new TaxCalculator();
     biller           = new Biller(taxCalculatorObj);
     shoppingCartObj  = new ShoppingCart();
     storeShelf       = new StoreShelf();
 }
        public async Task <Biller> UpdateBiller(Biller biller)
        {
            Biller b = await GetBiller(biller.id);

            BillerContact bc = await GetBillerContact(biller.billercontact.id);

            bc.billerid  = biller.billercontact.billerid;
            bc.city      = biller.billercontact.city;
            bc.countryid = biller.billercontact.countryid;
            bc.email     = biller.billercontact.email;
            bc.emailaux  = biller.billercontact.emailaux;
            bc.phone     = biller.billercontact.phone;
            bc.phoneaux  = biller.billercontact.phoneaux;
            bc.postcode  = biller.billercontact.postcode;
            bc.stateid   = biller.billercontact.stateid;
            bc.street    = biller.billercontact.street;

            b.category_id = biller.category_id;
            b.logo        = !string.IsNullOrEmpty(biller.logo) ? biller.logo : b.logo;
            b.title       = biller.title;

            await _context.SaveChangesAsync();

            b.billercontact = bc;
            return(b);
        }
Ejemplo n.º 10
0
 public void instantiateAnalytics(Biller biller)
 {
     if (!string.IsNullOrEmpty(config.UnibillAnalyticsAppId))
     {
         new AnalyticsReporter(biller, config, platformProvider.getHTTPClient(util), getStorage(), util, platformProvider.getLevelLoadListener());
     }
 }
Ejemplo n.º 11
0
        public static Biller updateFeeSchdule(BizPortalSessionContext context, Biller biller, IList <FeeBracket> updateBrackets)
        {
            FeeSchedule feeSchedule = biller.CurrentFeeSchedule.FeeSchedule;

            foreach (FeeBracket orginalBracket in feeSchedule.Brackets)
            {
                foreach (FeeBracket updateBracket in updateBrackets)
                {
                    if (orginalBracket.BracketedRateID == updateBracket.BracketedRateID)
                    {
                        orginalBracket.LowerBound = updateBracket.LowerBound;
                        orginalBracket.UpperBound = updateBracket.UpperBound;
                        orginalBracket.Rate.SenderFeeRate.FixedAmount      = updateBracket.Rate.SenderFeeRate.FixedAmount;
                        orginalBracket.Rate.SenderFeeRate.PercentageRate   = updateBracket.Rate.SenderFeeRate.PercentageRate;
                        orginalBracket.Rate.SenderFeeRate.MinAmount        = updateBracket.Rate.SenderFeeRate.MinAmount;
                        orginalBracket.Rate.SenderFeeRate.MaxAmount        = updateBracket.Rate.SenderFeeRate.MaxAmount;
                        orginalBracket.Rate.ReceiverFeeRate.FixedAmount    = updateBracket.Rate.ReceiverFeeRate.FixedAmount;
                        orginalBracket.Rate.ReceiverFeeRate.PercentageRate = updateBracket.Rate.ReceiverFeeRate.PercentageRate;
                        orginalBracket.Rate.ReceiverFeeRate.MinAmount      = updateBracket.Rate.ReceiverFeeRate.MinAmount;
                        orginalBracket.Rate.ReceiverFeeRate.MaxAmount      = updateBracket.Rate.ReceiverFeeRate.MaxAmount;
                        break;
                    }
                }
            }
            biller.Persist(context);
            return(biller);
        }
Ejemplo n.º 12
0
        public Biller addBiller(Biller a)
        {
            var data = e.Billers.Add(a);

            e.SaveChanges();
            return(data);
        }
Ejemplo n.º 13
0
        public Biller instantiate()
        {
            IBillingService svc = instantiateBillingSubsystem();

            var biller = new Biller(config, getTransactionDatabase(), svc, getLogger(), getHelp(), getMapper(), getCurrencyManager());

            return(biller);
        }
Ejemplo n.º 14
0
        void Initialize()
        {
            country = "Local";
            TaxCalculatorFactory factory = new TaxCalculatorFactory();

            taxCal = factory.GetTaxCalculator(country);
            biller = new Biller(taxCal);
        }
 public OrderPdfExport(Biller.UI.ViewModel.MainWindowViewModel MainWindowViewModel, Settings.ViewModel parentViewModel)
 {
     ParentViewModel = parentViewModel;
     this.MainWindowViewModel = MainWindowViewModel;
     PreviewElement = new MigraDoc.Rendering.Windows.DocumentPreview();
     PrintDialog = new System.Windows.Forms.PrintDialog();
     kgUnit = new Biller.Core.Utils.Unit() { DecimalDigits = 3, DecimalSeperator = ",", Name = "Kilogramm", ShortName = "kg", ThousandSeperator = "" };
 }
        public async Task <Biller> AddBiller(Biller item)
        {
            await _context.Billers.AddAsync(item);

            await _context.SaveChangesAsync();

            return(await GetBiller(item.id));
        }
Ejemplo n.º 17
0
        public void instantiateAnalytics(Biller biller)
        {
            var analyticsReporter = new AnalyticsReporter(biller.InventoryDatabase.CurrentPlatform, analytics);

            biller.onPurchaseComplete += x => {
                if (x.IsNewPurchase)
                {
                    analyticsReporter.onPurchaseSucceeded(x.PurchasedItem);
                }
            };
        }
Ejemplo n.º 18
0
        public async Task <IHttpActionResult> GetBiller(Guid id)
        {
            Biller biller = await db.Billers.FindAsync(id);

            if (biller == null)
            {
                return(NotFound());
            }

            return(Ok(biller));
        }
        public IActionResult Remove(int[] billerIds)
        {
            foreach (int billerId in billerIds)
            {
                Biller theBiller = context.Billers.Single(c => c.ID == billerId);
                context.Billers.Remove(theBiller);
            }

            context.SaveChanges();

            return(Redirect("/Biller"));
        }
Ejemplo n.º 20
0
        /// <summary>
        /// Parses <see cref="Customer"/> and <see cref="OrderedArticles"/>.
        /// </summary>
        /// <param name="document"></param>
        /// <param name="data"></param>
        /// <param name="database"></param>
        /// <returns></returns>
        public bool ParseAdditionalData(ref Biller.Core.Document.Document document, XElement data, Biller.Core.Interfaces.IDatabase database)
        {
            if (document is Offer)
            {
                var result = database.GetCustomer(data.Element("CustomerID").Value);
                var customer = result.Result;
                (document as Offer).Customer = customer;

                var articles = data.Element("OrderedArticles").Elements();
                (document as Offer).OrderedArticles.Clear();
                foreach (XElement article in articles)
                {
                    var temp = new Biller.Core.Articles.OrderedArticle();

                    var task = database.ArticleUnits();
                    temp.ArticleUnit = task.Result.Where(x => x.Name == article.Element("ArticleUnit").Value).Single();

                    var taskTaxClass = database.TaxClasses();
                    temp.TaxClass = taskTaxClass.Result.Where(x => x.Name == article.Element("TaxClass").Value).Single();

                    temp.ParseFromXElement(article);
                    (document as Offer).OrderedArticles.Add(temp);
                }

                try
                {
                    (document as Offer).PaymentMethode.ParseFromXElement(data.Element((document as Offer).PaymentMethode.XElementName));
                    (document as Offer).OrderShipment.ParseFromXElement(data.Element((document as Offer).OrderShipment.XElementName));
                } catch { }
                try
                {
                    (document as Offer).SmallBusiness = Boolean.Parse(data.Element("SmallBusiness").Value);
                    if ((document as Offer).SmallBusiness)
                        (document as Offer).OrderCalculation = new Calculations.SmallBusinessCalculation(document as Order.Order, true);
                    else if (!((document as Offer).OrderCalculation is Calculations.DefaultOrderCalculation))
                        (document as Offer).OrderCalculation = new Calculations.DefaultOrderCalculation(document as Order.Order, true);
                } catch { }
                try
                {
                    if (data.Element("EAddress") != null)
                    {
                        (document as Offer).DeliveryAddress.ParseFromXElement(data.Element("EAddress"));
                    }       
                } catch {}
            }
            else
            {
                return false;
            }
            return true;
        }
Ejemplo n.º 21
0
        public async Task <IHttpActionResult> DeleteBiller(Guid id)
        {
            Biller biller = await db.Billers.FindAsync(id);

            if (biller == null)
            {
                return(NotFound());
            }

            db.Billers.Remove(biller);
            await db.SaveChangesAsync();

            return(Ok(biller));
        }
Ejemplo n.º 22
0
        /// <summary>
        /// Works with the <see cref="source"/> when <see cref="target"/> is type of <see cref="Order"/>.
        /// </summary>
        /// <param name="source">When source is type of <see cref="Biller.Core.Customers.Customer"/> or <see cref="Biller.Core.Articles.Article"/> the data will be passed to the target <see cref="Order.Order"/>.</param>
        /// <param name="target"><see cref="source"/> will be passed to <see cref="target"/> if it's type of <see cref="Order.Order"/>.</param>
        public void ReceiveData(object source, Biller.Core.Document.Document target)
        {
            if (target is Order.Order)
            {
                if (source is Biller.Core.Customers.Customer)
                {
                    (target as Order.Order).Customer = (source as Biller.Core.Customers.Customer);
                    (target as Order.Order).PaymentMethode = (source as Biller.Core.Customers.Customer).DefaultPaymentMethode;
                }

                if (source is Biller.Core.Articles.Article)
                {
                    if (target is Order.Order)
                    {
                        if (!String.IsNullOrEmpty((target as Order.Order).Customer.MainAddress.OneLineString))
                        {
                            //Check pricegroup
                            var customer = (target as Order.Order).Customer;
                            var orderedArticle = new Biller.Core.Articles.OrderedArticle(source as Biller.Core.Articles.Article);
                            orderedArticle.OrderedAmount = 1;
                            orderedArticle.OrderPosition = (target as Order.Order).OrderedArticles.Count + 1;

                            switch (customer.Pricegroup)
                            {
                                case 0:
                                    orderedArticle.OrderPrice = orderedArticle.Price1;
                                    break;
                                case 1:
                                    orderedArticle.OrderPrice = orderedArticle.Price2;
                                    break;
                                case 2:
                                    orderedArticle.OrderPrice = orderedArticle.Price3;
                                    break;
                            }
                            (target as Order.Order).OrderedArticles.Add(orderedArticle);

                        }
                        else
                        {
                            var orderedArticle = new Biller.Core.Articles.OrderedArticle(source as Biller.Core.Articles.Article);
                            orderedArticle.OrderedAmount = 1;
                            orderedArticle.OrderPrice = orderedArticle.Price1;
                            orderedArticle.OrderPosition = (target as Order.Order).OrderedArticles.Count + 1;
                            (target as Order.Order).OrderedArticles.Add(orderedArticle);
                        }
                    }
                }
            }
        }
Ejemplo n.º 23
0
 /// <summary>
 /// Initialise Unibill.
 /// Before calling this method, ensure you have subscribed to onBillerReady to
 /// ensure you receive Unibill's initialisation response.
 /// This method should be called once as soon as your Application launches.
 ///
 /// runtimeProducts is an optional parameter that allows you to tell Unibill about additional
 /// products to those defined in your inventory.
 ///
 /// You can opt to use runtimeProducts exclusively if you choose.
 /// </summary>
 public static void Initialise(List <ProductDefinition> runtimeProducts = null)
 {
     if (Unibiller.biller == null)
     {
         var mgr    = new RemoteConfigManager(new UnityResourceLoader(), new UnityPlayerPrefsStorage(), new UnityLogger(), UnityEngine.Application.platform, runtimeProducts);
         var config = mgr.Config;
         var o      = new GameObject();
         UnityEngine.Object.DontDestroyOnLoad(o);
         var util    = o.AddComponent <UnityUtil> ();
         var factory = new BillerFactory(new UnityResourceLoader(), new UnityLogger(), new UnityPlayerPrefsStorage(), new RawBillingPlatformProvider(config), config, util);
         Unibiller.biller = factory.instantiate();
         _internal_hook_events(Unibiller.biller, factory);
     }
     biller.Initialise();
 }
Ejemplo n.º 24
0
 public AnalyticsReporter(Biller biller, UnibillConfiguration config, IHTTPClient client, IStorage storage, IUtil util, ILevelLoadListener listener)
 {
     this.config = config;
     this.client = client;
     this.util = util;
     this.userId = getUserId (storage);
     biller.onPurchaseComplete += onSucceeded;
     biller.onPurchaseCancelled += (PurchasableItem obj) => onEvent(EventType.purchase_cancelled, obj, null);
     biller.onPurchaseRefunded += (PurchasableItem obj) => onEvent(EventType.purchase_refunded, obj, null);
     biller.onTransactionRestoreBegin += (bool obj) =>  restoreInProgress = true;
     biller.onTransactionsRestored += (bool obj) => restoreInProgress = false;
     listener.registerListener (() => onLevelLoad ());
     onEvent (EventType.new_session, null, null);
     this.levelName = util.loadedLevelName ();
     this.levelLoadTime = DateTime.UtcNow;
 }
Ejemplo n.º 25
0
        public async Task <Biller> getbiller(string key, CancellationToken ctx)
        {
            Biller billers = new Biller();

            try
            {
                var biller = await redis.GetStringAsync(key, ctx);

                billers = JsonHelper.fromJson <Biller>(biller);
            }
            catch (Exception)
            {
                //throw;
            }
            return(billers);
        }
Ejemplo n.º 26
0
 public AnalyticsReporter(Biller biller, UnibillConfiguration config, IHTTPClient client, IStorage storage, IUtil util, ILevelLoadListener listener)
 {
     this.config = config;
     this.client = client;
     this.util   = util;
     this.userId = getUserId(storage);
     biller.onPurchaseComplete        += onSucceeded;
     biller.onPurchaseCancelled       += (PurchasableItem obj) => onEvent(EventType.purchase_cancelled, obj, null);
     biller.onPurchaseRefunded        += (PurchasableItem obj) => onEvent(EventType.purchase_refunded, obj, null);
     biller.onTransactionRestoreBegin += (bool obj) => restoreInProgress = true;
     biller.onTransactionsRestored    += (bool obj) => restoreInProgress = false;
     listener.registerListener(() => onLevelLoad());
     onEvent(EventType.new_session, null, null);
     this.levelName     = util.loadedLevelName();
     this.levelLoadTime = DateTime.UtcNow;
 }
        public IActionResult ViewBiller(int id)
        {
            Biller biller = context.Billers.Single(b => b.ID == id);

            List <AgentsBillers> billersAgents = context
                                                 .AgentsBillers
                                                 .Include(billersAgent => billersAgent.Agent)
                                                 .Where(ba => ba.BillerID == id)
                                                 .ToList();

            ViewBillerViewModel viewModel = new ViewBillerViewModel
            {
                Biller = biller,
                Agents = billersAgents
            };

            return(View(viewModel));
        }
Ejemplo n.º 28
0
        public Billerdata getSingle(int i)
        {
            Biller a = e.Billers.Find(i);

            if (a != null)
            {
                Billerdata d = new Billerdata();
                d.Id        = a.Id;
                d.Branch_ID = a.Branch_ID;
                d.Contact   = a.Contact;
                d.DOB       = a.DOB;
                d.Email     = a.Email;
                d.Password  = a.Password;
                d.Location  = a.Branch.Location;
                return(d);
            }
            return(null);
        }
Ejemplo n.º 29
0
        public async void setbiller(string key, Biller billers)
        {
            try
            {
                var biller = await redis.GetStringAsync(key);

                if (!string.IsNullOrEmpty(biller))
                {
                    redis.Remove(key);
                }
                string value = JsonHelper.toJson(billers);

                await redis.SetStringAsync(key, value);
            }
            catch (Exception)
            {
                //throw;
            }
        }
Ejemplo n.º 30
0
        public async Task setbillerAsync(string key, Biller billers, CancellationToken cts)
        {
            try
            {
                var biller = await redis.GetStringAsync(key);

                if (!string.IsNullOrEmpty(biller))
                {
                    redis.Remove(key);
                }
                string value = JsonHelper.toJson(billers);

                await redis.SetStringAsync(key, value, cts);
            }
            catch (Exception ex)
            {
                //throw;
            }
        }
Ejemplo n.º 31
0
        public Billerdata deleteBiller(int id)
        {
            Biller a = e.Billers.Find(id);

            if (a != null)
            {
                e.Billers.Remove(a);
                e.SaveChanges();
                Billerdata d = new Billerdata();
                d.Id        = a.Id;
                d.Branch_ID = a.Branch_ID;
                d.Contact   = a.Contact;
                d.DOB       = a.DOB;
                d.Email     = a.Email;
                d.Password  = a.Password;
                d.Location  = "";
                return(d);
            }
            return(null);
        }
Ejemplo n.º 32
0
        public async Task post(Biller billers)
        {
            string content_type = "application/json";
            string response     = string.Empty;

            try
            {
                using (var client = new HttpClient())
                {
                    client.DefaultRequestHeaders.Add("Collection", "billers");
                    string request = JsonHelper.toJson(billers);
                    var    content = new StringContent(request, Encoding.UTF8, content_type);
                    //var result = await client.PostAsync(settings.Value.mongo_url, content);
                    //response = await result.Content.ReadAsStringAsync();
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
        public IActionResult Add(AddBillerViewModel addBillerViewModel)
        {
            if (ModelState.IsValid)
            {
                Biller newBiller = new Biller
                {
                    Name  = addBillerViewModel.Name,
                    Phone = addBillerViewModel.Phone,
                    Email = addBillerViewModel.Email,
                    Web   = addBillerViewModel.Web
                };

                //creates model in database
                context.Billers.Add(newBiller);
                //commits changes to db
                context.SaveChanges();

                return(Redirect("/Biller/Index"));
            }
            return(View(addBillerViewModel));
        }
Ejemplo n.º 34
0
        public Billerdata updateBiller(Biller a)
        {
            Biller old = e.Billers.Where(
                x => x.Id == a.Id).SingleOrDefault();

            if (old != null)
            {
                e.Entry(old).CurrentValues.SetValues(a);
                e.SaveChanges();
                Billerdata d = new Billerdata();
                d.Id        = a.Id;
                d.Branch_ID = a.Branch_ID;
                d.Contact   = a.Contact;
                d.DOB       = a.DOB;
                d.Email     = a.Email;
                d.Password  = a.Password;
                d.Location  = "";
                return(d);
            }
            return(null);
        }
Ejemplo n.º 35
0
 public void ReceiveCustomerEditViewModel(Biller.UI.CustomerView.Contextual.CustomerEditViewModel customerEditViewModel)
 {
     //
 }
Ejemplo n.º 36
0
 public void Update(Models.UpdateModel app, Biller.Controls.Notification.UpdateNotification notification)
 {
     DownloadUpdateAsync(app, finished =>
     {
         if (finished)
             ApplyUpdate(app);
     }, progressPercent =>
     {
         notification.Progress = progressPercent;
     });
 }
Ejemplo n.º 37
0
 public EntryPoint(Biller.UI.ViewModel.MainWindowViewModel parentViewModel)
 {
     this.ParentViewModel = parentViewModel;
     internalViewModels = new List<Biller.UI.Interface.IViewModel>();
 }
Ejemplo n.º 38
0
 public Biller.Core.Document.PreviewDocument GetPreviewDocument(Biller.Core.Document.Document source)
 {
     return Order.Order.PreviewFromOrder(source as Order.Order);
 }
Ejemplo n.º 39
0
 public void ReceiveDocumentEditViewModel(Biller.UI.DocumentView.Contextual.DocumentEditViewModel documentEditViewModel)
 {
     documentEditViewModel.EditContentTabs.Add(new Control.EditTab());
 }
        private void CreateFooter(Section section, Biller.Core.Models.CompanySettings companySettings)
        {
            var footer = section.Footers.Primary.AddTable();
            footer.Style = "Table";
            footer.Borders.Color = Color.Empty;
            footer.Borders.Visible = false;
            footer.Rows.LeftIndent = 0;
            footer.LeftPadding = "0cm";

            foreach (var footercolumn in ParentViewModel.SettingsController.FooterColumns)
            {
                var fcolumn = footer.AddColumn(Unit.FromCentimeter(footercolumn.ColumnWidth));
                fcolumn.Borders.Visible = false;
                fcolumn.Format.Alignment = footercolumn.Alignment;
            }

            if (ParentViewModel.SettingsController.FooterColumns.Count > 0)
            {
                Row footerrow = footer.AddRow();

                var index = 0;
                foreach (var footercolumn in ParentViewModel.SettingsController.FooterColumns)
                {
                    var content = ReplaceFooterPlaceHolder(footercolumn.Value, companySettings);
                    footerrow.Cells[index].AddParagraph(content);
                    index += 1;
                }
            }
        }
 private string ReplaceArticlePlaceHolder(string placeholder, Biller.Core.Articles.OrderedArticle article)
 {
     if (placeholder == "{Position}")
         return article.OrderPosition.ToString();
     if (placeholder == "{Amount}")
         return article.OrderedAmountString;
     if (placeholder == "{ArticleID}")
         return article.ArticleID;
     if (placeholder == "{ArticleID}")
         return article.ArticleID;
     if (placeholder == "{ArticleName}")
         return article.ArticleDescription;
     if (placeholder == "{ArticleText}")
         return article.ArticleText;
     if (placeholder == "{ArticleNameWithText}")
         return article.ArticleDescription + "\n" + article.OrderText;
     if (placeholder == "{SinglePriceGross}")
         return article.OrderPrice.Price1.ToString();
     if (placeholder == "{SinglePriceNet}")
         return article.OrderPrice.Price2.ToString();
     if (placeholder == "{TaxRate}")
         return article.TaxClass.TaxRate.PercentageString;
     if (placeholder == "{OrderedValueGross}")
         return article.RoundedGrossOrderValue.ToString();
     if (placeholder == "{OrderedValueNet}")
         return article.RoundedNetOrderValue.ToString();
     if (placeholder == "{Rebate}")
         return article.OrderRebate.PercentageString;
     if (placeholder == "{OrderedWeight}")
         return article.ArticleUnit.ValueToString(article.ArticleWeight * article.OrderedAmount);
     return placeholder;
 }
Ejemplo n.º 42
0
 public void ReceiveArticleEditViewModel(Biller.UI.ArticleView.Contextual.ArticleEditViewModel articleEditViewModel)
 {
     //
 }
 public async void RenderDocumentPreview(Biller.Core.Document.Document document)
 {
     if (document is Order.Order)
         PreviewElement.Ddl = DdlWriter.WriteToString(await GetDocument(document as Order.Order));
 }
        public async void SaveDocument(Biller.Core.Document.Document document, string filename, bool OpenOnSuccess = true)
        {
            if (document is Order.Order)
            {
                PdfDocumentRenderer renderer = new PdfDocumentRenderer(true, PdfSharp.Pdf.PdfFontEmbedding.Always);
                renderer.Document = await GetDocument(document as Order.Order);

                renderer.RenderDocument();
                renderer.Save(filename);

                if (OpenOnSuccess)
                    Process.Start(filename);
            }
        }
        private string ReplaceFooterPlaceHolder(string placeholder, Biller.Core.Models.CompanySettings companySettings)
        {
            if (String.IsNullOrEmpty(placeholder))
                return String.Empty;
            if (companySettings == null)
                return String.Empty;

            if (placeholder.Contains("{CompanyAddress}"))
            {
                var address = "";
                foreach (var line in companySettings.MainAddress.AddressStrings)
                    address += line + "\n";
                placeholder = placeholder.Replace("{CompanyAddress}", address);
            }
            placeholder = placeholder.Replace("{TaxID}", companySettings.TaxID);
            placeholder = placeholder.Replace("{SalesTaxID}", companySettings.SalesTaxID);
                
            return placeholder;
        }
 public void ReceiveRequestDocumentCommand(Biller.UI.Interface.ITabContentViewModel source)
 {
     ViewModelRequestingDocument = source;
     ParentViewModel.SelectedContent = TabContent;
 }
        private void CreateHeader(Section section, Biller.Core.Models.CompanySettings companySettings, Order.Order order)
        {
            Paragraph paragraph;
            Table table;
            Column column;
            Row row;

            if (!String.IsNullOrEmpty(ParentViewModel.SettingsController.DisplayedPath))
            {
                Image image = section.Headers.Primary.AddImage(ParentViewModel.SettingsController.DisplayedPath);
                image.LockAspectRatio = true;
                switch (ParentViewModel.SettingsController.RelativeVertical)
                {
                    case 0:
                        image.RelativeVertical = RelativeVertical.Margin;
                        break;
                    case 1:
                        image.RelativeVertical = RelativeVertical.Page;
                        break;
                    default:
                        image.RelativeVertical = RelativeVertical.Margin;
                        break;
                }
                switch (ParentViewModel.SettingsController.RelativeHorizontal)
                {
                    case 0:
                        image.RelativeHorizontal = RelativeHorizontal.Margin;
                        break;
                    case 1:
                        image.RelativeHorizontal = RelativeHorizontal.Page;
                        break;
                    default:
                        image.RelativeHorizontal = RelativeHorizontal.Margin;
                        break;
                }
                if (ParentViewModel.SettingsController.ImagePositionLeftIndex >= 0)
                {
                    switch (ParentViewModel.SettingsController.ImagePositionLeftIndex)
                    {
                        case 0:
                            image.Left = ShapePosition.Left;
                            break;
                        case 1:
                            image.Left = ShapePosition.Center;
                            break;
                        case 2:
                            image.Left = ShapePosition.Right;
                            break;
                        default:
                            image.Left = ShapePosition.Center;
                            break;
                    }
                }
                else
                {
                    image.Left = ParentViewModel.SettingsController.cmUnit.ValueToString(ParentViewModel.SettingsController.ImagePositionLeft);
                }
                image.Top = ParentViewModel.SettingsController.cmUnit.ValueToString(ParentViewModel.SettingsController.ImagePositionTop);
                image.WrapFormat.Style = WrapStyle.Through;
            }
            

            // Addresses
            table = section.Headers.Primary.AddTable();
            table.Style = "Table";
            table.Rows.Alignment = RowAlignment.Left;
            column = table.AddColumn("10cm");
            column.Format.Alignment = ParagraphAlignment.Left;
            row = table.AddRow();
            row.Format.SpaceBefore = Unit.FromCentimeter(ParentViewModel.SettingsController.AddressFrameTop);

            if (ParentViewModel.SettingsController.AddressFrameShowSender)
            {
                paragraph = row.Cells[0].AddParagraph(companySettings.MainAddress.OneLineString);
                paragraph.Format.Font.Size = 8;
            }

            row = table.AddRow();
            paragraph = row.Cells[0].AddParagraph();
            foreach (var line in order.Customer.MainAddress.AddressStrings)
                paragraph.AddText(line + "\n");

            table = section.Headers.Primary.AddTable();
            table.Style = "Table";
            table.Rows.Alignment = RowAlignment.Right;
            column = table.AddColumn("3cm");
            column.Format.Alignment = ParagraphAlignment.Left;
            column = table.AddColumn("3cm");
            column.Format.Alignment = ParagraphAlignment.Right;
            row = table.AddRow();
            row.Cells[0].AddParagraph("Rechnungsdatum:");
            row.Cells[1].AddParagraph(order.Date.ToString("dd.MM.yyyy"));
            row = table.AddRow();
            row.Cells[0].AddParagraph("Leistungsdatum:");
            row.Cells[1].AddParagraph(order.DateOfDelivery.ToString("dd.MM.yyyy"));
            if (ParentViewModel.SettingsController.OrderInfoShowCustomerID)
            {
                row = table.AddRow();
                row.Cells[0].AddParagraph("Kundennummer:");
                row.Cells[1].AddParagraph(order.Customer.CustomerID);
            }
            if (ParentViewModel.SettingsController.OrderInfoShowPageNumbers)
            {
                row = table.AddRow();
                row.Cells[0].AddParagraph("Seite");
                paragraph = row.Cells[1].AddParagraph();
                paragraph.AddPageField();
                paragraph.AddText(" von ");
                paragraph.AddNumPagesField();
            }
        }
 public EntryPoint(Biller.UI.ViewModel.MainWindowViewModel parentViewModel)
 {
     vms = new List<Biller.UI.Interface.IViewModel>();
     this.parentViewModel = parentViewModel;            
 }
        public void PrintDocument(Biller.Core.Document.Document document)
        {
            /*
            // Reuse the renderer from the preview
            RenderDocumentPreview(document);
            DocumentRenderer renderer = this.PreviewElement.Renderer;
            if (renderer != null)
            {
                int pageCount = renderer.FormattedDocument.PageCount;
                // Creates a PrintDocument that simplyfies printing of MigraDoc documents
                MigraDocPrintDocument printDocument = new MigraDocPrintDocument();

                if (PrintDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    // Attach the current printer settings
                    printDocument.PrinterSettings = this.PrintDialog.PrinterSettings;

                    if (this.PrintDialog.PrinterSettings.PrintRange == System.Drawing.Printing.PrintRange.Selection)
                        printDocument.SelectedPage = this.PreviewElement.Page;

                    renderer.PrepareDocument();

                    // Attach the current document renderer
                    printDocument.Renderer = renderer;
                    
                    // Print the document
                    printDocument.Print();
                }
            }
            */

            SaveDocument(document, document.DocumentType + document.DocumentID + ".pdf");
        }
Ejemplo n.º 50
0
 public EntryPoint(Biller.UI.ViewModel.MainWindowViewModel parentViewModel)
 {
     this.ParentViewModel = parentViewModel;
 }
Ejemplo n.º 51
0
 public ControlManager(Biller.UI.ViewModel.MainWindowViewModel mainWindowViewModel)
 {
     this.mainWindowViewModel = mainWindowViewModel;
     mainWindowViewModel.DocumentTabViewModel.RegisterObserver(this);
 }