public TabbedMainViewModel( ExecutionContextFactory executionContextFactory, IEnumerable <IMainTab> mainTabs, IEnumerable <IInitializationStep> initializationSteps, ProductInformation productInformation = null, LogsViewModel logsViewModel = null, SettingsViewModel settingsViewModel = null) : base(executionContextFactory) { ProductInformation = productInformation; LogsViewModel = logsViewModel; SettingsViewModel = settingsViewModel; _initializationSteps = initializationSteps .OrderBy(x => x.Order) .ToList(); List <IMainTab> tabs = mainTabs .OrderBy(x => x.Order) .ToList(); FixedHeaderCount = tabs.Count(x => x.IsFixed); Items.AddRange(tabs); ActiveItem = Items.FirstOrDefault(); ExecutionContext.EventAggregator.SubscribeOnPublishedThread(this); if (ProductInformation != null) { DisplayName = $"{ProductInformation.ProgramName} - {ProductInformation.Version}"; } }
public async Task <IActionResult> GetItemByLinkIdAsync(int linkId, CancellationToken ct) { var itemStoreLink = await _itemStoreLinkRepository.GetEntityAsync(linkId, ct); if (itemStoreLink == null) { return(NoContent()); } var itemEntity = await _itemRepository.GetEntityAsync(itemStoreLink.ItemId, ct); if (itemEntity == null) { return(NoContent()); } Item item = new Item { LinkId = linkId, Image = null, InStock = itemStoreLink.InStock, Name = itemEntity.Name, Price = itemStoreLink.Price, StockAmount = itemStoreLink.StockAmount, }; ProductInformation productInformation = null; if (itemEntity.SpoonacularProductId != 0) { productInformation = GetSpoonacularProductInformationById(itemEntity.SpoonacularProductId) as ProductInformation; } return(Ok(item)); }
public async Task <IActionResult> NewInformation(ProductInformation productInformation) { try { if (ModelState.IsValid) { string insertQuery = "INSERT INTO ProductInformation(ProductId, Value, Day, Month, Year) VALUES(@ProductId, @Value, @Day, @Month, @Year)"; NpgsqlCommand cmd = new NpgsqlCommand(insertQuery, _connection); cmd.CommandType = CommandType.Text; cmd.Parameters.AddWithValue("@ProductId", productInformation.ProductId); cmd.Parameters.AddWithValue("@Value", productInformation.Value); cmd.Parameters.AddWithValue("@Day", productInformation.Day); cmd.Parameters.AddWithValue("@Month", productInformation.Month); cmd.Parameters.AddWithValue("@Year", productInformation.Year); await _connection.OpenAsync(); await cmd.ExecuteNonQueryAsync(); return(RedirectToAction("DetailsProduct", "Products", new { productId = productInformation.ProductId })); } return(View(productInformation)); } catch (Exception ex) { throw ex; } finally { await _connection.CloseAsync(); } }
public async Task <string> Create(ProductCreateViewModel model) { var product = new Product { Id = Guid.NewGuid().ToString(), Name = model.Name, DateTimeCreate = DateTime.Now, Description = model.Description, Price = model.Price, UrlImage = model.UrlImage, ProviderId = model.ProviderId }; await _applicationContext.Products.AddAsync(product); var productInformation = new ProductInformation { Id = Guid.NewGuid().ToString(), ProductId = product.Id, Memory = model.ProductInformation.Memory, NumberOfCores = model.ProductInformation.NumberOfCores, OperatingSystem = model.ProductInformation.OperatingSystem, Ram = model.ProductInformation.Ram, ScreenSize = model.ProductInformation.ScreenSize }; await _applicationContext.ProductInformations.AddAsync(productInformation); await _applicationContext.SaveChangesAsync(); return(product.Id); }
public AnalyzeMenu(ILifetimeScope scope, DTE dte, IOutputWindowWriter output) { _scope = scope; _dte = dte; _output = output; _productInfo = new ProductInformation("AnalyzeMenu"); }
private void CommandBinding_Executed_ManualPrice(object sender, ExecutedRoutedEventArgs e) { ManagementViewModel vm = DataContext as ManagementViewModel; ProductInformation selectedProduct = (e.OriginalSource as DataGridRow).DataContext as ProductInformation; vm.ManualPrice(selectedProduct); }
/// <summary> /// The main entry point for the application. /// </summary> static void Main(string[] args) { Platform.Log(LogLevel.Info, ProductInformation.GetNameAndVersion(true, true, true, true)); var commandLine = new CommandLine(args); if (commandLine.RunAsService) { var ServicesToRun = new ServiceBase[] { new ShredHostService() }; ServiceBase.Run(ServicesToRun); } else if (!String.IsNullOrEmpty(commandLine.PreviousExeConfigurationFilename)) { var groups = SettingsGroupDescriptor.ListInstalledSettingsGroups(SettingsGroupFilter.LocalStorage); groups.Add(new SettingsGroupDescriptor(typeof(ShredSettingsMigrator).Assembly.GetType("ClearCanvas.Server.ShredHost.ShredHostServiceSettings"))); foreach (var group in groups) { SettingsMigrator.MigrateSharedSettings(group, commandLine.PreviousExeConfigurationFilename); } ShredSettingsMigrator.MigrateAll(commandLine.PreviousExeConfigurationFilename); } else { ShredHostService.InternalStart(); Console.WriteLine("Press <Enter> to terminate the ShredHost."); Console.WriteLine(); Console.ReadLine(); ShredHostService.InternalStop(); } }
// GET: Product public ActionResult Update(FormCollection fc) { using (dbEntities db = new dbEntities()) { ProductInformation _product = db.ProductInformations.FirstOrDefault(); if (fc.Count > 0) { try { string productName = fc["productname"]; string productInformation = fc["productdescription"]; string company = fc["company"]; string senderDesignation = fc["senderdesignation"]; string date = fc["date"]; _product.ProductDescription = productInformation; _product.ProductName = productName; _product.LetterFrom = company; _product.SenderDesignation = senderDesignation; _product.SentDate = Convert.ToDateTime(date); db.SaveChanges(); ViewBag.Message = "Product information was successfully updated"; return(View(db.ProductInformations.FirstOrDefault())); } catch (Exception ex) { ViewBag.Message = "Some error occurred while updating product information " + ex.Message; return(View(db.ProductInformations.FirstOrDefault())); } } else { return(View(_product)); } } }
protected void repItems_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem) { return; } if (Roles.IsUserInRole(UserType.Lectores.ToString())) { TextBox tbtemp = (TextBox)e.Item.FindControl("txtPuntoReposicion"); tbtemp.Enabled = false; tbtemp = (TextBox)e.Item.FindControl("txtLeadTime"); tbtemp.Enabled = false; tbtemp = (TextBox)e.Item.FindControl("txtSafety"); tbtemp.Enabled = false; ImageButton imtemp = (ImageButton)e.Item.FindControl("btnGuardarInd"); imtemp.Enabled = false; CheckBox cbtemp = (CheckBox)e.Item.FindControl("chkGuardar"); cbtemp.Enabled = false; } ProductInformation pi = (ProductInformation)e.Item.DataItem; Detalle det = (Detalle)e.Item.FindControl("ucDetalle"); det.ProductId = pi.Id; }
public void DeleteTest() { var repo = new Mock <IProductRepository>(); var info0 = new ProductInformation() { Id = Guid.NewGuid() }; var info1 = new ProductInformation() { Id = Guid.NewGuid() }; var info2 = new ProductInformation() { Id = Guid.NewGuid() }; var info3 = new ProductInformation() { Id = Guid.NewGuid() }; repo.Setup(x => x.DeleteEntity(info1.Id)); var controller = new ProductController(repo.Object); Assert.False(controller.Delete(info1.Id) is BadRequestResult); Assert.False(controller.Delete(info1.Id) is BadRequestResult); }
internal static void FillDataSet(IDicomAttributeProvider dataSet, VolumeSlice slice) { // generate values for SC Equipment Module var scEquipment = new ScEquipmentModuleIod(dataSet); scEquipment.ConversionType = @"WSD"; scEquipment.SecondaryCaptureDeviceManufacturer = @"ClearCanvas Inc."; scEquipment.SecondaryCaptureDeviceManufacturersModelName = ProductInformation.GetName(false, false); scEquipment.SecondaryCaptureDeviceSoftwareVersions = new[] { ProductInformation.GetVersion(true, true, true, true) }; // generate values for the General Image Module dataSet[DicomTags.ImageType].SetStringValue(@"DERIVED\SECONDARY"); dataSet[DicomTags.DerivationDescription].SetStringValue(@"Multiplanar Reformatting"); dataSet[DicomTags.DerivationCodeSequence].Values = new[] { ImageDerivationContextGroup.MultiplanarReformatting.AsDicomSequenceItem() }; // update the Image Plane Module dataSet[DicomTags.PixelSpacing].SetStringValue(slice.PixelSpacing); dataSet[DicomTags.ImageOrientationPatient].SetStringValue(slice.ImageOrientationPatient); dataSet[DicomTags.ImagePositionPatient].SetStringValue(slice.ImagePositionPatient); dataSet[DicomTags.SliceThickness].SetStringValue(slice.SliceThickness); // update the spacing between slices, even though it's only part of modality-specific modules dataSet[DicomTags.SpacingBetweenSlices].SetStringValue(slice.SpacingBetweenSlices); // update the Image Pixel Module dataSet[DicomTags.Rows].SetInt32(0, slice.Rows); dataSet[DicomTags.Columns].SetInt32(0, slice.Columns); // generate values for Multi-Frame Module dataSet[DicomTags.NumberOfFrames].SetInt32(0, 1); // generate values for SOP Common Module dataSet[DicomTags.SopClassUid].SetStringValue(SopClass.SecondaryCaptureImageStorageUid); dataSet[DicomTags.SopInstanceUid].SetStringValue(DicomUid.GenerateUid().UID); }
public void CountTest() { var repo = new Mock <IProductRepository>(); var info0 = new ProductInformation() { Id = Guid.NewGuid() }; var info1 = new ProductInformation() { Id = Guid.NewGuid() }; var info2 = new ProductInformation() { Id = Guid.NewGuid() }; var info3 = new ProductInformation() { Id = Guid.NewGuid() }; repo.Setup(x => x.EntitiesCount()) .Returns(4); var controller = new ProductController(repo.Object); int result = controller.Count(); Assert.True(result == 4); }
protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); product = (ProductInformation)e.Parameter; txtId.Text = product.Id.ToString(); txtName.Text = product.Name; //Code could be written with if statements, or with ?? expression (which uses less code than an if statement) //if (product.Color == null) //{ // txtColor.Text = ""; //} //else //{ // txtColor.Text = product.Color; //} txtColor.Text = product.Color == null ? "" : product.Color; txtPrice.Text = product.Price == null ? "" : product.Price.ToString(); txtLength.Text = product.Length == null ? "" : product.Length.ToString(); txtHeight.Text = product.Height == null ? "" : product.Height.ToString(); txtBrand.Text = product.Brand == null ? "" : product.Brand; txtCategory.Text = product.AnimalCategory == null ? "" : product.AnimalCategory; txtDescription.Text = product.Description == null ? "" : product.Description; }
public IActionResult Edit(int?id) { ProductInformationViewModel model = new ProductInformationViewModel(); //编辑界面 if (id != null) { ProductInformation product = _productInformationService.GetProductById((int)id); model = new ProductInformationViewModel { ProductId = product.Id, ProductCode = product.ProductCode, ProductName = product.ProductName, ProductStatusType = product.ProductStatus, StockStatusType = product.StockType, ClassType = product.Type, Description = product.Description, BatchId = product.BatchId }; } PopulateClassDropDownList(); PopulateProductStatusDropDownList(); PopulateStockStatusDropDownList(); PopulateBatchDropDownList(); return(View(model)); }
public async Task <string> Analyze(string path) { var productInformation = new ProductInformation("ApiPort_Console"); string reportPath = string.Empty; string[] args = { "analyze", "-f", path }; var options = CommandLineOptions.ParseCommandLineOptions(args); using (var container = DependencyBuilder.Build(options, productInformation)) { var progressReport = container.Resolve <IProgressReporter>(); try { var client = container.Resolve <ConsoleApiPort>(); reportPath = await client.AnalyzeAssembliesAsync(); return(reportPath); } catch (Exception ex) { Console.WriteLine(ex.Message); return(reportPath); } } }
public static IUnityContainer Build(ICommandLineOptions options, ProductInformation productInformation) { var container = new UnityContainer(); var targetMapper = new TargetMapper(); targetMapper.LoadFromConfig(options.TargetMapFile); container.RegisterInstance <ICommandLineOptions>(options); container.RegisterInstance <ITargetMapper>(targetMapper); // For debug purposes, the FileOutputApiPortService helps as it serializes the request to json and opens it with the // default json handler. To use this service, uncomment the the next line and comment the one after that. //container.RegisterType<IApiPortService, FileOutputApiPortService>(new ContainerControlledLifetimeManager()); container.RegisterInstance <IApiPortService>(new ApiPortService(options.ServiceEndpoint, productInformation)); container.RegisterType <IEnumerable <IgnoreAssemblyInfo>, FileIgnoreAssemblyInfoList>(new ContainerControlledLifetimeManager()); container.RegisterType <IDependencyFinder, ReflectionMetadataDependencyFinder>(new ContainerControlledLifetimeManager()); container.RegisterType <IDependencyFilter, DotNetFrameworkFilter>(new ContainerControlledLifetimeManager()); container.RegisterType <IReportGenerator, ReportGenerator>(new ContainerControlledLifetimeManager()); container.RegisterType <ApiPortService>(new ContainerControlledLifetimeManager()); container.RegisterType <IFileSystem, WindowsFileSystem>(new ContainerControlledLifetimeManager()); container.RegisterType <IFileWriter, ReportFileWriter>(new ContainerControlledLifetimeManager()); container.RegisterType <IRequestAnalyzer, RequestAnalyzer>(new ContainerControlledLifetimeManager()); container.RegisterType <IAnalysisEngine, AnalysisEngine>(new ContainerControlledLifetimeManager()); container.RegisterType <ConsoleApiPort>(new ContainerControlledLifetimeManager()); container.RegisterType <ICollection <IReportWriter> >(new ContainerControlledLifetimeManager(), new InjectionFactory(WriterCollection)); container.RegisterType <IApiPortOptions>(new ContainerControlledLifetimeManager(), new InjectionFactory(GetOptions)); container.RegisterType <DocIdSearchRepl>(new ContainerControlledLifetimeManager()); container.RegisterType <ISearcher <string>, ApiPortServiceSearcher>(new ContainerControlledLifetimeManager()); // Register the default output format name container.RegisterInstance(DefaultOutputFormatInstanceName, "Excel"); if (Console.IsOutputRedirected) { container.RegisterInstance <IProgressReporter>(new TextWriterProgressReporter(Console.Out)); } else { container.RegisterType <IProgressReporter, ConsoleProgressReporter>(new ContainerControlledLifetimeManager()); } #if FEATURE_DESKTOP_CONFIGURATION // Unity configuration is only available in its desktop package // Load any customizations via Unity var fileMap = new ExeConfigurationFileMap { ExeConfigFilename = Path.Combine(GetApplicationDirectory(), "unity.config") }; var configuration = ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None); var unitySection = (UnityConfigurationSection)configuration.GetSection("unity"); return(unitySection == null ? container : container.LoadConfiguration(unitySection)); #else // FEATURE_DESKTOP_CONFIGURATION // TODO : Allow runtime configuration through some non-.config means? return(container); #endif // FEATURE_DESKTOP_CONFIGURATION }
public ActionResult Send() { var cusList = new List <Customer>(); var newProduct = new ProductInformation(); var letterDataList = new List <LetterData>(); try { using (dbEntities db = new dbEntities()) { // geting list of customers cusList = db.Customers.ToList(); // geting new product information newProduct = db.ProductInformations.OrderByDescending(x => x.Id).Take(1).FirstOrDefault(); } // sending letters to all customers foreach (var cus in cusList) { LetterData ld = new LetterData(); ReportingEngine engine = new ReportingEngine(); DataSet dsMailMerge = new DataSet(); string dataDir = Server.MapPath("~/Document/Template/New Product Introduction Letter.docx"); // Loding doc template Document doc = new Document(dataDir); // building dataset ld = new LetterData { ProductDescription = newProduct.ProductDescription, ProductName = newProduct.ProductName, ReceiverName = cus.Name, SenderDesignation = WebUtility.senderDesignation, SenderName = WebUtility.senderName, SentDate = DateTime.Now }; // Execute the build report. engine.BuildReport(doc, ld, "ld"); string uniqueDoc = Server.MapPath("~/Document/Unique/" + cus.Name + ".docx"); // Save the document to disk. doc.Save(uniqueDoc); // Sending news letter using smtp if (GeneralFunctions.SendEmail(cus, uniqueDoc, ld.ProductName)) { return(View("Success")); } else { return(View("Error")); } } return(View("About")); } catch (Exception ex) { ViewBag.Message = ex.Message; return(View("Error")); } }
private void DataGridRow_MouseDoubleClick(object sender, MouseEventArgs e) { ManagementViewModel vm = DataContext as ManagementViewModel; ProductInformation selectedProduct = (e.Source as DataGridRow).DataContext as ProductInformation; vm.ShowProductInfo(selectedProduct); }
/// <summary> /// Initializes a new instance of <see cref="SopInstanceFactory"/>. /// </summary> protected SopInstanceFactory() { Manufacturer = @"ClearCanvas Inc."; ManufacturersModelName = ProductInformation.GetName(true, false); DeviceSerialNumber = string.Empty; SoftwareVersions = ProductInformation.GetVersion(true, true, true); SpecificCharacterSet = @"ISO_IR 192"; }
public ApiPortServiceTests() { var httpMessageHandler = new TestHandler(HttpRequestConverter); var productInformation = new ProductInformation("ApiPort_Tests"); //Create a fake ApiPortService which uses the TestHandler to send back the response message _apiPortService = new ApiPortService("http://localhost", httpMessageHandler, productInformation); }
public UpdateWindow() { this.titleContent = new GUIContent(Resources.UI_UNITYPLUGIN_WINDOW_UPDATE_TITLE); this.minSize = new Vector2(380, 290); this.position = new Rect( (Screen.width - this.minSize.x) / 2, (Screen.height - this.minSize.y) / 2, this.minSize.x, this.minSize.y ); this.padding = new Rect(10, 10, 10, 10); this.rows = Array.ConvertAll(ProductInformation.GetKnownProducts(), p => new ProductRow(p.Id, p.Name, p.Disabled) { CurrentVersion = p.CurrentVersion, AllBuilds = p.AllBuilds, Location = p.Location, ExpectedVersion = p.ExpectedVersion }); this.columns = new[] { new ProductColumn(Resources.UI_UNITYPLUGIN_WINDOW_UPDATE_PRODUCT_COLUMN_NAME, RenderProductCell) { Flex = true, Width = 10 }, new ProductColumn(Resources.UI_UNITYPLUGIN_WINDOW_UPDATE_CURRENT_VERSION_COLUMN_NAME, RenderCurrentVersionCell) { Width = 100 }, new ProductColumn(Resources.UI_UNITYPLUGIN_WINDOW_UPDATE_AVAILABLE_VERSION_COLUMN_NAME, RenderSelectedVersionCell) { Width = 100 }, new ProductColumn(Resources.UI_UNITYPLUGIN_WINDOW_UPDATE_ACTION_COLUMN_NAME, RenderActionCell) { Width = 80 } }; this.UpdateColumnWidths(); for (var i = 0; i < this.rows.Length; i++) { var row = this.rows[i]; if (row.CurrentVersion.IsCompleted == false) { row.CurrentVersion.ContinueWith(this.ContinueWithRepaint); } if (row.AllBuilds.IsCompleted == false) { row.AllBuilds.ContinueWith(this.ContinueWithRepaint); } Promise.WhenAll(row.CurrentVersion, row.AllBuilds) .ContinueWith(p => ChooseAction(row)) .ContinueWith(this.ContinueWithRepaint); } }
public Product(ProductInformation productInformation, double price, int quantity, DateTime expirationDate) { ProductInformation = productInformation; Price = price; Quantity = quantity; ExpirationDate = expirationDate; HasInStock = true; AddDate = DateTime.Now; }
public static Economy defineManually(ProductInformation productInformation, Int32 quantity) { Economy economy = new Economy(); economy.currency = productInformation.currency; economy.total = productInformation.price * quantity; return(economy); }
private async void DeleteProduct(ProductInformation prod) { var productId = prod.Id; await client.DeleteProductAsync(productId); mess.ShowMessage("Product with id " + productId + " has been deleted successfully."); Frame.Navigate(typeof(ProductsPage)); }
public void ChangeProductInformation(ProductInformation productInformation) { ProductInformation = productInformation; if (!productInformation.VerifyQuantity()) { Status = ProductStatus.BUY.Name; } }
public IActionResult NewInformation(int productId) { ProductInformation productInformation = new ProductInformation { ProductId = productId }; return(View(productInformation)); }
private string OrderAmountFromInvoice(string cryptoCode, ProductInformation productInformation) { // if invoice source currency is the same as currently display currency, no need for "order amount from invoice" if (cryptoCode == productInformation.Currency) { return(null); } return(_CurrencyNameTable.DisplayFormatCurrency(productInformation.Price, productInformation.Currency)); }
private bool DeleteProduct(ProductInformation product) { bool success = data.Remove(product); if (success) { SerializeToFile(); } return(success); }
public IActionResult SaveProductDescription(string description, int productId) { if (productId > 0) { ProductInformation product = _productInformationService.GetProductById(productId); product.Description = description; _productInformationService.UpdateProduct(product); } return(View()); }
public Product(ProductData productData, DateTimeProduct dateTimeProduct, ProductInformation productInformation, string category, string userId) { ProductData = productData; DateTimeProduct = dateTimeProduct; ProductInformation = productInformation; Category = category; Status = ProductStatus.IDEAL.Name; UserId = userId; }
public virtual void AddProductIdentifier(string productId) { IsInitalized = false; if (productDictionary.ContainsKey(productId)) return; productDictionary[productId] = new ProductInformation(productId); }