public ActionResult AdminDetails(int ProductID) { myHandler = new BusinessLogicHandler(); gadget = new Technology(); gadget = myHandler.GetTechnologyDetails(ProductID); return View(gadget); }
void Update() { if (previousViewingTechnology != game.ViewingTechnology) { UpdateTechnologyDetail(); previousViewingTechnology = game.ViewingTechnology; } }
public void TechnologyFinderRunCrawlerCantCrashWithABadURL() { FileStream patternsFile = new FileStream(AppDomain.CurrentDomain.BaseDirectory + @"\\MagentoStringPatterns.txt", FileMode.Open); ITechnology technology = new Technology("Magento", patternsFile); List<string> badURL = new List<string> { "w1jafpi3rvcdf" }; TechnologyFinder finder = new TechnologyFinder(technology, badURL); finder.RunCrawler(); }
public void TechnologyFinderMustSetupTechnologyOnConstructor() { FileStream patternsFile = new FileStream(AppDomain.CurrentDomain.BaseDirectory + @"\\MagentoStringPatterns.txt", FileMode.Open); ITechnology technology = new Technology("Magento", patternsFile); FileStream sitesFile = new FileStream(System.AppDomain.CurrentDomain.BaseDirectory + @"\\MagentoSitesURLs.txt", FileMode.Open); SitesLoader sitesLoader = new SitesLoader(sitesFile); TechnologyFinder finder = new TechnologyFinder(technology, sitesLoader.SitesURLs); Assert.IsNotNull(finder); }
public void updateInfos(Technology tech, CPopulation pop){ codeText.text = tech.code; fillBar.fillAmount = (float)tech.value / (float)tech.valueNeeded; valueText.text = tech.value.ToString()+" (+"+pop.TotalTechnologyPointToGet+")"; maxText.text = "/" + tech.valueNeeded.ToString(); if (tech.IsLearned) { fillBar.color = Color.green; } }
private static void CreateUserSkill(UserSkill userSkill, string color, Technology technology) { userSkill.Color = color; userSkill.Name = technology.Name; userSkill.Percentage = technology.Percentage; userSkill.Extension = technology.Extension; userSkill.Categories = technology.Categories; userSkill.Width = (int)( technology.Percentage * 3 ); }
void Start() { technologyIconImage = technologyIcon.GetComponent<Image>(); technologyDetailText = technologyDetail.GetComponent<Text>(); if (game == null) { game = Camera.main.GetComponent<Game>(); } previousViewingTechnology = null; }
public void TechnologyFinderRunCrawlerOnMagento() { FileStream patternsFile = new FileStream(AppDomain.CurrentDomain.BaseDirectory + @"\\MagentoStringPatterns.txt", FileMode.Open); ITechnology technology = new Technology("Magento", patternsFile); FileStream sitesFile = new FileStream(AppDomain.CurrentDomain.BaseDirectory + @"\\MagentoSitesURLs.txt", FileMode.Open); SitesLoader sitesLoader = new SitesLoader(sitesFile); TechnologyFinder finder = new TechnologyFinder(technology, sitesLoader.SitesURLs); finder.RunCrawler(); Assert.AreEqual(7, finder.SiteURLsWithTheTechnology.Count); finder.WriteFoundSites(); }
public void TechnologyConstructorMustSucessfullReadStringsPatternsFileAndSetName() { FileStream patternsFile = new FileStream(AppDomain.CurrentDomain.BaseDirectory + @"\\MagentoStringPatterns.txt", FileMode.Open); Technology technology = new Technology("Magento", patternsFile); List<string> patterns = technology.PatternsStrings; Assert.AreEqual(technology.Name, "Magento"); Assert.AreEqual(patterns.Count, 5); Assert.AreEqual(patterns[0], "Varien"); Assert.AreEqual(patterns[1], "/skin/frontend/"); Assert.AreEqual(patterns[2], "/app/design/frontend"); Assert.AreEqual(patterns[3], "/giftcard/customer"); }
public async Task<ActionResult> Edit() { if (User.Identity.IsAuthenticated) { ApplicationDbContext mycontext = new ApplicationDbContext(); UserStore<ApplicationUser> myStore = new UserStore<ApplicationUser>(mycontext); ApplicationUserManager mgr = new ApplicationUserManager(myStore); var user = await mgr.FindByNameAsync(User.Identity.Name); WishlistActions grantMyWish = new WishlistActions(); CartActions cart = new CartActions(); ProductViewModel bridge = new ProductViewModel(); List<Book> bookList = new List<Book>(); List<Technology> deviceList = new List<Technology>(); myHandler = new BusinessLogicHandler(); bridge.allWishlistItems = new List<WishlistItem>(); bridge.allWishlistItems = grantMyWish.GetWishlistItems(user.Wishlists.WishlistID); if(bridge.allWishlistItems != null) { bridge.allBook = new List<Book>(); foreach(var item in bridge.allWishlistItems) { if(myHandler.CheckProductType(item.ProductID)) { Book myBook = new Book(); myBook = myHandler.GetBook(item.ProductID); bookList.Add(myBook); } else { Technology myDevice = new Technology(); myDevice = myHandler.GetTechnologyDetails(item.ProductID); deviceList.Add(myDevice); } } //bridge.allBook = myHandler.GetBooks(); bridge.allTechnology = new List<Technology>(); //bridge.allTechnology = myHandler.GetTechnology(); bridge.allBook = bookList; bridge.allTechnology = deviceList; } Session["wishlistTotal"] = grantMyWish.GetWishlistTotal(user.Wishlists.WishlistID); Session["cartTotal"] = cart.GetTotalAsync(user.Carts.CartID); return View(bridge); } else return RedirectToAction("Login", "Account", null); }
/// <summary> /// Initializes a new instance of the <see cref="Core.Models.Account"/> class. /// </summary> /// <param name="id">Account Identifier.</param> public Account(int id) : base() { ID = id; UserName = "******"; TerritoryBuildings = new Dictionary<PositionI, long>(); Buildings = new Dictionary<PositionI, long>(); Units = new LinkedList<PositionI>(); BuildableBuildings = new Dictionary<long, List<long>>(); Scrap = new Scrap(); Population = new Population(); Technology = new Technology(); Energy = new Energy(); Plutonium = new Plutonium(); }
public ActionResult ByCategory(string name, int CategoryID) { #region Init BusinessLogicHandler myHandler = new BusinessLogicHandler(); SearchViewModel model = new SearchViewModel(); Technology helper = new Technology(); #endregion #region Get Devices By Category if (name != null) { try { model.GadgetResults = myHandler.CategoryDeviceSearch(name); model.TCategory = new TechCategory(); helper = (Technology)model.GadgetResults.Take(1).FirstOrDefault(); model.TCategory = myHandler.GetTechnologyType(helper.TechCategoryID); } catch { model.GadgetResults = myHandler.DevicesByCategory(CategoryID);//Replace model.TCategory = new TechCategory(); model.TCategory = myHandler.GetTechnologyType(CategoryID); } } if (CategoryID != 0) { model.GadgetResults = myHandler.DevicesByCategory(CategoryID);//Replace model.TCategory = new TechCategory(); model.TCategory = myHandler.GetTechnologyType(CategoryID); } #endregion return View(model); }
protected override void OnModelCreating(ModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); modelBuilder.Entity <UserTechnology>().HasKey(t => new { t.UserId, t.TechnologyId }); modelBuilder.Entity <Technology>().HasData( Technology.CreateTechnology("Java"), Technology.CreateTechnology("JavaScript"), Technology.CreateTechnology(".Net"), Technology.CreateTechnology("C#"), Technology.CreateTechnology("Unity"), Technology.CreateTechnology("Node.js"), Technology.CreateTechnology("Angular"), Technology.CreateTechnology("React"), Technology.CreateTechnology("Vue"), Technology.CreateTechnology("Express"), Technology.CreateTechnology("Swift"), Technology.CreateTechnology("MongoDb"), Technology.CreateTechnology("C++"), Technology.CreateTechnology("Python"), Technology.CreateTechnology("C") ); }
private void cbTEmul_SelectedIndexChanged(object sender, EventArgs e) { try { dgvU.Rows.Clear(); dgvY.Rows.Clear(); Technology t = (Technology)cbTEmul.SelectedItem; Variable[] arrU, arrY; string rep; Program.Unite(t.lStage.ToArray(), out arrU, out arrY, out rep); for (int i = 0; i < arrU.Length; i++) { if (checkBox1.Checked) { dgvU.Rows.Add(arrU[i].name, -1, 1, 1); } else { dgvU.Rows.Add(arrU[i].name, arrU[i].Inv(-1), arrU[i].Inv(1), arrU[i].sigma); } } for (int i = 0; i < arrY.Length; i++) { if (checkBox1.Checked) { dgvY.Rows.Add(arrY[i].name, -1, 1, 1, 0); } else { dgvY.Rows.Add(arrY[i].name, arrY[i].Inv(-1), arrY[i].Inv(1), 1, arrY[i].av); } } cbTReg.SelectedItem = t; } catch { } }
public void PutTechnology_Positive_ReturnsUpdatedObject() { var dataRepo = new Mock <IDatabaseRepository>(); Technology technology = new Technology { Name = "Java", Topics = new List <Topic>() }; dataRepo.Setup(d => d.UpdateTechnology(technology)).Returns(technology); SMEController sMEController = new SMEController(dataRepo.Object); var actionResult = sMEController.Put(technology); Assert.NotNull(actionResult); var createdResult = actionResult as CreatedResult; Assert.NotNull(createdResult); var model = createdResult.Value as Technology; Assert.NotNull(model); }
public TechnologyItemEditorWindow(Technology Technology) { this.Technology = Technology; InitializeComponent(); DataContext = Technology; dataGrid.ItemsSource = Technology.PrereqforDesc.Cotegories; //Technology.AiWeight = new WeightModifier() //{ // Factor = "100", // Weight = "100", // Modifiers = new ObservableCollection<WeightModifier.Modifier>() // { // new WeightModifier.Modifier() // { // Factor = "10", // Weight = "10", // Triggers = new ObservableCollection<pdx.scriptobject.Expression>() // { // new pdx.scriptobject.Expression() // { // Key = "is_ai", // Operator = "=", // Value = "no" // } // } // } // } //}; Ai_Weight.ItemsSource = Technology.AiWeight.Modifiers; //TreeView tree = new TreeView(); //tree = ControlsSearchHelper.GetChildObject<TreeView>(Find, "weightModifer"); //tree.ItemsSource = Technology.AiWeight.Modifiers; //string str = null; //str = TreeViewTransition.WeightToStr(Technology.AiWeight); //MessageBox.Show(str); }
public void SaveNewProfile(ProfileDTO profileDTO) { var developer = new Developer { Name = profileDTO.DeveloperName }; // Validations if (string.IsNullOrWhiteSpace(profileDTO.StackName)) { throw new Exception("Include some parameters validatins here :)"); } var technology = new Technology { Name = profileDTO.TechnologyName, Description = profileDTO.TechnologyDescription, Enabled = true }; var stack = new Stack { Name = profileDTO.StackName, Description = profileDTO.StackDescription, Enabled = true }; var skill = new Skill { Developer = developer, Stack = stack, Technology = technology }; skillRepository.Save(skill); }
/// <summary> /// Get Technology By Id /// </summary> /// <param name="id"></param> /// <returns></returns> public async Task <Technology> FindAsync(int id) { using (var conn = OpenDBConnection()) { StringBuilder sql = new StringBuilder(); sql.Length = 0; sql.Append("SELECT TE.*, CA.* "); sql.Append("FROM Technology AS TE "); sql.Append("INNER JOIN Category AS CA "); sql.Append("ON TE.CategoryId = CA.Id "); sql.Append("WHERE TE.Id = @Id "); sql.Append("AND TE.Status = 1 AND CA.Status = 1 "); var lookup = new Dictionary <int, Technology>(); var param = new { Id = id }; await conn.QueryAsync <Technology, Category, Technology>(sql.ToString(), (m, n) => { Technology mode = new Technology(); if (!lookup.TryGetValue(m.Id, out mode)) { lookup.Add(m.Id, mode = m); } if (mode.Category == null) { mode.Category = new Category(); } mode.Category = n; return(mode); }, param); var models = lookup.Values.FirstOrDefault(); return(models); } }
public JsonResult GetTechologyData() { sqlCon.Open(); SqlCommand SP_M_SelectTech = new SqlCommand("SP_M_SelectTech", sqlCon); SP_M_SelectTech.CommandType = CommandType.StoredProcedure; SqlDataReader dataReader = SP_M_SelectTech.ExecuteReader(); List <Technology> technologies = new List <Technology>(); while (dataReader.Read()) { Technology technology = new Technology(); technology.TechId = Convert.ToInt32(dataReader["Id"]); technology.TechName = dataReader["TechName"].ToString(); technologies.Add(technology); } sqlCon.Close(); return(Json(technologies, JsonRequestBehavior.AllowGet)); }
public void selectTechnology(Technology tech){ technology = tech; onTaskAssignmentChange (population); onTechnologyBarChange (technology, population); }
static void CreateInitialData() { //check if the database identified by a named connection string exists var existsByName = Database.Exists("Name=ProjectsContext"); //check if the database identified by a connection string exists var existsByConnectionString = Database.Exists(@"Data Source=.\SQLEXPRESS;Integrated Security=SSPI;Initial Catalog=Succinctly;MultipleActiveResultSets=true"); using (var ctx = new ProjectsContext()) { var created = ctx.Database.CreateIfNotExists(); if (ctx.Database.CompatibleWithModel(false) == true) { return; } new DropCreateDatabaseAlways <ProjectsContext>().InitializeDatabase(ctx); using (var tx = new TransactionScope()) { //venues var home = new Venue() { Name = "Home, Sweet Home", Location = DbGeography.FromText("POINT(40.2112 8.4292)") }; var somePlace = new Venue() { Name = "Some Place Else", Location = DbGeography.FromText("POINT(41 8)") }; /*ctx.Venues.Add(home); * ctx.Venues.Add(somePlace);*/ //customers var bigCustomer = new Customer() { Name = "Big Customer" }; bigCustomer.Contact.Email = "*****@*****.**"; bigCustomer.Contact.Phone = "00 1 555 111 333"; var smallCustomer = new Customer() { Name = "Small Customer" }; smallCustomer.Contact.Email = "*****@*****.**"; smallCustomer.Contact.Phone = "00 351 111 222 333"; ctx.Customers.Add(bigCustomer); ctx.Customers.Add(smallCustomer); var developer = new Resource() { Name = "Ricardo Peres" }; developer.Contact.Email = "*****@*****.**"; developer.Contact.Phone = "?"; var projectManager = new Resource() { Name = "Succinct Project Manager" }; projectManager.Contact.Email = "*****@*****.**"; var tester = new Resource() { Name = "Succinct Tester" }; tester.Contact.Email = "*****@*****.**"; ctx.Resources.Add(developer); ctx.Resources.Add(projectManager); ctx.Resources.Add(tester); //start technologies var aspNet = new Technology() { Name = "ASP.NET" }; var entityFramework = new Technology() { Name = "Entity Framework" }; var selenium = new Technology() { Name = "Selenium" }; aspNet.Resources.Add(developer); entityFramework.Resources.Add(developer); selenium.Resources.Add(tester); developer.Technologies.Add(aspNet); developer.Technologies.Add(entityFramework); tester.Technologies.Add(selenium); ctx.Technologies.Add(aspNet); ctx.Technologies.Add(entityFramework); ctx.Technologies.Add(selenium); //end technologies //start tools var developmentTool = new DevelopmentTool() { Name = "Visual Studio 2012", Language = "C#" }; var managementTool = new ManagementTool() { Name = "Project 2013", CompatibleWithProject = true }; var testingTool = new TestingTool() { Name = "Selenium", Automated = true }; ctx.Tools.Add(developmentTool); ctx.Tools.Add(managementTool); ctx.Tools.Add(testingTool); //end tools //start big project var bigProject = new Project() { Name = "Big Project", Start = DateTime.Today, Customer = bigCustomer }; var bigProjectDetail = new ProjectDetail() { Project = bigProject, Budget = 10000M, Critical = true }; bigProject.Detail = bigProjectDetail; ctx.SaveChanges(); var bigProjectDeveloperResource = new ProjectResource() { Project = bigProject, Resource = developer, Role = Role.Developer }; var bigProjectProjectManagerResource = new ProjectResource() { Project = bigProject, Resource = projectManager, Role = Role.ProjectManager }; var bigProjectTesterResource = new ProjectResource() { Project = bigProject, Resource = tester, Role = Role.Tester }; bigProject.ProjectResources.Add(bigProjectDeveloperResource); bigProject.ProjectResources.Add(bigProjectProjectManagerResource); bigProject.ProjectResources.Add(bigProjectTesterResource); developer.ProjectResources.Add(bigProjectDeveloperResource); projectManager.ProjectResources.Add(bigProjectProjectManagerResource); tester.ProjectResources.Add(bigProjectTesterResource); bigCustomer.Projects.Add(bigProject); //end big project //small project var smallProject = new Project() { Name = "Small Project", Start = DateTime.Today.AddDays(-7), End = DateTime.Today.AddDays(-1), Customer = smallCustomer }; var smallProjectDetail = new ProjectDetail() { Project = smallProject, Budget = 5000M, Critical = false }; var smallProjectDeveloperResource = new ProjectResource() { Project = smallProject, Resource = developer, Role = Role.Developer }; var smallProjectProjectManagerResource = new ProjectResource() { Project = smallProject, Resource = projectManager, Role = Role.ProjectManager }; var smallProjectTesterResource = new ProjectResource() { Project = smallProject, Resource = tester, Role = Role.Tester }; smallProject.Detail = smallProjectDetail; smallProject.ProjectResources.Add(smallProjectDeveloperResource); smallProject.ProjectResources.Add(smallProjectProjectManagerResource); smallProject.ProjectResources.Add(smallProjectTesterResource); developer.ProjectResources.Add(smallProjectDeveloperResource); projectManager.ProjectResources.Add(smallProjectProjectManagerResource); tester.ProjectResources.Add(smallProjectTesterResource); smallCustomer.Projects.Add(smallProject); //end small project ctx.SaveChanges(); tx.Complete(); } } }
public void CompletedResearch(Technology tech) { nodeImg.color = Color.green; TechTreeUI.Instance.UnlockAllTechButtons(); GameEvents.OnTechResearchCompleted -= CompletedResearch; }
public void Put(Technology item) { _techRepository.Technology_Update(item); }
public async Task<ActionResult> Receipt(int? IID) { List<CartItem> myItems = new List<CartItem>(); myItems = (List<CartItem>)Session["myItems"]; ProductViewModel model = new ProductViewModel(); myHandler = new BusinessLogicHandler(); model = (ProductViewModel)Session["deliverData"]; #region Get Cart Items List<Book> ifBooks = new List<Book>(); List<Technology> ifGadget = new List<Technology>(); foreach (var item in myItems) { if (myHandler.CheckProductType(item.ProductID)) { Book book = new Book(); book = myHandler.GetBook(item.ProductID); ifBooks.Add(book); } else { Technology gadget = new Technology(); gadget = myHandler.GetTechnologyDetails(item.ProductID); ifGadget.Add(gadget); } //try //{ // Book book = new Book(); // book = myHandler.GetBook(item.ProductID); // ifBooks.Add(book); //} //catch //{ // Technology gadget = new Technology(); // gadget = myHandler.GetTechnologyDetails(item.ProductID); // ifGadget.Add(gadget); //} } model.allTechnology = ifGadget; model.allBook = ifBooks; model.allCartItem = myItems; #endregion #region Push User Details string userName = User.Identity.GetUserName(); ApplicationDbContext dataSocket = new ApplicationDbContext(); UserStore<ApplicationUser> myStore = new UserStore<ApplicationUser>(dataSocket); userMgr = new ApplicationUserManager(myStore); var user = userMgr.FindByEmail(userName); model.UserDetails = new ProvideUser(); model.UserDetails.Address = user.Address; model.UserDetails.email = user.Email; model.UserDetails.PhoneNumber = user.PhoneNumber; CustomerContext customer = new CustomerContext(); Customer thisCust = new Customer(); thisCust = customer.Customers.FirstOrDefault(cust => cust.User_Id == user.Id); model.UserDetails.LName = thisCust.LastName; model.UserDetails.Name = thisCust.FirstName; #endregion #region Push Invoice nfo model.recieptData = new Invoice(); model.recieptData = myHandler.GetInvoice(IID.GetValueOrDefault()); #endregion #region Push Company nfo myHandler = new BusinessLogicHandler(); model.company = new Company(); model.company = myHandler.GetCompanyDetail(); #endregion #region Push Delivery nfo Delivery shipping = new Delivery(); myHandler = new BusinessLogicHandler(); shipping = myHandler.GetDeliveryDetails(model.recieptData.DeliveryServiceID); model.deliveryHelper.DeliveryServiceName = shipping.ServiceName; model.deliveryHelper.DeliveryServicePrice = shipping.Price; model.deliveryHelper.DeliveryServiceType = shipping.ServiceType; #endregion #region Calculate List<ProductViewModel.CartHelper> itemList = new List<ProductViewModel.CartHelper>(); ProductViewModel.CartHelper cartHelp; if (myItems != null) { if (ifBooks != null) { var revised = from rev in ifBooks join item in myItems on rev.ProductID equals item.ProductID where rev.ProductID == item.ProductID select new { rev.ProductID, rev.SellingPrice, item.Quantity, item.CartItemID }; foreach (var ite in revised) { cartHelp = new ProductViewModel.CartHelper(); cartHelp.ProductID = ite.ProductID; cartHelp.CartItemID = ite.CartItemID; cartHelp.TotalPerItem = (ite.SellingPrice * ite.Quantity); itemList.Add(cartHelp); } } } if (myItems != null) { if (ifGadget != null) { var revised = from rev in ifGadget join item in myItems on rev.ProductID equals item.ProductID where rev.ProductID == item.ProductID select new { rev.ProductID, rev.SellingPrice, item.Quantity, item.CartItemID }; foreach (var ite in revised) { cartHelp = new ProductViewModel.CartHelper(); cartHelp.ProductID = ite.ProductID; cartHelp.CartItemID = ite.CartItemID; cartHelp.TotalPerItem = (ite.SellingPrice * ite.Quantity); itemList.Add(cartHelp); } } } double cartTotal = Convert.ToDouble(Session["cartTotal"].ToString()); cartTotal = cartTotal / 100; myHandler = new BusinessLogicHandler(); List<Company> company = myHandler.GetCompanyDetails(); double vat = 0; cartTotal += Convert.ToDouble(model.deliveryHelper.DeliveryServicePrice); foreach (var item in company) { vat = item.VATPercentage; } vat = vat + 1; double subTotal = cartTotal / vat; double vatAmount = cartTotal - subTotal; ProductViewModel.CartConclude finishing = new ProductViewModel.CartConclude(); finishing.CartTotal = cartTotal; finishing.VatAddedTotal = vatAmount; finishing.SubTotal = subTotal; model.ItsA_wrap = new List<ProductViewModel.CartConclude>(); model.ItsA_wrap.Add(finishing); model.secureCart = itemList; #endregion #region Clear the cart foreach (var item in itemList) { myHandler = new BusinessLogicHandler(); myHandler.DeleteCartItem(item.CartItemID); } #endregion #region Clear SESSION Session["myItems"] = null; Session["cartTotal"] = (double) await GetCartTotal(user.Carts.CartID); #endregion #region Prep for exporting to PDF Session["pdf"] = model; #endregion return View(model); }
public ActionResult Restore(int ProductID, AddNewTechViewModel model, FormCollection collection) { try { myHandler = new BusinessLogicHandler(); gadget = new Technology(); gadget.ProductID = ProductID; myHandler.RestoreDevice(gadget); TempData["Alert Message"] = "Device Successfully Restored"; return RedirectToAction("DeletedIndex", "Technology"); } catch { return View(); } }
public async Task<ActionResult> Checkout() { #region Data to Display CartActions act = new CartActions(); WishlistActions wishAct = new WishlistActions(); ApplicationDbContext dataSocket = new ApplicationDbContext(); UserStore<ApplicationUser> myStore = new UserStore<ApplicationUser>(dataSocket); userMgr = new ApplicationUserManager(myStore); var thisUser = await userMgr.FindByNameAsync(User.Identity.Name); int Id = (int)thisUser.Carts.CartID; try { double nm = await GetCartTotal(Id); string[] xn = nm.ToString().Split('.'); Session["cartTotal"] = xn[0] + "," + xn[1]; } catch { Session["cartTotal"] = act.GetTotalAsync(Id); } Session["wishlistTotal"] = wishAct.GetWishlistTotal(thisUser.Wishlists.WishlistID); //List<CartItem> myItems = new List<CartItem>(); ProductViewModel myNewModel = new ProductViewModel(); IEnumerable<CartItem> myItems = act.GetCartItemsAsync(Id); if (myItems != null) { myHandler = new BusinessLogicHandler(); List<Book> ifBooks = new List<Book>(); List<Technology> ifGadget = new List<Technology>(); foreach (var item in myItems) { if (myHandler.CheckProductType(item.ProductID)) { Book book = new Book(); book = myHandler.GetBook(item.ProductID); ifBooks.Add(book); } else { Technology device = new Technology(); device = myHandler.GetTechnologyDetails(item.ProductID); ifGadget.Add(device); } } myNewModel.allBook = ifBooks; myNewModel.allCartItem = myItems.ToList(); myNewModel.allTechnology = ifGadget; List<ProductViewModel.CartHelper> itemList = new List<ProductViewModel.CartHelper>(); ProductViewModel.CartHelper cartHelp; if (myItems != null) { var revised = from rev in ifBooks join item in myItems on rev.ProductID equals item.ProductID where rev.ProductID == item.ProductID select new { rev.ProductID, rev.SellingPrice, item.Quantity }; foreach (var ite in revised) { cartHelp = new ProductViewModel.CartHelper(); cartHelp.ProductID = ite.ProductID; cartHelp.TotalPerItem = (ite.SellingPrice * ite.Quantity); itemList.Add(cartHelp); } } if (myItems != null) { if (ifGadget != null) { var revised = from rev in ifGadget join item in myItems on rev.ProductID equals item.ProductID where rev.ProductID == item.ProductID select new { rev.ProductID, rev.SellingPrice, item.Quantity }; foreach (var ite in revised) { cartHelp = new ProductViewModel.CartHelper(); cartHelp.ProductID = ite.ProductID; cartHelp.TotalPerItem = (ite.SellingPrice * ite.Quantity); itemList.Add(cartHelp); } } } double cartTotal = Convert.ToDouble(Session["cartTotal"].ToString()); cartTotal = cartTotal / 100; List<Company> company = myHandler.GetCompanyDetails(); double vat = 0; foreach (var item in company) { vat = item.VATPercentage; } vat = vat + 1; double subTotal = cartTotal / vat; double vatAmount = cartTotal - subTotal; ProductViewModel.CartConclude finishing = new ProductViewModel.CartConclude(); finishing.CartTotal = cartTotal; finishing.VatAddedTotal = vatAmount; finishing.SubTotal = subTotal; myNewModel.ItsA_wrap = new List<ProductViewModel.CartConclude>(); myNewModel.ItsA_wrap.Add(finishing); myNewModel.secureCart = itemList; } else { return RedirectToAction("Edit"); } #endregion #region Drop down data DeliveryHandler deliver = new DeliveryHandler(); IEnumerable<Delivery> delivery = (IEnumerable<Delivery>)deliver.GetDeliveryList(); var dataStore = from name in delivery select new { Value = name.DeliveryServiceID, Text = name.ServiceName }; ViewBag.DeliveryList = new SelectList(dataStore.ToList()); List<SelectListItem> deliveryI = new List<SelectListItem>(); deliveryI.Add(new SelectListItem { Text = "Delivery Service", Value = "", Selected = true }); foreach (var item in delivery) { deliveryI.Add(new SelectListItem { Text = item.ServiceName, Value = item.DeliveryServiceID.ToString() }); } myNewModel.I_DeliveryList = new List<SelectListItem>(); myNewModel.I_DeliveryList = deliveryI; ViewData["I_Delivery"] = deliveryI; #endregion #region Default Address if (thisUser.Address != null) { myNewModel.deliveryHelper = new DeliveryHelper(); myNewModel.deliveryHelper.DeliveryAddress = thisUser.Address; } #endregion return View(myNewModel); }
#pragma warning disable 1998 public async override global::System.Threading.Tasks.Task ExecuteAsync() { #line 1 "/Users/davidbui/Desktop/resume_site/Views/Admin/EditTechnology.cshtml" ViewData["Title"] = "Edit Technology".ToUpper(); User user = ViewBag.user; Technology tech = ViewBag.tech; #line default #line hidden BeginContext(117, 182, true); WriteLiteral("\n<section class=\"section-edit-tech mt-5\">\n <div class=\"container border shadow mb-5\">\n <div class=\"row\">\n <div class=\"col-lg-3 col-md-3 col-sm-12 p-2 border-right\">\n "); EndContext(); BeginContext(299, 39, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("partial", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "5c860a74ce9cf35f1fb12a6d2e598e5cff652ba910329", async() => { } ); __Microsoft_AspNetCore_Mvc_TagHelpers_PartialTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.PartialTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_PartialTagHelper); __Microsoft_AspNetCore_Mvc_TagHelpers_PartialTagHelper.Name = (string)__tagHelperAttribute_0.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_0); #line 11 "/Users/davidbui/Desktop/resume_site/Views/Admin/EditTechnology.cshtml" __Microsoft_AspNetCore_Mvc_TagHelpers_PartialTagHelper.Model = user; #line default #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("model", __Microsoft_AspNetCore_Mvc_TagHelpers_PartialTagHelper.Model, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(338, 74, true); WriteLiteral("\n </div>\n <div class=\"col-lg-9 col-md-9 col-sm-12 p-3\">\n "); EndContext(); BeginContext(412, 92, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "5c860a74ce9cf35f1fb12a6d2e598e5cff652ba912037", async() => { BeginContext(496, 4, true); WriteLiteral("Back"); EndContext(); } ); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_1); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Controller = (string)__tagHelperAttribute_2.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_2); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Action = (string)__tagHelperAttribute_3.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_3); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(504, 35, true); WriteLiteral("\n <h1 class=\"text-primary\" >"); EndContext(); BeginContext(540, 17, false); #line 15 "/Users/davidbui/Desktop/resume_site/Views/Admin/EditTechnology.cshtml" Write(ViewData["Title"]); #line default #line hidden EndContext(); BeginContext(557, 3, true); WriteLiteral(" - "); EndContext(); BeginContext(561, 17, false); #line 15 "/Users/davidbui/Desktop/resume_site/Views/Admin/EditTechnology.cshtml" Write(tech.TechnologyId); #line default #line hidden EndContext(); BeginContext(578, 41, true); WriteLiteral("</h1>\n <hr class=\"my-4 bg-white\">\n"); EndContext(); BeginContext(648, 8, true); WriteLiteral(" "); EndContext(); BeginContext(656, 1131, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("form", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "5c860a74ce9cf35f1fb12a6d2e598e5cff652ba914536", async() => { BeginContext(840, 9, true); WriteLiteral("\n "); EndContext(); BeginContext(849, 69, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("span", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "5c860a74ce9cf35f1fb12a6d2e598e5cff652ba914919", async() => { } ); __Microsoft_AspNetCore_Mvc_TagHelpers_ValidationMessageTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.ValidationMessageTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_ValidationMessageTagHelper); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_4); #line 19 "/Users/davidbui/Desktop/resume_site/Views/Admin/EditTechnology.cshtml" __Microsoft_AspNetCore_Mvc_TagHelpers_ValidationMessageTagHelper.For = ModelExpressionProvider.CreateModelExpression(ViewData, __model => __model.TechnologyName); #line default #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("asp-validation-for", __Microsoft_AspNetCore_Mvc_TagHelpers_ValidationMessageTagHelper.For, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(918, 48, true); WriteLiteral("\n <div class=\"form-group\">\n "); EndContext(); BeginContext(966, 55, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("label", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "5c860a74ce9cf35f1fb12a6d2e598e5cff652ba916707", async() => { BeginContext(998, 15, true); WriteLiteral("Technology Name"); EndContext(); } ); __Microsoft_AspNetCore_Mvc_TagHelpers_LabelTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.LabelTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_LabelTagHelper); #line 21 "/Users/davidbui/Desktop/resume_site/Views/Admin/EditTechnology.cshtml" __Microsoft_AspNetCore_Mvc_TagHelpers_LabelTagHelper.For = ModelExpressionProvider.CreateModelExpression(ViewData, __model => __model.TechnologyName); #line default #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("asp-for", __Microsoft_AspNetCore_Mvc_TagHelpers_LabelTagHelper.For, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(1021, 13, true); WriteLiteral("\n "); EndContext(); BeginContext(1034, 172, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagOnly, "5c860a74ce9cf35f1fb12a6d2e598e5cff652ba918440", async() => { } ); __Microsoft_AspNetCore_Mvc_TagHelpers_InputTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.InputTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_InputTagHelper); #line 22 "/Users/davidbui/Desktop/resume_site/Views/Admin/EditTechnology.cshtml" __Microsoft_AspNetCore_Mvc_TagHelpers_InputTagHelper.For = ModelExpressionProvider.CreateModelExpression(ViewData, __model => __model.TechnologyName); #line default #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("asp-for", __Microsoft_AspNetCore_Mvc_TagHelpers_InputTagHelper.For, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __Microsoft_AspNetCore_Mvc_TagHelpers_InputTagHelper.InputTypeName = (string)__tagHelperAttribute_5.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_5); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_6); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_7); __Microsoft_AspNetCore_Mvc_TagHelpers_InputTagHelper.Name = (string)__tagHelperAttribute_8.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_8); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_9); BeginWriteTagHelperAttribute(); #line 22 "/Users/davidbui/Desktop/resume_site/Views/Admin/EditTechnology.cshtml" WriteLiteral(tech.TechnologyName); #line default #line hidden __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); __Microsoft_AspNetCore_Mvc_TagHelpers_InputTagHelper.Value = __tagHelperStringValueBuffer; __tagHelperExecutionContext.AddTagHelperAttribute("value", __Microsoft_AspNetCore_Mvc_TagHelpers_InputTagHelper.Value, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(1206, 28, true); WriteLiteral("\n </div>\n "); EndContext(); BeginContext(1234, 70, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("span", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "5c860a74ce9cf35f1fb12a6d2e598e5cff652ba921470", async() => { } ); __Microsoft_AspNetCore_Mvc_TagHelpers_ValidationMessageTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.ValidationMessageTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_ValidationMessageTagHelper); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_4); #line 24 "/Users/davidbui/Desktop/resume_site/Views/Admin/EditTechnology.cshtml" __Microsoft_AspNetCore_Mvc_TagHelpers_ValidationMessageTagHelper.For = ModelExpressionProvider.CreateModelExpression(ViewData, __model => __model.TechnologyImage); #line default #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("asp-validation-for", __Microsoft_AspNetCore_Mvc_TagHelpers_ValidationMessageTagHelper.For, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(1304, 48, true); WriteLiteral("\n <div class=\"form-group\">\n "); EndContext(); BeginContext(1352, 57, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("label", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "5c860a74ce9cf35f1fb12a6d2e598e5cff652ba923261", async() => { BeginContext(1385, 16, true); WriteLiteral("Technology Image"); EndContext(); } ); __Microsoft_AspNetCore_Mvc_TagHelpers_LabelTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.LabelTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_LabelTagHelper); #line 26 "/Users/davidbui/Desktop/resume_site/Views/Admin/EditTechnology.cshtml" __Microsoft_AspNetCore_Mvc_TagHelpers_LabelTagHelper.For = ModelExpressionProvider.CreateModelExpression(ViewData, __model => __model.TechnologyImage); #line default #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("asp-for", __Microsoft_AspNetCore_Mvc_TagHelpers_LabelTagHelper.For, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(1409, 13, true); WriteLiteral("\n "); EndContext(); BeginContext(1422, 140, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagOnly, "5c860a74ce9cf35f1fb12a6d2e598e5cff652ba924997", async() => { } ); __Microsoft_AspNetCore_Mvc_TagHelpers_InputTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.InputTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_InputTagHelper); #line 27 "/Users/davidbui/Desktop/resume_site/Views/Admin/EditTechnology.cshtml" __Microsoft_AspNetCore_Mvc_TagHelpers_InputTagHelper.For = ModelExpressionProvider.CreateModelExpression(ViewData, __model => __model.TechnologyImage); #line default #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("asp-for", __Microsoft_AspNetCore_Mvc_TagHelpers_InputTagHelper.For, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __Microsoft_AspNetCore_Mvc_TagHelpers_InputTagHelper.InputTypeName = (string)__tagHelperAttribute_10.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_10); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_6); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_11); __Microsoft_AspNetCore_Mvc_TagHelpers_InputTagHelper.Name = (string)__tagHelperAttribute_12.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_12); BeginWriteTagHelperAttribute(); #line 27 "/Users/davidbui/Desktop/resume_site/Views/Admin/EditTechnology.cshtml" WriteLiteral(tech.TechnologyImage); #line default #line hidden __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); __Microsoft_AspNetCore_Mvc_TagHelpers_InputTagHelper.Value = __tagHelperStringValueBuffer; __tagHelperExecutionContext.AddTagHelperAttribute("value", __Microsoft_AspNetCore_Mvc_TagHelpers_InputTagHelper.Value, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(1562, 28, true); WriteLiteral("\n </div>\n "); EndContext(); BeginContext(1590, 109, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "5c860a74ce9cf35f1fb12a6d2e598e5cff652ba927916", async() => { BeginContext(1689, 6, true); WriteLiteral("Cancel"); EndContext(); } ); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Controller = (string)__tagHelperAttribute_2.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_2); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Action = (string)__tagHelperAttribute_3.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_3); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_13); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(1699, 81, true); WriteLiteral("\n <button type=\"submit\" class=\"btn btn-primary\">Update</button>\n "); EndContext(); } ); __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.FormTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper); __Microsoft_AspNetCore_Mvc_TagHelpers_RenderAtEndOfFormTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.RenderAtEndOfFormTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_RenderAtEndOfFormTagHelper); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_14); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_15); __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper.Controller = (string)__tagHelperAttribute_2.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_2); __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper.Action = (string)__tagHelperAttribute_16.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_16); if (__Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper.RouteValues == null) { throw new InvalidOperationException(InvalidTagHelperIndexerAssignment("asp-route-id", "Microsoft.AspNetCore.Mvc.TagHelpers.FormTagHelper", "RouteValues")); } BeginWriteTagHelperAttribute(); #line 18 "/Users/davidbui/Desktop/resume_site/Views/Admin/EditTechnology.cshtml" WriteLiteral(tech.TechnologyId); #line default #line hidden __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper.RouteValues["id"] = __tagHelperStringValueBuffer; __tagHelperExecutionContext.AddTagHelperAttribute("asp-route-id", __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper.RouteValues["id"], global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper.Method = (string)__tagHelperAttribute_17.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_17); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(1787, 44, true); WriteLiteral("\n </div>\n </div>\n </div>\n</section>"); EndContext(); }
private static bool RemoveTechRequirementFromUpgrade(UpgradeAction action, Technology dependentTech, Technology requiredTech) { for (int i = 0; i < action.upgradeDetails.Length; i++) { if (action.upgradeDetails[i].tech == dependentTech) { var details = action.upgradeDetails[i]; if (!details.requiredTech.Contains(requiredTech)) { return(false); } Undo.RecordObject(action, "Remove tech requirement"); details.requiredTech.Remove(requiredTech); action.upgradeDetails[i] = details; EditorUtility.SetDirty(action); return(true); } } return(false); }
public async Task <ActionResult <Technology> > PostTechnology(Technology technology) { await repository.CreateAsync(technology); return(CreatedAtAction("GetTechnology", new { id = technology.Id }, technology)); }
public ViewResult GetTechnologyDetails(int TechID) { Technology TechnologyData = _techRepository.GetAllTechnologies().FirstOrDefault(t => t.TechID == TechID); return(View(TechnologyData)); }
public void GetProfileInformation(Technology.Direct.Dao.ProfileDAO dao) { }
//GET: Technologies/Edit/5 public ActionResult Edit(int id) { Technology technology = technologyRepo.GetTechnologyByID(id); return(PartialView("PartialTechnologies/_editTechnology", technology)); }
private static void SetupShopifyTechnology(out ITechnology technology, out SitesLoader sitesLoader) { FileStream patternsFile = new FileStream(AppDomain.CurrentDomain.BaseDirectory + @"\\ShopifyStringPatterns.txt", FileMode.Open); technology = new Technology("Shopify", patternsFile); FileStream sitesFile = new FileStream(AppDomain.CurrentDomain.BaseDirectory + @"\\ShopifySitesURLs.txt", FileMode.Open); sitesLoader = new SitesLoader(sitesFile); }
public static void registerTechChanges(Technology tech, Nation player) { string techName = tech.GetTechName(); MilitaryForm militaryForm = player.GetMilitaryForm(); if (techName == "flintlock") { militaryForm.infantry.ImproveAttackStrength(0.25f); militaryForm.infantry.ImproveDefenseStrength(0.1f); militaryForm.cavalry.ImproveAttackStrength(0.25f); militaryForm.cavalry.ImproveDefenseStrength(0.1f); } if (techName == "square_timbering") { player.IncreaseMaxWareHouseCapacity(8); } if (techName == "cement") { player.IncreaseMaxFort(); player.IncreaseMaxWareHouseCapacity(8); } if (techName == "breech_loaded_arms") { militaryForm.infantry.ImproveAttackStrength(0.35f); militaryForm.infantry.ImproveDefenseStrength(0.2f); militaryForm.cavalry.ImproveAttackStrength(0.35f); militaryForm.cavalry.ImproveDefenseStrength(0.1f); militaryForm.artillery.ImproveAttackStrength(0.35f); militaryForm.artillery.ImproveDefenseStrength(0.2f); militaryForm.artillery.IncreaseShock(0.1f); militaryForm.artillery.IncreaseAmmoConsumption(0.05f); militaryForm.frigate.ImproveAttack(0.3f); } if (techName == "machine_guns") { militaryForm.infantry.ImproveAttackStrength(0.1f); militaryForm.infantry.ImproveAttackStrength(1.0f); militaryForm.cavalry.ImproveDefenseStrength(0.2f); militaryForm.ironclad.ImproveAttack(0.15f); militaryForm.infantry.IncreaseAmmoConsumption(0.075f); } if (techName == "indirect_fire") { militaryForm.artillery.ImproveAttackStrength(0.3f); militaryForm.artillery.ImproveDefenseStrength(0.6f); militaryForm.artillery.IncreaseShock(0.2f); militaryForm.ironclad.ImproveAttack(0.2f); militaryForm.artillery.IncreaseAmmoConsumption(0.1f); militaryForm.ironclad.IncreaseAmmoConsumption(0.1f); } if (techName == "advanced_iron_working") { player.IncreaseMaxWareHouseCapacity(8); } if (techName == "steel_armor") { militaryForm.ironclad.HitPoints = 3; } if (techName == "oil_powered_ships") { player.IncreaseMaxWareHouseCapacity(8); } if (techName == "bombers") { militaryForm.fighter.ImproveAttackStrength(0.25f); militaryForm.fighter.IncreaseShock(0.3f); militaryForm.fighter.ImproveDefenseStrength(0.1f); militaryForm.fighter.IncreaseAmmoConsumption(0.15f); } if (techName == "radar") { militaryForm.fighter.ImproveDefenseStrength(0.8f); militaryForm.dreadnought.ImproveAttack(0.5f); } if (techName == "bolt_action_rifles") { militaryForm.infantry.ImproveAttackStrength(0.5f); militaryForm.infantry.ImproveDefenseStrength(0.15f); militaryForm.cavalry.ImproveAttackStrength(0.25f); militaryForm.infantry.IncreaseShock(0.1f); militaryForm.cavalry.IncreaseShock(0.15f); } if (techName == "telegraph") { player.IncreaseFactoryThroughput(1); player.InceaseProductionModifier(0.15f); player.IncreaseOrgFactor(0.15f); } if (techName == "electricity") { player.IncreaseFactoryThroughput(1); player.InceaseProductionModifier(0.15f); } if (techName == "radio") { player.IncreaseOrgFactor(0.15f); } if (techName == "early_computers") { player.InceaseProductionModifier(0.15f); militaryForm.dreadnought.ImproveAttack(1); } if (techName == "atomic_bomb") { } }
public void StartTec(Technology tec) { tec.technologyControl.OnStart(); StartCoroutine(TecProgress(tec)); }
// END SKILL CRUD METHODS // ###### // BEGIN ASSIGNREQUEST CRUD METHODS public async Task AssignSkillAsync(AssignRequest assignRequest) { switch (assignRequest.SkillType) { case Project.LanguageSkill: var language = await context.Languages.FirstOrDefaultAsync(l => l.Name == assignRequest.Name); if (language == null) { language = new Language { Name = assignRequest.Name }; language.Slug = language.Name; context.Languages.Add(language); await context.SaveChangesAsync(); } var pl = new ProjectLanguage { ProjectId = assignRequest.ProjectId, LanguageId = language.Id }; context.ProjectLanguages.Add(pl); await context.SaveChangesAsync(); break; case Project.PlatformSkill: var platform = await context.Platforms.FirstOrDefaultAsync(l => l.Name == assignRequest.Name); if (platform == null) { platform = new Platform { Name = assignRequest.Name }; platform.Slug = platform.Name; context.Platforms.Add(platform); await context.SaveChangesAsync(); } var pp = new ProjectPlatform { ProjectId = assignRequest.ProjectId, PlatformId = platform.Id }; context.ProjectPlatforms.Add(pp); await context.SaveChangesAsync(); break; case Project.TechnologySkill: var technology = await context.Technologies.FirstOrDefaultAsync(l => l.Name == assignRequest.Name); if (technology == null) { technology = new Technology { Name = assignRequest.Name }; technology.Slug = technology.Name; context.Technologies.Add(technology); await context.SaveChangesAsync(); } var pt = new ProjectTechnology { ProjectId = assignRequest.ProjectId, TechnologyId = technology.Id }; context.ProjectTechnologies.Add(pt); await context.SaveChangesAsync(); break; default: break; } }
public async Task CreateAsync(Technology technology) { _context.Technologies.Add(technology); await _context.SaveChangesAsync(); }
public static void SeedApp(IDbConnectionFactory dbFactory) { using (var db = dbFactory.OpenDbConnection()) { var ssTech = new Technology { Name = "ServiceStack", Slug = "ServiceStack".GenerateSlug(), Tier = TechnologyTier.Server, Description = "Obscenely fast! Built with only fast, clean, code-first and light-weight parts. Start using .NET's fastest serializers, ORMs, redis and caching libraries!", VendorName = "ServiceStack", LogoUrl = "https://github.com/ServiceStack/Assets/raw/master/img/artwork/fulllogo-280.png" }; var iisTech = new Technology { Name = "IIS", Slug = "IIS".GenerateSlug(), Tier = TechnologyTier.Http, Description = "Microsoft's web host", VendorName = "Microsoft", LogoUrl = "http://www.microsoft.com/web/media/gallery/apps-screenshots/Microsoft-App-Request-Routing.png" }; var ravenDbTech = new Technology { Name = "RavenDB", Slug = "RavenDB".GenerateSlug(), Tier = TechnologyTier.Data, Description = "Open source 2nd generation document DB", VendorName = "RavenDB", LogoUrl = "http://static.ravendb.net/logo-for-nuget.png" }; var postgresTech = new Technology { Name = "PostgreSQL", Slug = "PostgreSQL".GenerateSlug(), Tier = TechnologyTier.Data, Description = "The world's most advanced open source database.", VendorName = "PostgreSQL", LogoUrl = "http://www.myintervals.com/blog/wp-content/uploads/2011/12/postgresql-logo1.png" }; db.Insert(ssTech); db.Insert(iisTech); db.Insert(ravenDbTech); db.Insert(postgresTech); var initialStack = new TechnologyStack { Name = "Initial Stack", Slug = "Initial Stack".GenerateSlug(), Description = "Example stack" }; db.Insert(initialStack); var initialStackId = db.LastInsertId(); db.Insert(new TechnologyChoice { TechnologyId = ssTech.Id, TechnologyStackId = initialStackId }); db.Insert(new TechnologyChoice { TechnologyId = postgresTech.Id, TechnologyStackId = initialStackId }); db.Insert(new TechnologyChoice { TechnologyId = ravenDbTech.Id, TechnologyStackId = initialStackId }); db.Insert(new TechnologyChoice { TechnologyId = iisTech.Id, TechnologyStackId = initialStackId }); } }
public ActionResult Restore(int ProductID) { { AddNewTechViewModel model = new AddNewTechViewModel(); model.techs = new Technology(); myHandler = new BusinessLogicHandler(); gadget = myHandler.GetTechnologyDetails(ProductID); model.techs = gadget; return View(model); } }
public async Task<ActionResult> Edit() { CartActions act = new CartActions(); WishlistActions wishAct = new WishlistActions(); ApplicationDbContext dataSocket = new ApplicationDbContext(); UserStore<ApplicationUser> myStore = new UserStore<ApplicationUser>(dataSocket); userMgr = new ApplicationUserManager(myStore); var thisUser = await userMgr.FindByNameAsync(User.Identity.Name); int Id = (int)thisUser.Carts.CartID; try { double nm = await GetCartTotal(Id); string[] xn = nm.ToString().Split('.'); Session["cartTotal"] = xn[0] + "," + xn[1]; } catch { Session["cartTotal"] = act.GetTotalAsync(Id); } Session["wishlistTotal"] = wishAct.GetWishlistTotal(thisUser.Wishlists.WishlistID); List<CartItem> myItems = new List<CartItem>(); try { myItems = act.GetCartItemsAsync(Id).ToList();} catch(ArgumentNullException) { myItems = null; } myHandler = new BusinessLogicHandler(); List<Book> ifBooks = new List<Book>(); ProductViewModel myNewModel = new ProductViewModel(); List<Technology> ifGadget = new List<Technology>(); if (myItems != null) { foreach (var item in myItems) { if (myHandler.CheckProductType(item.ProductID)) { Book book = new Book(); book = myHandler.GetBook(item.ProductID); ifBooks.Add(book); } else { Technology device = new Technology(); device = myHandler.GetTechnologyDetails(item.ProductID); ifGadget.Add(device); } } myNewModel.allCartItem = new List<CartItem>(); myNewModel.allBook = new List<Book>(); myNewModel.allTechnology = new List<Technology>(); List<ProductViewModel.CartHelper> itemList = new List<ProductViewModel.CartHelper>(); ProductViewModel.CartHelper cartHelp; if (myItems != null) { if (ifBooks != null) { var revised = from rev in ifBooks join item in myItems on rev.ProductID equals item.ProductID where rev.ProductID == item.ProductID select new { rev.ProductID, rev.SellingPrice, item.Quantity }; foreach (var ite in revised) { cartHelp = new ProductViewModel.CartHelper(); cartHelp.ProductID = ite.ProductID; cartHelp.TotalPerItem = (ite.SellingPrice * ite.Quantity); itemList.Add(cartHelp); } } } if (myItems != null) { if (ifGadget != null) { var revised = from rev in ifGadget join item in myItems on rev.ProductID equals item.ProductID where rev.ProductID == item.ProductID select new { rev.ProductID, rev.SellingPrice, item.Quantity }; foreach (var ite in revised) { cartHelp = new ProductViewModel.CartHelper(); cartHelp.ProductID = ite.ProductID; cartHelp.TotalPerItem = (ite.SellingPrice * ite.Quantity); itemList.Add(cartHelp); } } } double cartTotal = Convert.ToDouble(Session["cartTotal"].ToString()); cartTotal = cartTotal / 100; List<Company> company = myHandler.GetCompanyDetails(); double vat = 0; foreach (var item in company) { vat = item.VATPercentage; } vat = vat + 1; double subTotal = cartTotal / vat; double vatAmount = cartTotal - subTotal; ProductViewModel.CartConclude finishing = new ProductViewModel.CartConclude(); finishing.CartTotal = cartTotal; finishing.VatAddedTotal = vatAmount; finishing.SubTotal = subTotal; myNewModel.allBook = ifBooks; myNewModel.allCartItem = myItems; myNewModel.allTechnology = ifGadget; myNewModel.ItsA_wrap = new List<ProductViewModel.CartConclude>(); myNewModel.ItsA_wrap.Add(finishing); myNewModel.secureCart = itemList; return View(myNewModel); } else { myNewModel.ItsA_wrap = new List<ProductViewModel.CartConclude>(); return View(myNewModel); } }
public void TestCreateLineItems() { // Create inventory targeting. InventoryTargeting inventoryTargeting = new InventoryTargeting(); inventoryTargeting.targetedPlacementIds = new long[] {placementId}; // Create geographical targeting. GeoTargeting geoTargeting = new GeoTargeting(); // Include the US and Quebec, Canada. Location countryLocation = new Location(); countryLocation.id = 2840L; Location regionLocation = new Location(); regionLocation.id = 20123L; geoTargeting.targetedLocations = new Location[] {countryLocation, regionLocation}; // Exclude Chicago and the New York metro area. Location cityLocation = new Location(); cityLocation.id = 1016367L; Location metroLocation = new Location(); metroLocation.id = 200501L; geoTargeting.excludedLocations = new Location[] {cityLocation, metroLocation}; // Exclude domains that are not under the network's control. UserDomainTargeting userDomainTargeting = new UserDomainTargeting(); userDomainTargeting.domains = new String[] {"usa.gov"}; userDomainTargeting.targeted = false; // Create day-part targeting. DayPartTargeting dayPartTargeting = new DayPartTargeting(); dayPartTargeting.timeZone = DeliveryTimeZone.BROWSER; // Target only the weekend in the browser's timezone. DayPart saturdayDayPart = new DayPart(); saturdayDayPart.dayOfWeek = Google.Api.Ads.Dfp.v201508.DayOfWeek.SATURDAY; saturdayDayPart.startTime = new TimeOfDay(); saturdayDayPart.startTime.hour = 0; saturdayDayPart.startTime.minute = MinuteOfHour.ZERO; saturdayDayPart.endTime = new TimeOfDay(); saturdayDayPart.endTime.hour = 24; saturdayDayPart.endTime.minute = MinuteOfHour.ZERO; DayPart sundayDayPart = new DayPart(); sundayDayPart.dayOfWeek = Google.Api.Ads.Dfp.v201508.DayOfWeek.SUNDAY; sundayDayPart.startTime = new TimeOfDay(); sundayDayPart.startTime.hour = 0; sundayDayPart.startTime.minute = MinuteOfHour.ZERO; sundayDayPart.endTime = new TimeOfDay(); sundayDayPart.endTime.hour = 24; sundayDayPart.endTime.minute = MinuteOfHour.ZERO; dayPartTargeting.dayParts = new DayPart[] {saturdayDayPart, sundayDayPart}; // Create technology targeting. TechnologyTargeting technologyTargeting = new TechnologyTargeting(); // Create browser targeting. BrowserTargeting browserTargeting = new BrowserTargeting(); browserTargeting.isTargeted = true; // Target just the Chrome browser. Technology browserTechnology = new Technology(); browserTechnology.id = 500072L; browserTargeting.browsers = new Technology[] {browserTechnology}; technologyTargeting.browserTargeting = browserTargeting; // Create an array to store local line item objects. LineItem[] lineItems = new LineItem[2]; for (int i = 0; i < lineItems.Length; i++) { LineItem lineItem = new LineItem(); lineItem.name = "Line item #" + new TestUtils().GetTimeStamp(); lineItem.orderId = orderId; lineItem.targeting = new Targeting(); lineItem.targeting.inventoryTargeting = inventoryTargeting; lineItem.targeting.geoTargeting = geoTargeting; lineItem.targeting.userDomainTargeting = userDomainTargeting; lineItem.targeting.dayPartTargeting = dayPartTargeting; lineItem.targeting.technologyTargeting = technologyTargeting; lineItem.lineItemType = LineItemType.STANDARD; lineItem.allowOverbook = true; // Set the creative rotation type to even. lineItem.creativeRotationType = CreativeRotationType.EVEN; // Set the size of creatives that can be associated with this line item. Size size = new Size(); size.width = 300; size.height = 250; size.isAspectRatio = false; // Create the creative placeholder. CreativePlaceholder creativePlaceholder = new CreativePlaceholder(); creativePlaceholder.size = size; lineItem.creativePlaceholders = new CreativePlaceholder[] {creativePlaceholder}; // Set the line item to run for one month. lineItem.startDateTimeType = StartDateTimeType.IMMEDIATELY; lineItem.endDateTime = DateTimeUtilities.FromDateTime(System.DateTime.Today.AddMonths(1), "America/New_York"); // Set the cost per unit to $2. lineItem.costType = CostType.CPM; lineItem.costPerUnit = new Money(); lineItem.costPerUnit.currencyCode = "USD"; lineItem.costPerUnit.microAmount = 2000000L; // Set the number of units bought to 500,000 so that the budget is // $1,000. Goal goal = new Goal(); goal.units = 500000L; goal.unitType = UnitType.IMPRESSIONS; lineItem.primaryGoal = goal; lineItems[i] = lineItem; } LineItem[] localLineItems = null; Assert.DoesNotThrow(delegate() { localLineItems = lineItemService.createLineItems(lineItems); }); Assert.NotNull(localLineItems); Assert.AreEqual(localLineItems.Length, 2); Assert.AreEqual(localLineItems[0].name, lineItems[0].name); Assert.AreEqual(localLineItems[0].orderId, lineItems[0].orderId); Assert.AreEqual(localLineItems[1].name, lineItems[1].name); Assert.AreEqual(localLineItems[1].orderId, lineItems[1].orderId); }
private void btnEmul_Click(object sender, EventArgs e) { //try { EmulForm ef = new EmulForm(lTech); if (ef.ShowDialog() != DialogResult.OK) { return; } Technology tEmul = (Technology)ef.cbTEmul.SelectedItem, tReg = (Technology)ef.cbTReg.SelectedItem; string[] arr = ef.tbI.Text.Split(' '); int[] arrIStage = new int[arr.Length]; for (int i = 0; i < arr.Length; i++) { arrIStage[i] = int.Parse(arr[i]); } double mult = double.Parse(ef.tbMult.Text); double du = double.Parse(ef.tbDU.Text), df = double.Parse(ef.tbDF.Text); double uInit = double.Parse(ef.tbUInit.Text), duInit = double.Parse(ef.tbDUInit.Text); double sInit = double.Parse(ef.tbSInit.Text), dsInit = double.Parse(ef.tbDSInit.Text); int iter = int.Parse(ef.tbIter.Text); double R = double.Parse(ef.tbR.Text), C = double.Parse(ef.tbC.Text); Variable[] arrU, arrY; string uRep; Program.Unite(tReg.lStage.ToArray(), out arrU, out arrY, out uRep); double[] arrUMin = new double[arrU.Length], arrUMax = new double[arrU.Length], arrUSMin = new double[arrU.Length], arrYMin = new double[arrY.Length], arrYMax = new double[arrY.Length], arrAlpha = new double[arrY.Length], arrYOpt = new double[arrY.Length]; for (int i = 0; i < ef.dgvU.Rows.Count; i++) { arrUMin[i] = double.Parse(ef.dgvU[1, i].Value.ToString()); arrUMax[i] = double.Parse(ef.dgvU[2, i].Value.ToString()); arrUSMin[i] = double.Parse(ef.dgvU[3, i].Value.ToString()); } for (int i = 0; i < ef.dgvY.Rows.Count; i++) { arrYMin[i] = double.Parse(ef.dgvY[1, i].Value.ToString()); arrYMax[i] = double.Parse(ef.dgvY[2, i].Value.ToString()); arrAlpha[i] = double.Parse(ef.dgvY[3, i].Value.ToString()); arrYOpt[i] = double.Parse(ef.dgvY[4, i].Value.ToString()); } double[][] arrC; string[,] matrF; string repMod; Program.Model(arrU, arrY, out arrC, out matrF, out repMod); string rep; Variable[] arrUEmul, arrYEmul; Program.Emulate(tReg.lStage.ToArray(), tEmul.lStage.ToArray(), arrIStage, arrUMin, arrUMax, arrUSMin, arrYMin, arrYMax, arrAlpha, arrYOpt, mult, du, df, uInit, duInit, sInit, dsInit, iter, R, C, out arrUEmul, out arrYEmul, out arrU, out arrY, out rep); wb.DocumentText = rep; List <Variable> lVEmul = new List <Variable>(arrUEmul), lV = new List <Variable>(arrU); lVEmul.AddRange(arrYEmul); lV.AddRange(arrY); DiagForm form = new DiagForm(lVEmul.ToArray(), lV.ToArray()); form.Show(); } //catch { //MessageBox.Show("Ошибка эмуляции"); } }
public IActionResult Post([FromBody] Technology item) { _techRepository.Technology_Add(item); return(Ok("Record Added..")); }
public Requirement(int id) { this.tech = TechnologyDatabase.findTechnology(id); this.done = false; }
public static string GetSearchTerms(Technology technology) { switch(technology) { case Technology.Abap: return "Abab"; case Technology.AngularJS: return "Angular"; case Technology.Assembler: return "Assembler"; case Technology.BackboneJS: return "Backbone"; case Technology.Bootstrap: return "Bootstrap"; case Technology.Cobol: return "Cobol"; case Technology.CPlusPlus: return "C++"; case Technology.CSharp: return "C#"; case Technology.Css: return "CSS"; case Technology.Fortran: return "Fortran"; case Technology.Html: return "HTML"; case Technology.Java: return "Java"; case Technology.JavaScript: return "JavaScript"; case Technology.Json: return "JSON"; case Technology.Matlab: return "Matlab"; case Technology.ObjectiveC: return "Objective-C"; case Technology.Pascal: return "Pascal"; case Technology.Perl: return "Perl"; case Technology.Php: return "PHP"; case Technology.PowerShell: return "PowerShell"; case Technology.Python: return "Python"; case Technology.Ruby: return "Ruby"; case Technology.Scala: return "Scala"; case Technology.SharePoint: return "SharePoint"; case Technology.Sitecore: return "Sitecore"; case Technology.Sql: return "SQL"; //case Technology.VisualBasic: // return "Visual Basic"; case Technology.Xml: return "XML"; default: return null; } }
public Requirement(int id, bool done) { this.tech = TechnologyDatabase.findTechnology(id); this.done = done; }
public LineItem CreateLineItem(DfpUser user, long orderId, string adUnitId) { LineItemService lineItemService = (LineItemService)user.GetService(DfpService.v201306.LineItemService); long placementId = CreatePlacement(user, new string[] { adUnitId }).id; // Create inventory targeting. InventoryTargeting inventoryTargeting = new InventoryTargeting(); inventoryTargeting.targetedPlacementIds = new long[] { placementId }; // Create geographical targeting. GeoTargeting geoTargeting = new GeoTargeting(); // Include the US and Quebec, Canada. Location countryLocation = new Location(); countryLocation.id = 2840L; Location regionLocation = new Location(); regionLocation.id = 20123L; geoTargeting.targetedLocations = new Location[] { countryLocation, regionLocation }; // Exclude Chicago and the New York metro area. Location cityLocation = new Location(); cityLocation.id = 1016367L; Location metroLocation = new Location(); metroLocation.id = 200501L; geoTargeting.excludedLocations = new Location[] { cityLocation, metroLocation }; // Exclude domains that are not under the network's control. UserDomainTargeting userDomainTargeting = new UserDomainTargeting(); userDomainTargeting.domains = new String[] { "usa.gov" }; userDomainTargeting.targeted = false; // Create day-part targeting. DayPartTargeting dayPartTargeting = new DayPartTargeting(); dayPartTargeting.timeZone = DeliveryTimeZone.BROWSER; // Target only the weekend in the browser's timezone. DayPart saturdayDayPart = new DayPart(); saturdayDayPart.dayOfWeek = Google.Api.Ads.Dfp.v201306.DayOfWeek.SATURDAY; saturdayDayPart.startTime = new TimeOfDay(); saturdayDayPart.startTime.hour = 0; saturdayDayPart.startTime.minute = MinuteOfHour.ZERO; saturdayDayPart.endTime = new TimeOfDay(); saturdayDayPart.endTime.hour = 24; saturdayDayPart.endTime.minute = MinuteOfHour.ZERO; DayPart sundayDayPart = new DayPart(); sundayDayPart.dayOfWeek = Google.Api.Ads.Dfp.v201306.DayOfWeek.SUNDAY; sundayDayPart.startTime = new TimeOfDay(); sundayDayPart.startTime.hour = 0; sundayDayPart.startTime.minute = MinuteOfHour.ZERO; sundayDayPart.endTime = new TimeOfDay(); sundayDayPart.endTime.hour = 24; sundayDayPart.endTime.minute = MinuteOfHour.ZERO; dayPartTargeting.dayParts = new DayPart[] { saturdayDayPart, sundayDayPart }; // Create technology targeting. TechnologyTargeting technologyTargeting = new TechnologyTargeting(); // Create browser targeting. BrowserTargeting browserTargeting = new BrowserTargeting(); browserTargeting.isTargeted = true; // Target just the Chrome browser. Technology browserTechnology = new Technology(); browserTechnology.id = 500072L; browserTargeting.browsers = new Technology[] { browserTechnology }; technologyTargeting.browserTargeting = browserTargeting; LineItem lineItem = new LineItem(); lineItem.name = "Line item #" + new TestUtils().GetTimeStamp(); lineItem.orderId = orderId; lineItem.targeting = new Targeting(); lineItem.targeting.inventoryTargeting = inventoryTargeting; lineItem.targeting.geoTargeting = geoTargeting; lineItem.targeting.userDomainTargeting = userDomainTargeting; lineItem.targeting.dayPartTargeting = dayPartTargeting; lineItem.targeting.technologyTargeting = technologyTargeting; lineItem.lineItemType = LineItemType.STANDARD; lineItem.allowOverbook = true; // Set the creative rotation type to even. lineItem.creativeRotationType = CreativeRotationType.EVEN; // Set the size of creatives that can be associated with this line item. Size size = new Size(); size.width = 300; size.height = 250; size.isAspectRatio = false; // Create the creative placeholder. CreativePlaceholder creativePlaceholder = new CreativePlaceholder(); creativePlaceholder.size = size; lineItem.creativePlaceholders = new CreativePlaceholder[] { creativePlaceholder }; // Set the length of the line item to run. //lineItem.startDateTimeType = StartDateTimeType.IMMEDIATELY; lineItem.startDateTimeType = StartDateTimeType.IMMEDIATELY; lineItem.endDateTime = DateTimeUtilities.FromDateTime(System.DateTime.Today.AddMonths(1)); // Set the cost per unit to $2. lineItem.costType = CostType.CPM; lineItem.costPerUnit = new Money(); lineItem.costPerUnit.currencyCode = "USD"; lineItem.costPerUnit.microAmount = 2000000L; // Set the number of units bought to 500,000 so that the budget is // $1,000. lineItem.unitsBought = 500000L; lineItem.unitType = UnitType.IMPRESSIONS; return(lineItemService.createLineItem(lineItem)); }
public async Task Delete(Technology technology) { await repository.DeleteTechnologyAsync(technology.Id); }
//Skal returnere teknologien den lager? public void createTechnology(Technology technology) { }
public ActionResult Create(FormCollection collection, HttpPostedFileBase file1, HttpPostedFileBase file2, HttpPostedFileBase file3) { try { myHandler = new BusinessLogicHandler(); gadget = new Technology(); Company c = new Company(); gadget.DateAdded = DateTime.Now; gadget.ModelName = collection.GetValue("techs.ModelName").AttemptedValue.ToString(); gadget.Specs = collection.GetValue("techs.Specs").AttemptedValue.ToString(); gadget.ModelNumber = collection.GetValue("techs.ModelNumber").AttemptedValue.ToString(); gadget.ManufacturerID = Convert.ToInt32(collection.GetValue("Manufacturer").AttemptedValue); gadget.TechCategoryID = Convert.ToInt32(collection.GetValue("CategoryName").AttemptedValue); gadget.SupplierID = Convert.ToInt32(collection.GetValue("Name").AttemptedValue); gadget.CostPrice = Convert.ToDouble(collection.GetValue("techs.CostPrice").AttemptedValue); gadget.SellingPrice = Convert.ToDouble(collection.GetValue("techs.SellingPrice").AttemptedValue); gadget.IsBook = false; if (ModelState.IsValid) { if (file1 != null) { file1.SaveAs(HttpContext.Server.MapPath("~/Uploads/Tech/") + file1.FileName); gadget.ImageFront = file1.FileName; } if (file2 != null) { file2.SaveAs(HttpContext.Server.MapPath("~/Uploads/Tech/") + file2.FileName); gadget.ImageTop = file2.FileName; } if (file3 != null) { file3.SaveAs(HttpContext.Server.MapPath("~/Uploads/Tech/") + file3.FileName); gadget.ImageSide = file3.FileName; } Technology ta = new Technology(); ta = myHandler.AddExperimentTech(gadget); ta.ModelName = gadget.ModelName; ta.ModelNumber = gadget.ModelNumber; ta.Specs = gadget.Specs; ta.ManufacturerID = gadget.ManufacturerID; ta.TechCategoryID = gadget.TechCategoryID; ta.SupplierID = gadget.SupplierID; //ta.CostPrice = gadget.CostPrice; //ta.SellingPrice = gadget.SellingPrice; //ta.IsBook = gadget.IsBook; ta.ImageFront = gadget.ImageFront; ta.ImageTop = gadget.ImageTop; ta.ImageSide = gadget.ImageSide; myHandler.AddTechnology(ta); TempData["AlertMessage"] = "Device Successfully Added"; } return RedirectToAction("Create", "Technology", gadget); } catch { AddNewTechViewModel techM = new AddNewTechViewModel(); /*TEMP LIST*/ //List<Supplier> nameList = new List<Supplier>(); SupplierHandler supHandler = new SupplierHandler(); IEnumerable<Supplier> nameList = (IEnumerable<Supplier>)supHandler.GetTechSupplierList(); var disp = from nameAndId in nameList select new { Value = nameAndId.SupplierID, Text = nameAndId.Name }; ViewBag.SupplierList = new SelectList(disp.ToList()); TechCategoryHandler typeHandler = new TechCategoryHandler(); IEnumerable<TechCategory> typeList = (IEnumerable<TechCategory>)typeHandler.GetTechCategoryList(); var dispTC = from name in typeList select new { Value = name.TechCategoryID, Text = name.CategoryName }; ViewBag.TechCategoryList = new SelectList(dispTC.ToList()); ManufacturerHandler manHandler = new ManufacturerHandler(); IEnumerable<Manufacturer> manList = (IEnumerable<Manufacturer>)manHandler.GetManufacturerList(); var dispM = from mName in manList select new { Value = mName.ManufacturerID, Text = mName.Name }; ViewBag.ManufacturerList = new SelectList(dispM.ToList()); List<SelectListItem> supplier = new List<SelectListItem>(); //supplier.Add(new SelectListItem { Text = "Select Supplier", Value = "", Selected = true }); foreach (var item in nameList) { supplier.Add(new SelectListItem { Text = item.Name, Value = item.SupplierID.ToString() }); } techM.suppliers = new List<SelectListItem>(); techM.suppliers = supplier; ViewData["suppliers"] = supplier; List<SelectListItem> techCategory = new List<SelectListItem>(); //techCategory.Add(new SelectListItem { Text = "Select Category", Value = "", Selected = true }); foreach (var item in typeList) { techCategory.Add(new SelectListItem { Text = item.CategoryName, Value = item.TechCategoryID.ToString(), Selected = true }); } techM.techCategories = new List<SelectListItem>(); techM.techCategories = techCategory; ViewData["techCategories"] = techCategory; List<SelectListItem> manufacturer = new List<SelectListItem>(); //manufacturer.Add(new SelectListItem { Text = "Select Manufacturer", Value = "", Selected = true }); foreach (var item in manList) { manufacturer.Add(new SelectListItem { Text = item.Name, Value = item.ManufacturerID.ToString() }); } techM.manufacturers = new List<SelectListItem>(); techM.manufacturers = manufacturer; ViewData["manufacturers"] = manufacturer; return View(techM); } }
public void updateTechnology(Technology tech, CPopulation pop){ if (tech != null) selectedTechnology.updateInfos (tech, pop); else selectedTechnology.updateToNull (pop); }
/// <summary> /// Run the code examples. /// </summary> /// <param name="user">The DFP user object running the code examples.</param> public override void Run(DfpUser user) { // Get the LineItemService. LineItemService lineItemService = (LineItemService) user.GetService(DfpService.v201511.LineItemService); // Set the order that all created line items will belong to and the // placement ID to target. long orderId = long.Parse(_T("INSERT_ORDER_ID_HERE")); long[] targetPlacementIds = new long[] {long.Parse(_T("INSERT_PLACEMENT_ID_HERE"))}; // Create inventory targeting. InventoryTargeting inventoryTargeting = new InventoryTargeting(); inventoryTargeting.targetedPlacementIds = targetPlacementIds; // Create geographical targeting. GeoTargeting geoTargeting = new GeoTargeting(); // Include the US and Quebec, Canada. Location countryLocation = new Location(); countryLocation.id = 2840L; Location regionLocation = new Location(); regionLocation.id = 20123L; geoTargeting.targetedLocations = new Location[] {countryLocation, regionLocation}; Location postalCodeLocation = new Location(); postalCodeLocation.id = 9000093; // Exclude Chicago and the New York metro area. Location cityLocation = new Location(); cityLocation.id = 1016367L; Location metroLocation = new Location(); metroLocation.id = 200501L; geoTargeting.excludedLocations = new Location[] {cityLocation, metroLocation}; // Exclude domains that are not under the network's control. UserDomainTargeting userDomainTargeting = new UserDomainTargeting(); userDomainTargeting.domains = new String[] {"usa.gov"}; userDomainTargeting.targeted = false; // Create day-part targeting. DayPartTargeting dayPartTargeting = new DayPartTargeting(); dayPartTargeting.timeZone = DeliveryTimeZone.BROWSER; // Target only the weekend in the browser's timezone. DayPart saturdayDayPart = new DayPart(); saturdayDayPart.dayOfWeek = Google.Api.Ads.Dfp.v201511.DayOfWeek.SATURDAY; saturdayDayPart.startTime = new TimeOfDay(); saturdayDayPart.startTime.hour = 0; saturdayDayPart.startTime.minute = MinuteOfHour.ZERO; saturdayDayPart.endTime = new TimeOfDay(); saturdayDayPart.endTime.hour = 24; saturdayDayPart.endTime.minute = MinuteOfHour.ZERO; DayPart sundayDayPart = new DayPart(); sundayDayPart.dayOfWeek = Google.Api.Ads.Dfp.v201511.DayOfWeek.SUNDAY; sundayDayPart.startTime = new TimeOfDay(); sundayDayPart.startTime.hour = 0; sundayDayPart.startTime.minute = MinuteOfHour.ZERO; sundayDayPart.endTime = new TimeOfDay(); sundayDayPart.endTime.hour = 24; sundayDayPart.endTime.minute = MinuteOfHour.ZERO; dayPartTargeting.dayParts = new DayPart[] {saturdayDayPart, sundayDayPart}; // Create technology targeting. TechnologyTargeting technologyTargeting = new TechnologyTargeting(); // Create browser targeting. BrowserTargeting browserTargeting = new BrowserTargeting(); browserTargeting.isTargeted = true; // Target just the Chrome browser. Technology browserTechnology = new Technology(); browserTechnology.id = 500072L; browserTargeting.browsers = new Technology[] {browserTechnology}; technologyTargeting.browserTargeting = browserTargeting; // Create an array to store local line item objects. LineItem[] lineItems = new LineItem[5]; for (int i = 0; i < 5; i++) { LineItem lineItem = new LineItem(); lineItem.name = "Line item #" + i; lineItem.orderId = orderId; lineItem.targeting = new Targeting(); lineItem.targeting.inventoryTargeting = inventoryTargeting; lineItem.targeting.geoTargeting = geoTargeting; lineItem.targeting.userDomainTargeting = userDomainTargeting; lineItem.targeting.dayPartTargeting = dayPartTargeting; lineItem.targeting.technologyTargeting = technologyTargeting; lineItem.lineItemType = LineItemType.STANDARD; lineItem.allowOverbook = true; // Set the creative rotation type to even. lineItem.creativeRotationType = CreativeRotationType.EVEN; // Set the size of creatives that can be associated with this line item. Size size = new Size(); size.width = 300; size.height = 250; size.isAspectRatio = false; // Create the creative placeholder. CreativePlaceholder creativePlaceholder = new CreativePlaceholder(); creativePlaceholder.size = size; lineItem.creativePlaceholders = new CreativePlaceholder[] {creativePlaceholder}; // Set the line item to run for one month. lineItem.startDateTimeType = StartDateTimeType.IMMEDIATELY; lineItem.endDateTime = DateTimeUtilities.FromDateTime(System.DateTime.Today.AddMonths(1), "America/New_York"); // Set the cost per unit to $2. lineItem.costType = CostType.CPM; lineItem.costPerUnit = new Money(); lineItem.costPerUnit.currencyCode = "USD"; lineItem.costPerUnit.microAmount = 2000000L; // Set the number of units bought to 500,000 so that the budget is // $1,000. Goal goal = new Goal(); goal.goalType = GoalType.LIFETIME; goal.unitType = UnitType.IMPRESSIONS; goal.units = 500000L; lineItem.primaryGoal = goal; lineItems[i] = lineItem; } try { // Create the line items on the server. lineItems = lineItemService.createLineItems(lineItems); if (lineItems != null) { foreach (LineItem lineItem in lineItems) { Console.WriteLine("A line item with ID \"{0}\", belonging to order ID \"{1}\", and" + " named \"{2}\" was created.", lineItem.id, lineItem.orderId, lineItem.name); } } else { Console.WriteLine("No line items created."); } } catch (Exception e) { Console.WriteLine("Failed to create line items. Exception says \"{0}\"", e.Message); } }
public void TestCreateLineItems() { // Create inventory targeting. InventoryTargeting inventoryTargeting = new InventoryTargeting(); inventoryTargeting.targetedPlacementIds = new long[] { placementId }; // Create geographical targeting. GeoTargeting geoTargeting = new GeoTargeting(); // Include the US and Quebec, Canada. Location countryLocation = new Location(); countryLocation.id = 2840L; Location regionLocation = new Location(); regionLocation.id = 20123L; geoTargeting.targetedLocations = new Location[] { countryLocation, regionLocation }; // Exclude Chicago and the New York metro area. Location cityLocation = new Location(); cityLocation.id = 1016367L; Location metroLocation = new Location(); metroLocation.id = 200501L; geoTargeting.excludedLocations = new Location[] { cityLocation, metroLocation }; // Exclude domains that are not under the network's control. UserDomainTargeting userDomainTargeting = new UserDomainTargeting(); userDomainTargeting.domains = new String[] { "usa.gov" }; userDomainTargeting.targeted = false; // Create day-part targeting. DayPartTargeting dayPartTargeting = new DayPartTargeting(); dayPartTargeting.timeZone = DeliveryTimeZone.BROWSER; // Target only the weekend in the browser's timezone. DayPart saturdayDayPart = new DayPart(); saturdayDayPart.dayOfWeek = Google.Api.Ads.Dfp.v201602.DayOfWeek.SATURDAY; saturdayDayPart.startTime = new TimeOfDay(); saturdayDayPart.startTime.hour = 0; saturdayDayPart.startTime.minute = MinuteOfHour.ZERO; saturdayDayPart.endTime = new TimeOfDay(); saturdayDayPart.endTime.hour = 24; saturdayDayPart.endTime.minute = MinuteOfHour.ZERO; DayPart sundayDayPart = new DayPart(); sundayDayPart.dayOfWeek = Google.Api.Ads.Dfp.v201602.DayOfWeek.SUNDAY; sundayDayPart.startTime = new TimeOfDay(); sundayDayPart.startTime.hour = 0; sundayDayPart.startTime.minute = MinuteOfHour.ZERO; sundayDayPart.endTime = new TimeOfDay(); sundayDayPart.endTime.hour = 24; sundayDayPart.endTime.minute = MinuteOfHour.ZERO; dayPartTargeting.dayParts = new DayPart[] { saturdayDayPart, sundayDayPart }; // Create technology targeting. TechnologyTargeting technologyTargeting = new TechnologyTargeting(); // Create browser targeting. BrowserTargeting browserTargeting = new BrowserTargeting(); browserTargeting.isTargeted = true; // Target just the Chrome browser. Technology browserTechnology = new Technology(); browserTechnology.id = 500072L; browserTargeting.browsers = new Technology[] { browserTechnology }; technologyTargeting.browserTargeting = browserTargeting; // Create an array to store local line item objects. LineItem[] lineItems = new LineItem[2]; for (int i = 0; i < lineItems.Length; i++) { LineItem lineItem = new LineItem(); lineItem.name = "Line item #" + new TestUtils().GetTimeStamp(); lineItem.orderId = orderId; lineItem.targeting = new Targeting(); lineItem.targeting.inventoryTargeting = inventoryTargeting; lineItem.targeting.geoTargeting = geoTargeting; lineItem.targeting.userDomainTargeting = userDomainTargeting; lineItem.targeting.dayPartTargeting = dayPartTargeting; lineItem.targeting.technologyTargeting = technologyTargeting; lineItem.lineItemType = LineItemType.STANDARD; lineItem.allowOverbook = true; // Set the creative rotation type to even. lineItem.creativeRotationType = CreativeRotationType.EVEN; // Set the size of creatives that can be associated with this line item. Size size = new Size(); size.width = 300; size.height = 250; size.isAspectRatio = false; // Create the creative placeholder. CreativePlaceholder creativePlaceholder = new CreativePlaceholder(); creativePlaceholder.size = size; lineItem.creativePlaceholders = new CreativePlaceholder[] { creativePlaceholder }; // Set the line item to run for one month. lineItem.startDateTimeType = StartDateTimeType.IMMEDIATELY; lineItem.endDateTime = DateTimeUtilities.FromDateTime(System.DateTime.Today.AddMonths(1), "America/New_York"); // Set the cost per unit to $2. lineItem.costType = CostType.CPM; lineItem.costPerUnit = new Money(); lineItem.costPerUnit.currencyCode = "USD"; lineItem.costPerUnit.microAmount = 2000000L; // Set the number of units bought to 500,000 so that the budget is // $1,000. Goal goal = new Goal(); goal.units = 500000L; goal.unitType = UnitType.IMPRESSIONS; lineItem.primaryGoal = goal; lineItems[i] = lineItem; } LineItem[] localLineItems = null; Assert.DoesNotThrow(delegate() { localLineItems = lineItemService.createLineItems(lineItems); }); Assert.NotNull(localLineItems); Assert.AreEqual(localLineItems.Length, 2); Assert.AreEqual(localLineItems[0].name, lineItems[0].name); Assert.AreEqual(localLineItems[0].orderId, lineItems[0].orderId); Assert.AreEqual(localLineItems[1].name, lineItems[1].name); Assert.AreEqual(localLineItems[1].orderId, lineItems[1].orderId); }
public ActionResult Edit(int ProductID) { AddNewTechViewModel model = new AddNewTechViewModel(); myHandler = new BusinessLogicHandler(); gadget = new Technology(); gadget = myHandler.GetTechnologyDetails(ProductID); model.techs = new Technology(); model.techs = gadget; SupplierHandler supHandler = new SupplierHandler(); /*TEMP LIST*/ //List<Supplier> nameList = new List<Supplier>(); IEnumerable<Supplier> nameList = (IEnumerable<Supplier>)supHandler.GetTechSupplierList(); var disp = from nameAndId in nameList select new { Value = nameAndId.SupplierID, Text = nameAndId.Name }; ViewBag.SupplierList = new SelectList(disp.ToList()); TechCategoryHandler typeHandler = new TechCategoryHandler(); IEnumerable<TechCategory> typeList = (IEnumerable<TechCategory>)typeHandler.GetTechCategoryList(); var dispTC = from name in typeList select new { Value = name.TechCategoryID, Text = name.CategoryName }; ViewBag.TechCategoryList = new SelectList(dispTC.ToList()); ManufacturerHandler manHandler = new ManufacturerHandler(); IEnumerable<Manufacturer> manList = (IEnumerable<Manufacturer>)manHandler.GetManufacturerList(); var dispM = from mName in manList select new { Value = mName.ManufacturerID, Text = mName.Name }; ViewBag.ManufacturerList = new SelectList(dispM.ToList()); model.techs = myHandler.GetTechnologyDetails(ProductID); Supplier sp = new Supplier(); TechCategory tck = new TechCategory(); Manufacturer mna = new Manufacturer(); foreach (var item in manList) { if (item.ManufacturerID == model.techs.ManufacturerID) { mna.ManufacturerID = item.ManufacturerID; mna.Name = item.Name; } } foreach (var item in nameList) { if (item.SupplierID == model.techs.SupplierID) { sp.SupplierID = item.SupplierID; sp.Name = item.Name; } } foreach (var item in typeList) { if (item.TechCategoryID == model.techs.TechCategoryID) { tck.TechCategoryID = item.TechCategoryID; tck.CategoryName = item.CategoryName; } } List<SelectListItem> supplier = new List<SelectListItem>(); supplier.Add(new SelectListItem { Value = sp.SupplierID.ToString(), Text = sp.Name, Selected = true }); foreach (var item in nameList) { if (item.SupplierID != sp.SupplierID) supplier.Add(new SelectListItem { Text = item.Name, Value = item.SupplierID.ToString() }); } model.suppliers = new List<SelectListItem>(); model.suppliers = supplier; ViewData["suppliers"] = supplier; List<SelectListItem> techCategory = new List<SelectListItem>(); techCategory.Add(new SelectListItem { Value = tck.TechCategoryID.ToString(), Text = tck.CategoryName, Selected = true }); foreach (var item in typeList) { if (item.TechCategoryID != tck.TechCategoryID) techCategory.Add(new SelectListItem { Text = item.CategoryName, Value = item.TechCategoryID.ToString() }); } model.techCategories = new List<SelectListItem>(); model.techCategories = techCategory; ViewData["techCategories"] = techCategory; List<SelectListItem> manufacturer = new List<SelectListItem>(); manufacturer.Add(new SelectListItem { Value = mna.ManufacturerID.ToString(), Text = mna.Name, Selected = true }); foreach (var item in manList) { if (item.ManufacturerID != mna.ManufacturerID) manufacturer.Add(new SelectListItem { Text = item.Name, Value = item.ManufacturerID.ToString() }); } model.manufacturers = new List<SelectListItem>(); model.manufacturers = manufacturer; ViewData["manufacturers"] = manufacturer; return View(model); }
/// <summary> /// Run the code examples. /// </summary> public void Run(DfpUser user) { using (LineItemService lineItemService = (LineItemService)user.GetService(DfpService.v201705.LineItemService)) { // Set the order that all created line items will belong to and the // placement ID to target. long orderId = long.Parse(_T("INSERT_ORDER_ID_HERE")); long[] targetPlacementIds = new long[] { long.Parse(_T("INSERT_PLACEMENT_ID_HERE")) }; // Create inventory targeting. InventoryTargeting inventoryTargeting = new InventoryTargeting(); inventoryTargeting.targetedPlacementIds = targetPlacementIds; // Create geographical targeting. GeoTargeting geoTargeting = new GeoTargeting(); // Include the US and Quebec, Canada. Location countryLocation = new Location(); countryLocation.id = 2840L; Location regionLocation = new Location(); regionLocation.id = 20123L; geoTargeting.targetedLocations = new Location[] { countryLocation, regionLocation }; Location postalCodeLocation = new Location(); postalCodeLocation.id = 9000093; // Exclude Chicago and the New York metro area. Location cityLocation = new Location(); cityLocation.id = 1016367L; Location metroLocation = new Location(); metroLocation.id = 200501L; geoTargeting.excludedLocations = new Location[] { cityLocation, metroLocation }; // Exclude domains that are not under the network's control. UserDomainTargeting userDomainTargeting = new UserDomainTargeting(); userDomainTargeting.domains = new String[] { "usa.gov" }; userDomainTargeting.targeted = false; // Create day-part targeting. DayPartTargeting dayPartTargeting = new DayPartTargeting(); dayPartTargeting.timeZone = DeliveryTimeZone.BROWSER; // Target only the weekend in the browser's timezone. DayPart saturdayDayPart = new DayPart(); saturdayDayPart.dayOfWeek = Google.Api.Ads.Dfp.v201705.DayOfWeek.SATURDAY; saturdayDayPart.startTime = new TimeOfDay(); saturdayDayPart.startTime.hour = 0; saturdayDayPart.startTime.minute = MinuteOfHour.ZERO; saturdayDayPart.endTime = new TimeOfDay(); saturdayDayPart.endTime.hour = 24; saturdayDayPart.endTime.minute = MinuteOfHour.ZERO; DayPart sundayDayPart = new DayPart(); sundayDayPart.dayOfWeek = Google.Api.Ads.Dfp.v201705.DayOfWeek.SUNDAY; sundayDayPart.startTime = new TimeOfDay(); sundayDayPart.startTime.hour = 0; sundayDayPart.startTime.minute = MinuteOfHour.ZERO; sundayDayPart.endTime = new TimeOfDay(); sundayDayPart.endTime.hour = 24; sundayDayPart.endTime.minute = MinuteOfHour.ZERO; dayPartTargeting.dayParts = new DayPart[] { saturdayDayPart, sundayDayPart }; // Create technology targeting. TechnologyTargeting technologyTargeting = new TechnologyTargeting(); // Create browser targeting. BrowserTargeting browserTargeting = new BrowserTargeting(); browserTargeting.isTargeted = true; // Target just the Chrome browser. Technology browserTechnology = new Technology(); browserTechnology.id = 500072L; browserTargeting.browsers = new Technology[] { browserTechnology }; technologyTargeting.browserTargeting = browserTargeting; // Create an array to store local line item objects. LineItem[] lineItems = new LineItem[5]; for (int i = 0; i < 5; i++) { LineItem lineItem = new LineItem(); lineItem.name = "Line item #" + i; lineItem.orderId = orderId; lineItem.targeting = new Targeting(); lineItem.targeting.inventoryTargeting = inventoryTargeting; lineItem.targeting.geoTargeting = geoTargeting; lineItem.targeting.userDomainTargeting = userDomainTargeting; lineItem.targeting.dayPartTargeting = dayPartTargeting; lineItem.targeting.technologyTargeting = technologyTargeting; lineItem.lineItemType = LineItemType.STANDARD; lineItem.allowOverbook = true; // Set the creative rotation type to even. lineItem.creativeRotationType = CreativeRotationType.EVEN; // Set the size of creatives that can be associated with this line item. Size size = new Size(); size.width = 300; size.height = 250; size.isAspectRatio = false; // Create the creative placeholder. CreativePlaceholder creativePlaceholder = new CreativePlaceholder(); creativePlaceholder.size = size; lineItem.creativePlaceholders = new CreativePlaceholder[] { creativePlaceholder }; // Set the line item to run for one month. lineItem.startDateTimeType = StartDateTimeType.IMMEDIATELY; lineItem.endDateTime = DateTimeUtilities.FromDateTime(System.DateTime.Today.AddMonths(1), "America/New_York"); // Set the cost per unit to $2. lineItem.costType = CostType.CPM; lineItem.costPerUnit = new Money(); lineItem.costPerUnit.currencyCode = "USD"; lineItem.costPerUnit.microAmount = 2000000L; // Set the number of units bought to 500,000 so that the budget is // $1,000. Goal goal = new Goal(); goal.goalType = GoalType.LIFETIME; goal.unitType = UnitType.IMPRESSIONS; goal.units = 500000L; lineItem.primaryGoal = goal; lineItems[i] = lineItem; } try { // Create the line items on the server. lineItems = lineItemService.createLineItems(lineItems); if (lineItems != null) { foreach (LineItem lineItem in lineItems) { Console.WriteLine("A line item with ID \"{0}\", belonging to order ID \"{1}\", and" + " named \"{2}\" was created.", lineItem.id, lineItem.orderId, lineItem.name); } } else { Console.WriteLine("No line items created."); } } catch (Exception e) { Console.WriteLine("Failed to create line items. Exception says \"{0}\"", e.Message); } } }
public void CopyData(Technology tech) { technologyName = tech.technologyName; icon = tech.icon; researchPointsRequired = tech.researchPointsRequired; }
/// <summary> /// Initializes a new instance of the <c>TechnologyGoody</c> class. /// </summary> /// <param name="tribeName"></param> /// <param name="newTechnology"></param> public TechnologyGoody(string tribeName, Technology newTechnology) : base(tribeName) { this.technology = newTechnology; }
public ActionResult Checkout(FormCollection collection, ProductViewModel model) { Delivery shipping = new Delivery(); IEnumerable<Book> ifBooks = (IEnumerable<Book>)Session["myBooks"]; IEnumerable<Technology> ifGadget = (IEnumerable<Technology>)Session["myGadget"]; List<CartItem> myItems = (List<CartItem>)Session["myItems"]; myHandler = new BusinessLogicHandler(); #region Get Shipping Data try { shipping = myHandler.GetDeliveryDetails(Convert.ToInt32(collection[1].ToString())); if (ModelState.ContainsKey("I_DeliveryList")) ModelState["I_DeliveryList"].Errors.Clear(); } catch { ModelState.AddModelError("deliveryHelper.DeliveryServicePrice", "Please select a delivery service from dropdown !"); } #endregion #region Cathing model errors var error = ModelState.Values.SelectMany(e => e.Errors); var errors = ModelState .Where(x => x.Value.Errors.Count > 0) .Select(x => new { x.Key, x.Value.Errors }) .ToArray(); #endregion int? IID = 0; if (ModelState.IsValid) { #region Get User string userName = User.Identity.GetUserName(); ApplicationDbContext dataSocket = new ApplicationDbContext(); UserStore<ApplicationUser> myStore = new UserStore<ApplicationUser>(dataSocket); userMgr = new ApplicationUserManager(myStore); var user = userMgr.FindByEmail(userName); #endregion try { #region Creating the reciept/invoice Invoice reciept = new Invoice { User_Id = user.Id, DateCreated = DateTime.Now, DeliveryAddress = model.deliveryHelper.DeliveryAddress, DeliveryServiceID = Convert.ToInt32(collection[1].ToString()), Status = false }; try { InvoiceItem invoiceLine = new InvoiceItem(); invoiceLine = myHandler.GetInvoiceLastNumber(reciept); foreach (var item in myItems) { invoiceLine.CartItemID = item.CartItemID; invoiceLine.ProductID = item.ProductID; invoiceLine.Quantity = item.Quantity; #region Get Product Price bool chk = false; chk = myHandler.CheckProductType(item.ProductID); if (chk) { Book book = new Book(); book = myHandler.GetBook(item.ProductID); invoiceLine.Price = book.SellingPrice; myHandler.AddinvoiceItem(invoiceLine); } else { Technology device = new Technology(); device = myHandler.GetTechnologyDetails(item.ProductID); invoiceLine.Price = device.SellingPrice; myHandler.AddinvoiceItem(invoiceLine); } #endregion } IID = invoiceLine.InvoiceID; } catch { } #endregion #region Placing the order try { #region Prep Utilities Order ord; Book book = new Book(); Technology gadget = new Technology(); int supplierId = 0; OrderItem orderLine = new OrderItem(); myHandler = new BusinessLogicHandler(); List<int> orders = new List<int>(); List<int> suppliers = new List<int>(); #endregion foreach (var item in myItems) { if (myHandler.CheckProductType(item.ProductID)) { book = myHandler.GetBook(item.ProductID); supplierId = book.SupplierID; if (suppliers.Contains(book.SupplierID)) { int x = suppliers.IndexOf(supplierId); orderLine.OrderNo = orders.ElementAt(x); orderLine.ProductID = item.ProductID; orderLine.Quantity = item.Quantity; myHandler.AddOrderItem(orderLine); } else { suppliers.Add(supplierId); ord = new Order { DateCreated = DateTime.Now.Date, SupplierID = supplierId, InvoiceID = IID.GetValueOrDefault(), DateLastModified = DateTime.Now.Date, Status = false }; orderLine = myHandler.AddOrder(ord); orders.Add(orderLine.OrderNo); orderLine.ProductID = item.ProductID; orderLine.Quantity = item.Quantity; myHandler.AddOrderItem(orderLine); } } else { supplierId = ifGadget.SingleOrDefault(m => m.ProductID == item.ProductID).SupplierID; if (suppliers.Contains(supplierId)) { int y = suppliers.IndexOf(supplierId); orderLine.OrderNo = orders.ElementAt(y); orderLine.ProductID = item.ProductID; orderLine.Quantity = item.Quantity; myHandler.AddOrderItem(orderLine); } else { suppliers.Add(supplierId); ord = new Order { DateCreated = DateTime.Now.Date, SupplierID = supplierId, InvoiceID = IID.GetValueOrDefault(), DateLastModified = DateTime.Now.Date, Status = false }; orderLine = myHandler.AddOrder(ord); orders.Add(orderLine.OrderNo); orderLine.ProductID = item.ProductID; orderLine.Quantity = item.Quantity; myHandler.AddOrderItem(orderLine); } } } } catch { } #endregion } catch {/*Navigate to custom error page*/ } Session["deliverData"] = model; return RedirectToAction("Receipt", new { IID = IID }); } else { #region Feed The Model CartItem thishereItem = new CartItem(); try { ProductViewModel.CartHelper cartHelp; List<ProductViewModel.CartHelper> itemList = new List<ProductViewModel.CartHelper>(); double cartTotal = 0; if (myItems != null) { if (ifBooks != null) { var revised = from rev in ifBooks join item in myItems on rev.ProductID equals item.ProductID where rev.ProductID == item.ProductID select new { rev.ProductID, rev.SellingPrice, item.Quantity }; foreach (var ite in revised) { cartHelp = new ProductViewModel.CartHelper(); cartHelp.ProductID = ite.ProductID; cartHelp.TotalPerItem = (ite.SellingPrice * ite.Quantity); cartTotal += (ite.SellingPrice * ite.Quantity); itemList.Add(cartHelp); } } if (ifGadget != null) { var revised = from rev in ifGadget join item in myItems on rev.ProductID equals item.ProductID where rev.ProductID == item.ProductID select new { rev.ProductID, rev.SellingPrice, item.Quantity }; foreach (var ite in revised) { cartHelp = new ProductViewModel.CartHelper(); cartHelp.ProductID = ite.ProductID; cartHelp.TotalPerItem = (ite.SellingPrice * ite.Quantity); cartTotal += (ite.SellingPrice * ite.Quantity); itemList.Add(cartHelp); } } } List<Company> company = new List<Company>(); myHandler = new BusinessLogicHandler(); company = myHandler.GetCompanyDetails(); double vat = 0; foreach (var item in company) { vat = item.VATPercentage; } //calc double vatAmount = (cartTotal * vat); double subTotal = (cartTotal - vatAmount); ProductViewModel.CartConclude finishing = new ProductViewModel.CartConclude(); finishing.CartTotal = cartTotal; finishing.VatAddedTotal = vatAmount; finishing.SubTotal = subTotal; model.ItsA_wrap = new List<ProductViewModel.CartConclude>(); model.ItsA_wrap.Add(finishing); model.deliveryHelper.DeliveryServiceName = shipping.ServiceName; model.deliveryHelper.DeliveryServicePrice = shipping.Price; model.deliveryHelper.DeliveryServiceType = shipping.ServiceType; model.secureCart = itemList; model.allBook = new List<Book>(); model.allBook = ifBooks.ToList() ; model.allCartItem = new List<CartItem>(); model.allCartItem = myItems; model.allTechnology = new List<Technology>(); model.allTechnology = ifGadget.ToList(); } catch { } #endregion #region Drop down data DeliveryHandler deliver = new DeliveryHandler(); IEnumerable<Delivery> delivery = (IEnumerable<Delivery>)deliver.GetDeliveryList(); var dataStore = from name in delivery select new { Value = name.DeliveryServiceID, Text = name.ServiceName }; ViewBag.DeliveryList = new SelectList(dataStore.ToList()); List<SelectListItem> deliveryI = new List<SelectListItem>(); deliveryI.Add(new SelectListItem { Text = "Delivery Service", Value = "", Selected = true }); foreach (var item in delivery) { deliveryI.Add(new SelectListItem { Text = item.ServiceName, Value = item.DeliveryServiceID.ToString() }); } model.I_DeliveryList = new List<SelectListItem>(); model.I_DeliveryList = deliveryI; ViewData["I_Delivery"] = deliveryI; #endregion return View(model); } }
public ActionResult Details(int OrderNumber) { #region Prep Utilities myHandler = new BusinessLogicHandler(); OrderLineModel model = new OrderLineModel(); #endregion #region Get Order Details model.OrderLineDetails = myHandler.GetOrderItemsList(OrderNumber); model.OrderDetails = myHandler.GetOrder(OrderNumber); model.SupplierDetails = myHandler.GetSupplier(model.OrderDetails.SupplierID); #endregion #region Get Order Total model.totally = 0; foreach(var item in model.OrderLineDetails) { if(myHandler.CheckProductType(item.ProductID)) { Book myBook = new Book(); myBook = myHandler.GetBook(item.ProductID); model.totally += (myBook.SellingPrice*item.Quantity); } else { Technology device = new Technology(); device = myHandler.GetTechnologyDetails(item.ProductID); model.totally += (device.SellingPrice * item.Quantity); } } #endregion return PartialView(model); }
public void Add(Technology technology) { _context.Add(technology); _context.SaveChanges(); }