public ActionResult GerarPlanejVendas(Dia dia) { using (var db = new ApplicationDbContext()) { db.Database.ExecuteSqlCommand("DELETE FROM dbo.PlanejVendas"); var produtos = db.Produtos.ToList(); foreach (var produto in produtos) { if (produto.Ativo) { var data = new PlanejVenda { ProdutoId = produto.Id, RefAno = dia.Hoje }; db.PlanejVendas.Add(data); } } db.SaveChanges(); } Populate.PlanejVendas(); return(RedirectToAction("Index", "Home")); }
public ActionResult FatHist(HttpPostedFileBase file) { try { if (file.ContentLength > 0) { string path = Path.Combine(Server.MapPath("~/UploadedFiles"), file.FileName); file.SaveAs(path); Populate.FatHist(path); System.IO.File.Delete(path); var memoria = db.Memorias.First(); memoria.AtualizacaoFatHistorico = DateTime.Now; db.SaveChanges(); } ViewBag.UltimaAtualizacao = db.Memorias.First().AtualizacaoFatHistorico; ViewBag.Message = Global.AtualizacaoOk; ViewBag.retorno = "FatHist"; return(View("UploadFile")); } catch (Exception ex) { DbLogger.Log(Reason.Error, $"Upload.FatHist: {ex.Message}"); ViewBag.UltimaAtualizacao = db.Memorias.First().AtualizacaoFatHistorico; ViewBag.Message = "Ocorreu um erro. Tente novamente ou consulte a log do sistema."; ViewBag.retorno = "FatHist"; return(View("UploadFile")); } }
public ActionResult add() { if (Session["message"] == null) { Session["message"] = ""; } Populate DropDown = new Populate(); List <SelectListItem> firearmtype_combo = new List <SelectListItem>(); List <SelectListItem> storage_combo = new List <SelectListItem>(); List <SelectListItem> manufacturer_combo = new List <SelectListItem>(); List <SelectListItem> supplier_combo = new List <SelectListItem>(); List <SelectListItem> condition_combo = new List <SelectListItem>(); firearmtype_combo = DropDown.getFirearmType(); manufacturer_combo = DropDown.getManufacturer(); supplier_combo = DropDown.getSupplier(); condition_combo = DropDown.getCondition(); storage_combo = DropDown.getStorage(); ViewData["firearmtype"] = firearmtype_combo; ViewData["manufacturer"] = manufacturer_combo; ViewData["supplier"] = supplier_combo; ViewData["storage"] = storage_combo; ViewData["condition"] = condition_combo; return(View()); }
public ActionResult Varvex(List <VarVex> varvex) { if (ModelState.IsValid) { foreach (var item in varvex) { var atual = db.PlanejVendas.Single(p => p.ProdutoId == item.Id); atual.PvppvaVPVexAnoMenos12 = item.VpVexMenos12 / 100f; atual.PvppvaVPVexAnoMenos11 = item.VpVexMenos11 / 100f; atual.PvppvaVPVexAnoMenos10 = item.VpVexMenos10 / 100f; atual.PvppvaVPVexAnoMenos9 = item.VpVexMenos09 / 100f; atual.PvppvaVPVexAnoMenos8 = item.VpVexMenos08 / 100f; atual.PvppvaVPVexAnoMenos7 = item.VpVexMenos07 / 100f; atual.PvppvaVPVexAnoMenos6 = item.VpVexMenos06 / 100f; atual.PvppvaVPVexAnoMenos5 = item.VpVexMenos05 / 100f; atual.PvppvaVPVexAnoMenos4 = item.VpVexMenos04 / 100f; atual.PvppvaVPVexAnoMenos3 = item.VpVexMenos03 / 100f; atual.PvppvaVPVexAnoMenos2 = item.VpVexMenos02 / 100f; atual.PvppvaVPVexAno = item.VpVexMenos01 / 100f; } db.SaveChanges(); Populate.PlanejVendas(); return(RedirectToAction("Index")); } return(RedirectToAction("Varvex")); }
public RootEntity() { this.Contacts = new AdvisableCollection <Contact>(); this.countries = new AdvisableCollection <Country>(); foreach (string country in Populate.GetCountries()) { this.countries.Add(new Country(country)); } Country russia = this.countries.Single(c => c.Name == "Russia"); foreach (string contactName in Populate.GetContacts()) { string[] names = contactName.Split(' '); Contact contact = new Contact(names[0], names[1]); Address address = new Address { AddressLine1 = "23, Ilyinka Street", Town = "Moscow", Zip = "103132", Country = russia }; contact.Addresses.Add(address); contact.PrincipalAddress = address; this.Contacts.Add(contact); } RecordingServices.DefaultRecorder.Clear(); }
public ActionResult VarPv(List <VarPv> varPv) { if (ModelState.IsValid) { foreach (var item in varPv) { var atual = db.PlanejVendas.Single(p => p.ProdutoId == item.Id); atual.PvvpvaVarPvAnoMenos12 = item.VarPvMenos12; atual.PvvpvaVarPvAnoMenos11 = item.VarPvMenos11; atual.PvvpvaVarPvAnoMenos10 = item.VarPvMenos10; atual.PvvpvaVarPvAnoMenos9 = item.VarPvMenos09; atual.PvvpvaVarPvAnoMenos8 = item.VarPvMenos08; atual.PvvpvaVarPvAnoMenos7 = item.VarPvMenos07; atual.PvvpvaVarPvAnoMenos6 = item.VarPvMenos06; atual.PvvpvaVarPvAnoMenos5 = item.VarPvMenos05; atual.PvvpvaVarPvAnoMenos4 = item.VarPvMenos04; atual.PvvpvaVarPvAnoMenos3 = item.VarPvMenos03; atual.PvvpvaVarPvAnoMenos2 = item.VarPvMenos02; atual.PvvpvaVarPvAno = item.VarPvMenos01; } db.SaveChanges(); Populate.PlanejVendas(); return(RedirectToAction("Index")); } return(RedirectToAction("VarPv")); }
private void Execute() { foreach (var fieldset in _model) { var alias = $"{_dataType}.{fieldset.Alias}"; var currentType = Populate.GetRegisteredType(alias, _type); var typeHierarchy = currentType.GetHierarchy(); var archetypeModel = Activator.CreateInstance(currentType) as T; foreach (var type in typeHierarchy) { var mapping = Populate.GetMappingForType(type); if (mapping == null) { continue; } var rules = mapping.GetRules(); foreach (var rule in rules) { rule.Execute(_session, _options, archetypeModel, type, fieldset); } } _results.Add(archetypeModel); } }
public ActionResult IndexPopulate() { Category.DeleteAll(); Buyer.DeleteAll(); Populate.PopulateDatabase(); Dictionary <string, object> model = new Dictionary <string, object> { }; Buyer buyer = Buyer.Find(0); List <Product> featured = Product.GetAll(); Random rnd = new Random(); List <Product> newFeatured = new List <Product>() { }; if (featured.Count > 0) { for (var i = 0; i < 4; i++) { newFeatured.Add(featured[rnd.Next(0, (featured.Count - 1))]); } var featuredProduct = featured[rnd.Next(0, (featured.Count - 1))]; model.Add("featured", featuredProduct); } model.Add("categories", Category.GetAll()); model.Add("buyer", buyer); model.Add("products", newFeatured); return(View("Index", model)); }
public void PopulateModel(List <ProductType> pt, string selectedBrand, string selectedColour, string selectedGender, string selectedSeason, string selectedStyle) { var allBrands = new Populate().PopulateAllBrands(); allBrands.Add("All", "All"); Brand = new EnumerableDropDownViewModel(allBrands, selectedBrand == "" ? "All" : selectedBrand); Brand.Items = Brand.Items.OrderBy(t => t.Text).ToList(); var allColours = new Populate().PopulateAllColours(); allColours.Add("All", "All"); Colour = new EnumerableDropDownViewModel(allColours, selectedColour == "" ? "All" : selectedColour); Colour.Items = Colour.Items.OrderBy(t => t.Text).ToList(); var g = new Populate().PopulateAllGenders(); g.Add("All", "All"); Gender = new EnumerableDropDownViewModel(g, selectedGender == "" ? "All" : selectedGender); Gender.Items = Gender.Items.OrderBy(t => t.Text).ToList(); var allSeasons = new Populate().PopulateAllSeasons(); allSeasons.Add("All", "All"); Season = new EnumerableDropDownViewModel(allSeasons, selectedSeason == "" ? "All" : selectedSeason); Season.Items = Season.Items.OrderBy(t => t.Text).ToList(); var allStyles = new Populate().PopulateAllStyles(); allStyles.Add("All", "All"); Style = new EnumerableDropDownViewModel(allStyles, selectedStyle == "" ? "All" : selectedStyle); Style.Items = Style.Items.OrderBy(t => t.Text).ToList(); }
void IMappingRule.Execute(IMappingSession session, MappingOptions options, object model, Type type, object source) { var content = source as IPublishedContent; if (content == null) { throw new Exception("Expected source type IPublishedContent"); } var destProperty = type.GetProperty(_propertyName, BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public) ?? type.GetProperty(_propertyName); var componentModel = new T(); //If component was not mapped inline, then we need to fetch it from the mapping registry if (_componentMapping == null) { _componentMapping = Populate.GetMappingForType(typeof(T)); if (_componentMapping == null) { throw new Exception($"No component mapper is defined for type: {typeof(T).FullName}"); } } var rules = _componentMapping.GetRules(); foreach (var rule in rules) { rule.Execute(session, options, componentModel, typeof(T), content); } destProperty.SetValue(model, componentModel); }
public ActionResult Tudo() { for (int i = 0; i < 5; i++) { Populate.DfxProdRev(); Populate.Quadro(); Populate.QuadroPercentual(); Populate.GrupoRateio(); Populate.FormacaoPrecoVenda(); Populate.Lucratividade(); Populate.PrecoNacional(); Populate.Insumo(); Populate.Estrutura(); Populate.Produto(); Populate.PrecoExportacao(); Populate.EncapTubos(); Populate.Graxas(); Populate.PreForma(); Populate.ResinaPtfe(); Populate.ProcTubos(); Populate.PlanejVendas(); Populate.PlanejMod(); Populate.PlanejCompra(); Populate.PlanejNecessidades(); Populate.PlanejProducao(); } return(Redirect("/")); }
public async Task <ActionResult> PopulateDB([Bind(Include = "MovieTitle,Protocol")] Populate pop) { if (ModelState.IsValid) { var timer = Stopwatch.StartNew(); timer.Start(); switch (pop.Protocol) { case "JSON": await parseByJSONDocument(pop.MovieTitle); break; case "XML": await parseByXMLDocument(pop.MovieTitle); break; } timer.Stop(); logger.Information("Generated DB based on {0} protocol. Timespan: {1} ", pop.Protocol, ((double)(timer.Elapsed.TotalMilliseconds * 1000000) / _max).ToString("0.00 ns")); return(RedirectToAction("Index")); } return(View(pop)); }
// // GET: /en/WeaponAccess/ public ActionResult AccessDoor() { Populate DropDown = new Populate(); List <SelectListItem> location_combo = new List <SelectListItem>(); location_combo = DropDown.getLocation(); ViewData["location"] = location_combo; return(View()); }
static int Main(string[] args) { if (args.Length != 5) { Console.WriteLine($"Usage: dotnet fs.dll <file> <sectors> <%index> <rootfs> <bootloader>"); return(1); } var file = args[0]; var sectors = uint.Parse(args[1]); var indexes = (uint)(((sectors * 8) / 100) * int.Parse(args[2])); var rootFs = args[3]; var bootloader = args[4]; var fs = new FileSystem(sectors, indexes); indexes = fs.Header.IndexNodes; Console.WriteLine($"Creating kOS {fs.Header.VersionMajor}.{fs.Header.VersionMinor} filesystem from path {rootFs}"); var pop = new Populate(fs); pop.ImportPath(rootFs, "/"); if (!string.IsNullOrEmpty(bootloader)) { var bootloaderNode = fs.GetIndexByPath(bootloader); if (bootloaderNode == null) { throw new ArgumentException("Bootloader file not found"); } else if (bootloaderNode.Flags.HasFlag(IndexFlags.Directory)) { throw new ArgumentException("Bootloader file is a directory"); } else if (!bootloaderNode.Flags.HasFlag(IndexFlags.Contigious)) { throw new ArgumentException("Bootloader file not contigious"); } fs.Header.BootLoaderID = bootloaderNode.ID; fs.Header.BootLoaderFirstSector = bootloaderNode.DataSector; fs.Header.BootLoaderSectorCount = bootloaderNode.DataSectorCount; } Console.WriteLine($"In use: {fs.IndexNodes.Count(x => x != null)}/{indexes} indexes, {fs.DataSectors.Count(x => x!=null)}/{fs.DataSectors.Length} data sectors"); if (fs.Header.BootLoaderID > 0) { Console.WriteLine($"Bootloader ID: {fs.Header.BootLoaderID}"); } using (var fsWriter = new FSWriter(File.Open(file, FileMode.Create, FileAccess.Write))) { fsWriter.WriteFS(fs); } return(0); }
public ActionResult Graxa(GrupoRateio grupoRateio) { var gr5 = db.GruposRateio.SingleOrDefault(g => g.Apelido == "GR0005"); gr5.Graxa = grupoRateio.Graxa; db.SaveChanges(); Populate.GrupoRateio(); return(RedirectToAction("Index")); }
public ActionResult add() { if (Session["message"] == null) { Session["message"] = ""; } Populate DropDown = new Populate(); return(View()); }
// // GET: /en/track/ public ActionResult Location() { Populate DropDown = new Populate(); List <SelectListItem> location_combo = new List <SelectListItem>(); location_combo = DropDown.getLocation(); ViewData["location"] = location_combo; string txtdate = DateTime.Now.ToString("dd-MMM-yyyy"); ViewData["date"] = txtdate; return(View()); }
public ActionResult addloc(string id, string gid) { Populate DropDown = new Populate(); List <SelectListItem> location_combo = new List <SelectListItem>(); location_combo = DropDown.getUnAssignedLocation(); ViewData["location"] = location_combo; ViewData["x"] = id; ViewData["y"] = gid; return(PartialView()); }
public ActionResult checkFirearms() { Populate DropDown = new Populate(); List <SelectListItem> status_combo = new List <SelectListItem>(); List <SelectListItem> firearmtype_combo = new List <SelectListItem>(); status_combo = DropDown.getStatusEN(); firearmtype_combo = DropDown.getFirearmType(); ViewData["status"] = status_combo; ViewData["firearmtype"] = firearmtype_combo; return(View()); }
public ActionResult edit(string id, string gid) { Populate DropDown = new Populate(); List <SelectListItem> location_combo = new List <SelectListItem>(); location_combo = DropDown.getLocation(); Db_Connection dbconn = new Db_Connection(); try { dbconn.openConnection(); string strSQL = @"SELECT DOOR,LOCATION,DESCRIPTION FROM VDOOR WHERE ID=@ID AND GID=@GID"; SqlCommand cmd = new SqlCommand(strSQL, dbconn.DbConn); cmd.Parameters.Add("ID", SqlDbType.VarChar).Value = id; cmd.Parameters.Add("GID", SqlDbType.VarChar).Value = gid; SqlDataReader dr = cmd.ExecuteReader(); mdlDoor record = new mdlDoor(); record.ID = id; record.GID = gid; if (dr.HasRows) { dr.Read(); record.ID = id; record.GID = gid; record.DOOR = dr["DOOR"].ToString(); record.LOCATION = dr["LOCATION"].ToString(); record.DESCRIPTION = dr["DESCRIPTION"].ToString(); } foreach (SelectListItem item in location_combo) { if (item.Text.ToUpper() == record.LOCATION.ToUpper()) { item.Selected = true; } } ViewData["location"] = location_combo; return(PartialView(record)); } finally { dbconn.closeConnection(); } }
public ActionResult Incremento(float incremento) { Memoria memoria = db.Memorias.First(); memoria.PvIncrementoGlobal = incremento / 100; db.SaveChanges(); ViewBag.incremento = incremento; Populate.PlanejVendas(); var planejVendas = db.PlanejVendas .Include(p => p.Produto); return(RedirectToAction("Index")); }
public bool DropSide(int x, Predicate <PlayfieldPoint> dropShouldStop, Populate populate) { if (dropShouldStop(new PlayfieldPoint(Positions[x].Column, Positions[x].Row + 2))) { populate(new PlayfieldPoint(Positions[x].Column, Positions[x].Row), DropPieceSimple.Cells[x][0]); populate(new PlayfieldPoint(Positions[x].Column, Positions[x].Row + 1), DropPieceSimple.Cells[x][1]); return(true); } else { return(false); } }
public ActionResult DespExp(float despExp) { Memoria memoria = db.Memorias.First(); memoria.DespExp = despExp / 100; db.SaveChanges(); ViewBag.despExp = despExp; Populate.PlanejVendas(); var planejVendas = db.PlanejVendas .Include(p => p.Produto); return(RedirectToAction("Index")); }
public ActionResult add() { if (Session["message"] == null) { Session["message"] = ""; } Populate DropDown = new Populate(); List <SelectListItem> location_combo = new List <SelectListItem>(); location_combo = DropDown.getLocation(); ViewData["location"] = location_combo; return(View()); }
protected override View GetViewImpl(Context context, ViewGroup parent) { #warning convertView is junk here? View view = _layoutId > 0 ? DroidResources.LoadLayout(context, parent, _layoutId) : DroidResources.LoadLayout(context, parent, LayoutName); if (view == null) { Log.Error("Android.Dialog", "ViewElement: Failed to load resource: " + LayoutName); } else { Populate?.Invoke(view); } return(view); }
public ActionResult Taxa(GrupoRateio grupoRateio) { var gr9 = db.GruposRateio.SingleOrDefault(g => g.Apelido == "GR0009"); gr9.Fita = grupoRateio.Fita / 100; gr9.Tubo = gr9.Fita; gr9.Fiotec = gr9.Fita; gr9.Gxpuro = gr9.Fita; gr9.Gxgraf = gr9.Fita; gr9.Graxa = gr9.Fita; gr9.Revenda = gr9.Fita; db.SaveChanges(); Populate.GrupoRateio(); return(RedirectToAction("Index")); }
/// <summary> /// Selects best population strategy for room based on current conditions. /// </summary> /// <param name="room"></param> /// <param name="zone"></param> /// <param name="pm"></param> public static void Room(RoomPackage room, ZonePackage zone, ProgramManifest pm) { //Prepare room for population routine based on current fill progress. room.PlacedItems = new List <PlacementPackage>(); Stage.Room.BaseAnchors(room); Stage.Room.ProgramFillOrder(room, zone, pm); Stage.Room.MaximumPlacements(room, zone, pm); //Select best population strategy based on room geometry and quotas. //TODO: Automate selection process and write base suite of strategies. Populate.ByMostRows(room, zone, pm); //After room is filled, adjust remaining quota for zone. Update.Zone.RemainingProgramTargets(zone, room); }
public ActionResult Distribuicao(GrupoRateio grupoRateio) { var gr13 = db.GruposRateio.SingleOrDefault(g => g.Apelido == "GR0013"); gr13.Fita = grupoRateio.Fita; gr13.Tubo = grupoRateio.Tubo; gr13.Fiotec = grupoRateio.Fiotec; gr13.Gxpuro = grupoRateio.Gxpuro; gr13.Gxgraf = grupoRateio.Gxgraf; gr13.Graxa = grupoRateio.Graxa; gr13.Revenda = grupoRateio.Revenda; db.SaveChanges(); Populate.GrupoRateio(); return(RedirectToAction("Index")); }
// Update is called once per frame protected override void Update( ) { if (!HasMonster && transform.position.x < -9) { Debug.Log("Could spawn"); int Monster = Populate.SpawnMonster( ); if (-1 != Monster) { Debug.Log("Should spawn"); GameObject SpawnedMonster = Instantiate(Populate.EnemyObjectList[Monster], new Vector2(transform.position.x + Size / 2, transform.position.y + Bounds.y), Quaternion.identity); HasMonster = true; SpawnedMonster.transform.parent = transform; } } base.Update( ); }
public ActionResult AccessDoorEdit(string id) { Populate DropDown = new Populate(); Db_Connection dbconn = new Db_Connection(); List <SelectListItem> allowdeny_combo = new List <SelectListItem>(); allowdeny_combo = DropDown.getAllowDeny(); try { dbconn.openConnection(); string strSQL = @"SELECT LOCATION,DOOR,ACCESS FROM VWEAPON_DOOR_ACCESS WHERE ID=@ID"; SqlCommand cmd = new SqlCommand(strSQL, dbconn.DbConn); cmd.Parameters.Add("ID", SqlDbType.VarChar).Value = id; SqlDataReader dr = cmd.ExecuteReader(); mdlTrack record = new mdlTrack(); record.ID = id; if (dr.HasRows) { dr.Read(); record.ID = id; record.LOCATION = dr["LOCATION"].ToString(); record.DOOR = dr["DOOR"].ToString(); record.ACCESS = dr["ACCESS"].ToString(); } foreach (SelectListItem item in allowdeny_combo) { if (item.Text.ToUpper() == record.ACCESS.ToUpper()) { item.Selected = true; } } ViewData["access"] = allowdeny_combo; return(PartialView(record)); } finally { dbconn.closeConnection(); } }
public PropertyField(PropertyType type, Control[] controls, ShouldShow shouldShow, Populate populate, Save save) : this(type, controls, shouldShow, (ctx, opts) => populate(ctx.BlogPost), save) { }