Esempio n. 1
0
        public string Test_Object(object collection)
        {
            List <TemplateVariable> _collection = new List <TemplateVariable>();
            TemplateVariable        singleton   = new TemplateVariable();

            _collection = List <TemplateVariable>();
        }
Esempio n. 2
0
        private string ShowTemplate(TemplateModel model, int ProductId, string tmpl)
        {
            TemplateVariable   tVariable = new TemplateVariable();
            BarcodeDesignModel tValue    = getBarcodeData(ProductId);
            // var size1 = size;
            var barcode = "barcode" + tmpl;
            var Barcode = @"<input type='hidden' value='" + tValue.Barcode + "' id='hiddenbarcode" + tmpl + "' class='abc'><svg id = 'barcode" + tmpl + "'></svg><script>JsBarcode('#barcode" + tmpl + "', '" + tValue.Barcode + "', {width: 2,height: 40});</script>";
            //        //format: "pharmacode",
            //        //lineColor: "#0aa",
            //+ 'width: 2,'
            //+ 'height: 40,'
            //        // displayValue: false
            //+ '});</script>';
            string updateHtml = "";

            if (model.TemplateHtml != null)
            {
                string html = model.TemplateHtml;
                updateHtml = html.Replace(tVariable.barcode, Barcode);
                updateHtml = updateHtml.Replace(tVariable.name, tValue.Name);
                updateHtml = updateHtml.Replace(tVariable.productname, tValue.ProductName);
                updateHtml = updateHtml.Replace(tVariable.productid, tValue.ProductId);
                updateHtml = updateHtml.Replace(tVariable.unit, tValue.Unit);
                updateHtml = updateHtml.Replace(tVariable.quantity, tValue.Quantity);
                updateHtml = updateHtml.Replace(tVariable.discount, tValue.Discount);
                updateHtml = updateHtml.Replace(tVariable.price, tValue.Price);
                updateHtml = updateHtml.Replace(tVariable.priceafterdiscount, tValue.PriceAfterDiscount);
            }

            model.TemplateHtml = updateHtml;
            return(updateHtml);
        }
Esempio n. 3
0
        public void StartApplication_Pipeline_Success(
            TestApplicationRepository applicationRepository,
            ApplicationController applicationController,
            ProcessLauncherMockup processLauncher,
            Application application,
            string pipeline)
        {
            var pipelineVariable = TemplateVariable.Pipeline(pipeline);

            var command = application.Commands[new Random().Next(0, application.Commands.Count - 1)];

            command.Arguments = new List <string> {
                pipelineVariable.Name
            };
            applicationRepository.AddApplication(application);


            applicationController.StartApplication(application.Name, command.Name, pipeline: pipeline);


            var process = processLauncher.Processes.FirstOrDefault(p => p.FileName == application.Executable);

            Assert.NotNull(process);
            Assert.Contains(pipeline, process.Arguments);
        }
Esempio n. 4
0
        public ActionResult CreateTmplVar(TemplateVariable tmplVar)
        {
            if (tmplVar.Description.Length < 1 || tmplVar.Name.Length < 1 || tmplVar.Value.Length < 1)
            {
                ModelState.AddModelError("Template Variable", "Template Variable should have a name, a description and a value");
            }

            if (!ModelState.IsValid)
            {
                return(Json(ModelState));
            }
            using (var dbContext = new SarahIncContext())
            {
                var tplVar = (from t in dbContext.TemplateVariable
                              where t.Name == tmplVar.Name
                              select t).FirstOrDefault();

                if (tplVar != null)
                {
                    return(Json(ModelState));
                }

                tplVar = new TemplateVariable();
                dbContext.TemplateVariable.Add(tplVar);
                tplVar.UserId      = tmplVar.UserId;
                tplVar.Description = tmplVar.Description;
                tplVar.Name        = tmplVar.Name;
                tplVar.Value       = tmplVar.Value;
                dbContext.SaveChanges();
                tmplVar.TmplId = tplVar.TmplId;
            }
            // Return the updated tmplVar. Also return any validation errors.
            return(Json(ModelState));
        }
        public ActionResult ShowTemplate(TemplateModel model)
        {
            TemplateVariable tVariable = new TemplateVariable();
            TemplateValue    tValue    = new TemplateValue();
            string           Barcode   = @"<svg id = 'barcode'></svg><script>JsBarcode('#barcode', '" + tValue.Barcode + "', {width: 2,height: 40});</script>";
            //        //format: "pharmacode",
            //        //lineColor: "#0aa",
            //+ 'width: 2,'
            //+ 'height: 40,'
            //        // displayValue: false
            //+ '});</script>';
            string updateHtml = "";

            if (model.TemplateHtml != null)
            {
                string html = model.TemplateHtml;
                updateHtml = html.Replace(tVariable.barcode, Barcode);
                updateHtml = updateHtml.Replace(tVariable.name, tValue.Name);
                updateHtml = updateHtml.Replace(tVariable.branchname, tValue.BranchName);
                updateHtml = updateHtml.Replace(tVariable.branchemail, tValue.BranchEmail);
                updateHtml = updateHtml.Replace(tVariable.productname, tValue.ProductName);
                updateHtml = updateHtml.Replace(tVariable.productid, tValue.ProductId);
                updateHtml = updateHtml.Replace(tVariable.unit, tValue.Unit);
                updateHtml = updateHtml.Replace(tVariable.quantity, tValue.Quantity);
                updateHtml = updateHtml.Replace(tVariable.discount, tValue.Discount);
                updateHtml = updateHtml.Replace(tVariable.price, tValue.Price);
                updateHtml = updateHtml.Replace(tVariable.priceafterdiscount, tValue.PriceAfterDiscount);
                updateHtml = updateHtml.Replace(tVariable.branchlogo, tValue.BranchLogo);
            }

            model.TemplateHtml = updateHtml;
            return(View(model));
        }
        public async Task <int> Handle(CreateTemplateVariableCommand request, CancellationToken cancellationToken)
        {
            var entity = new TemplateVariable
            {
                ProjectId = request.ProjectId,
                Label     = request.Label,
                Content   = request.Content,
                Type      = request.Type,
                ShowRaw   = request.ShowRaw,
                ParentTemplateVariableId = request.ParentTemplateVariableId
            };

            _context.TemplateVariables.Add(entity);

            await _context.SaveChangesAsync(cancellationToken);

            return(entity.Id);
        }