Example #1
0
        public void Execute(IToolServices toolService)
        {
            Position   position = toolService.PointerOverPosition;
            MarkupInfo markups  = toolService.Node.Markups;

            MarkupKind markupKindOnPosition = markups.RemoveMarkupOnPosition(position);

            if (SequenceMarkup == SequenceMarkupKind.Letter)
            {
                char letter = markups.GetSmallestUnusedLetter();
                if (letter != '0' && markupKindOnPosition != MarkupKind.Label)
                {
                    markups.AddMarkup <Label>(new Label(position, letter.ToString()));
                }
            }
            else
            {
                int number = markups.GetSmallestUnusedNumber();
                if (markupKindOnPosition != MarkupKind.Label)
                {
                    markups.AddMarkup <Label>(new Label(position, number.ToString()));
                }
            }

            _shadows = toolService.Node.Markups.FillSequenceShadowMap(toolService.GameTree.BoardSize, SequenceMarkup);
        }
Example #2
0
        public void Execute(IToolServices toolService)
        {
            Position   position = toolService.PointerOverPosition;
            MarkupInfo markups  = toolService.Node.Markups;

            MarkupKind markupKindOnPosition = markups.RemoveMarkupOnPosition(position);

            // If the removed markup is the same as the new one than do not add anything.
            if (IsMarkupEqual(SimpleMarkup, markupKindOnPosition))
            {
                return;
            }

            if (SimpleMarkup == SimpleMarkupKind.Circle)
            {
                markups.AddMarkup <Circle>(new Circle(position));
            }
            if (SimpleMarkup == SimpleMarkupKind.Cross)
            {
                markups.AddMarkup <Cross>(new Cross(position));
            }
            if (SimpleMarkup == SimpleMarkupKind.Square)
            {
                markups.AddMarkup <Square>(new Square(position));
            }
            if (SimpleMarkup == SimpleMarkupKind.Triangle)
            {
                markups.AddMarkup <Triangle>(new Triangle(position));
            }
        }
        private MarkupInfo GetMarkup(ProductCarRental.SearchCriteria model)
        {
            MayFlower  db        = new MayFlower();
            var        markup    = db.MarkupCarRentals.FirstOrDefault(x => x.IsActive && x.BookingDateFrom <= DateTime.Now && x.BookingDateTo >= DateTime.Now && x.TravelDateFrom <= model.PickupDateTime && x.TravelDateTo >= model.ReturnDateTime);
            MarkupInfo markupDtl = new MarkupInfo();

            if (markup != null)
            {
                markupDtl = new MarkupInfo()
                {
                    MarkupID              = markup.MarkupCarRentalID,
                    DiscountOrMarkup      = markup.DiscountOrMarkup,
                    MarkupPricingTypeCode = markup.MarkupPricingTypeCode
                };
            }
            return(markupDtl);
        }
Example #4
0
        private void DrawMarkups(CanvasDrawingSession drawingSession, MarkupInfo markupInfo)
        {
            Color markupColor     = Colors.Maroon;
            Color backgroundColor = Colors.Transparent;

            //backgroundColor.A = 0xBB;
            //backgroundColor.B = (byte)(backgroundColor.B * backgroundColor.A / 255);
            //backgroundColor.G = (byte)(backgroundColor.G * backgroundColor.A / 255);
            //backgroundColor.R = (byte)(backgroundColor.R * backgroundColor.A / 255);

            // Draw labels - characters, numbers
            foreach (var labelMarkup in markupInfo.GetMarkups <Label>().ToArray())
            {
                DrawLabelMark(drawingSession, labelMarkup.Position.X, labelMarkup.Position.Y, markupColor, backgroundColor, labelMarkup.Text);
            }

            // Draw circles
            foreach (var circleMarkup in markupInfo.GetMarkups <Circle>().ToArray())
            {
                DrawCircleMark(drawingSession, circleMarkup.Position.X, circleMarkup.Position.Y, markupColor, backgroundColor);
            }

            // Draw crosses
            foreach (var crossMarkup in markupInfo.GetMarkups <Cross>().ToArray())
            {
                DrawCrossOutMark(drawingSession, crossMarkup.Position.X, crossMarkup.Position.Y, markupColor, backgroundColor);
            }

            // Draw squares
            foreach (var squareMarkup in markupInfo.GetMarkups <Square>().ToArray())
            {
                DrawSquareMark(drawingSession, squareMarkup.Position.X, squareMarkup.Position.Y, markupColor, backgroundColor);
            }

            // Draw triangles
            foreach (var triangleMarkup in markupInfo.GetMarkups <Triangle>().ToArray())
            {
                DrawTriangleMark(drawingSession, triangleMarkup.Position.X, triangleMarkup.Position.Y, markupColor, backgroundColor);
            }
        }
        public async System.Threading.Tasks.Task <byte[]> GenerateDesignerFile(ProjectItem projectItem, string contents, string outputAssemblyPath)
        {
            // get list of referenced assemblies.
            var project             = projectItem.ContainingProject;
            var unconfiguredProject = project.GetUnconfiguredProject();
            var lockService         = unconfiguredProject.ProjectService.Services.ProjectLockService;

            var configuredProject = await unconfiguredProject.GetSuggestedConfiguredProjectAsync();

            List <ITaskItem> assemblyReferenceItems;

            // need to gather the referenced assemblies.
            using (var access = await lockService.WriteLockAsync())
            {
                Microsoft.Build.Evaluation.Project msBuildProject = await access.GetProjectAsync(configuredProject);

                // party on it, respecting the type of lock you've acquired.
                var assemblyReferenceGatherer = new AssemblyReferenceGatherer();
                assemblyReferenceItems = assemblyReferenceGatherer.GetAssemblyReferences(msBuildProject.Xml).ToList();
            }

            var projDir = project.GetProjectPath();

            var referencedAssemblies = new ReferencedAssembliesContext(assemblyReferenceItems, outputAssemblyPath);


            string currentDir      = System.IO.Path.GetDirectoryName(project.FullName);
            string websiteRootPath = currentDir; // todo - this could point to a dnn website we are targeting?

            List <TagRegistration> tagRegistrations = referencedAssemblies.StandardTagRegistrations.ToList();

            UserControlTagRegistrationResolver.ResolveUserControls(this, tagRegistrations, referencedAssemblies, websiteRootPath, currentDir);

            Verbose("Begin processing \"{0}\"...", projectItem.Name);
            Verbose("");
            VerboseNesting++;
            BeginFile(projectItem.Name);

            //bool succeeded = GenerateDesignerForFilename(document.FullName, tagRegistrations, referencedAssemblies, websiteRootPath);

            bool succeeded = false;
            // var filename = document.FullName;

            string designer = null;
            // string designerFilename = filename + ".designer.cs";

            // Load the markup from the .aspx or .ascx file.
            MarkupReader markup     = new MarkupReader();
            MarkupInfo   markupInfo = null;

            try
            {
                markupInfo = markup.LoadMarkup(this, tagRegistrations, referencedAssemblies, websiteRootPath, contents, projectItem.Name);
            }
            catch (Exception e)
            {
                Error("{0}: Failed to load markup file:\r\n{1}", projectItem.Name, e.Message);
                Verbose("Stopping file processing due to exception.  Stack trace:\r\n{0}", e.StackTrace);
                succeeded = false;
                return(null);
            }

            // If we're not inheriting a real class, there's no reason for a designer file to exist.
            if (string.IsNullOrWhiteSpace(markupInfo.InheritsClassName))
            {
                Verbose("Skipping generating designer file because markup does not have an Inherits=\"...\" attribute.", projectItem.Name);
                succeeded = true;
                return(null);
            }

            // Generate the output text for the new .designer.cs file.
            try
            {
                DesignerWriter designerWriter = new DesignerWriter();
                designer = designerWriter.CreateDesigner(this, markupInfo);
            }
            catch (Exception e)
            {
                Error("{0}: Cannot regenerate designer file:\r\n{1}", projectItem.Name, e.Message);
                Verbose("Stopping file processing due to exception.  Stack trace:\r\n{0}", e.StackTrace);
                succeeded = false;
                return(null);
            }

            // Save the output .designer.cs file to disk.

            var utfBytes = Encoding.UTF8.GetBytes(designer);

            EndFile(projectItem.Name, succeeded);
            VerboseNesting--;
            Verbose("");
            Verbose("End processing \"{0}\".", projectItem.Name);

            return(utfBytes);
        }
Example #6
0
        /// <summary>
        /// Create Billable expense
        /// </summary>
        /// <param name="context"></param>
        /// <param name="customer"></param>
        /// <returns>purchase</returns>
        public static Purchase BillableExpenseCreate(ServiceContext context, Customer customer)
        {
            Account  account        = QBOHelper.QBO.QueryOrAddAccount(context, "select * from account where AccountSubType='Checking'", AccountTypeEnum.Bank, AccountClassificationEnum.Asset, AccountSubTypeEnum.Checking);
            Account  expenseAccount = QBOHelper.QBO.QueryOrAddAccount(context, "select * from account where AccountType='Expense'", AccountTypeEnum.Expense, AccountClassificationEnum.Expense, AccountSubTypeEnum.AdvertisingPromotional);
            Vendor   vendor         = QBOHelper.QBO.QueryOrAddVendor(context);
            Item     item           = QBOHelper.QBO.ItemCreate(context);
            Purchase purchase       = new Purchase
            {
                PaymentType          = PaymentTypeEnum.Cash,
                PaymentTypeSpecified = true,
                AccountRef           = new ReferenceType {
                    name = account.Name, Value = account.Id
                },
                EntityRef = new ReferenceType {
                    type = EntityTypeEnum.Vendor.ToString(), name = vendor.DisplayName, Value = vendor.Id
                }
            };

            Line itemLine = new Line
            {
                Description         = "Item based expense line detail.",
                DetailType          = LineDetailTypeEnum.ItemBasedExpenseLineDetail,
                DetailTypeSpecified = true
            };

            MarkupInfo markupInfo = new MarkupInfo
            {
                PercentBased          = true,
                PercentBasedSpecified = true,
                PercentSpecified      = true,
                Percent = new Decimal(50)
            };

            ItemBasedExpenseLineDetail itemLineDetail = new ItemBasedExpenseLineDetail
            {
                CustomerRef = new ReferenceType {
                    name = customer.DisplayName, Value = customer.Id
                },
                BillableStatus          = BillableStatusEnum.Billable,
                BillableStatusSpecified = true,
                ItemRef = new ReferenceType {
                    name = item.Name, Value = item.Id
                },
                MarkupInfo = markupInfo,
            };

            itemLine.AnyIntuitObject = itemLineDetail;
            if (item.UnitPrice > 0)
            {
                itemLine.Amount = item.UnitPrice;
            }
            else
            {
                itemLine.Amount = new Decimal(100);
            }

            itemLine.AmountSpecified = true;

            Line accountLine = new Line
            {
                Description         = "Account based expense line detail.",
                DetailType          = LineDetailTypeEnum.AccountBasedExpenseLineDetail,
                DetailTypeSpecified = true
            };

            AccountBasedExpenseLineDetail accountLineDetail = new AccountBasedExpenseLineDetail
            {
                CustomerRef = new ReferenceType {
                    name = customer.DisplayName, Value = customer.Id
                },
                AccountRef = new ReferenceType {
                    name = expenseAccount.Name, Value = expenseAccount.Id
                },
                BillableStatus          = BillableStatusEnum.Billable,
                BillableStatusSpecified = true,
                MarkupInfo = markupInfo,
            };

            accountLine.AnyIntuitObject = accountLineDetail;
            accountLine.Amount          = new Decimal(100);
            accountLine.AmountSpecified = true;

            Line[] lines = { itemLine, accountLine };
            purchase.Line = lines;

            // Add created purchase in QBO
            Purchase apiResponse = QBOHelper.Helper.AddToQBO(context, purchase);

            return(apiResponse);
        }