public BundleModel GetHistoryBundleModel(IList <ResourceStore> ResourceStoreList) { //Construct the History Bundle var BundleModel = new BundleModel(BundleType.History) { Total = ResourceStoreList.Count }; BundleModel.Entry = new List <BundleModel.EntryComponent>(); foreach (var ResourceStore in ResourceStoreList) { var entry = new BundleModel.EntryComponent(); BundleModel.Entry.Add(entry); if (ResourceStore.ResourceBlob is object) { entry.Resource = IFhirResourceParseJsonService.ParseJson(ResourceStore.FhirVersionId, IGZipper.Decompress(ResourceStore.ResourceBlob)); } string RequestUrl = ResourceStore.ResourceTypeId.GetCode(); if (ResourceStore.MethodId == HttpVerb.PUT || ResourceStore.MethodId == HttpVerb.DELETE) { RequestUrl = $"{RequestUrl}/{ResourceStore.ResourceId}"; } entry.Request = new BundleModel.RequestComponent(ResourceStore.MethodId, RequestUrl); entry.Response = new BundleModel.ResponseComponent($"{ResourceStore.HttpStatusCode.Code.ToString()} - {((int)ResourceStore.HttpStatusCode.Number).ToString()}") { LastModified = IServerDateTimeSupport.ZuluToServerTimeZone(ResourceStore.LastUpdated) }; } return(BundleModel); }
public ActionResult Update(int id) { var m = new BundleModel(id); UpdateModel <BundleModel>(m); UpdateModel <BundleHeader>(m.Bundle, "Bundle"); if (m.Bundle.ContributionDateChanged) { var q = from d in DbUtil.Db.BundleDetails where d.BundleHeaderId == m.Bundle.BundleHeaderId select d.Contribution; foreach (var c in q) { c.ContributionDate = m.Bundle.ContributionDate; } } var postingdt = Util.Now; if (m.Bundle.BundleStatusIdChanged && m.Bundle.BundleStatusId == BundleStatusCode.Closed) { foreach (var d in m.Bundle.BundleDetails) { d.Contribution.PostingDate = postingdt; } } DbUtil.Db.SubmitChanges(); m.BundleId = id; // refresh values return(View("Display", m)); }
public IHttpActionResult GetAllBundlesByType(string type) { List <BundleModel> Bundles = new List <BundleModel>(); foreach (DataRow row in Data.Tables[1].Rows) { if (row != null) { if (!string.IsNullOrWhiteSpace(type) && !row["Type"].ToString().Trim().Contains(type)) { continue; } BundleModel bun = new BundleModel(); bun.BundleId = row["BundleId"].ToString(); bun.Type = row["Type"].ToString(); bun.Name = row["Name"].ToString(); bun.Price = row["Price"].ToString(); bun.DAT = row["DAT"].ToString(); bun.TV = row["TV"].ToString(); bun.VOICE = row["VOICE"].ToString(); bun.ROUTER = row["ROUTER"].ToString(); bun.Discount = row["Discount"].ToString(); bun.Keyword = row["Keyword"].ToString(); Bundles.Add(bun); } } return(Json(JsonConvert.SerializeObject(Bundles))); }
private void AddSingletons(BundleModel bundle) { foreach (var singleton in _singletons) { bundle.AddSingleton(singleton); } }
public async Task <BundleModel> GetBundleItems(int bundleId) { FlightModel flight; BundleModel bundle = await BundleTable.GetBundleById(_dbConnection, bundleId); var flights_id = await BundleTable.GetBundleFlights(_dbConnection, bundleId); foreach (int flight_id in flights_id) { var k = await FlightTable.GetFlightById(_dbConnection, flight_id); if (k is null) { throw new Exception(); } else { flight = k; } bundle.Flights.Append(flight); } if (bundle is null) { throw new Exception(); } else { return(bundle); } }
protected void btnSubmit_Click(object sender, EventArgs e) { if (!Page.IsValid) { return; } var dt1 = DateTime.Parse(FromDate.Text); // todo: tryparse here var dt2 = DateTime.Parse(ToDate.Text); Response.Clear(); Response.Buffer = true; Response.ContentType = "text/plain"; Response.AddHeader("Content-Disposition", "attachment;filename=GLTRN2000.txt"); var ctl = new BundleModel(); var q = ctl.GetGLExtract(dt1, dt2); var GLBundlePrefix = DbUtil.Db.Setting("GLBundlePrefix", "CM"); foreach (var i in q) { Response.Write( "\"00000\",\"001{0}{1:00}{2}{3}\",\"000\",\"{4:MMddyy}\",\"{5}\",\"\",\"{6}0000{7}\",\"{8:00000000000}\",\"\"\r\n" .Fmt(i.Fund, i.Month, GLBundlePrefix, i.HeaderId.PadLeft(5, '0'), i.ContributionDate, i.FundName, i.FundDept, i.FundAcct, i.Amount * 100)); } Response.Flush(); Response.Close(); }
public IHttpActionResult GetCart() { List <BundleModel> bundles = new List <BundleModel>(); List <string> bundleIds = new List <string>(); if (Session["BundleId"] != null) { bundleIds.Add(Session["BundleId"].ToString()); if (Session["CompId"] != null) { bundleIds.Add(Session["CompId"].ToString()); } foreach (var item in bundleIds) { var row = Data.Tables[1].AsEnumerable().FirstOrDefault(d => d.Field <string>("BundleId") == item.Trim()); if (row != null) { BundleModel bun = new BundleModel(); bun.BundleId = row["BundleId"].ToString(); bun.Type = row["Type"].ToString(); bun.Name = row["Name"].ToString(); bun.Price = row["Price"].ToString(); bun.DAT = row["DAT"].ToString(); bun.TV = row["TV"].ToString(); bun.VOICE = row["VOICE"].ToString(); bun.ROUTER = row["ROUTER"].ToString(); bun.Discount = row["Discount"].ToString(); bun.Keyword = row["Keyword"].ToString(); bundles.Add(bun); } } } return(Json(JsonConvert.SerializeObject(bundles))); }
/// <summary>Get the translated name for a bundle's area.</summary> /// <param name="bundle">The bundle.</param> private string GetTranslatedBundleArea(BundleModel bundle) { switch (bundle.Area) { case "Pantry": return(L10n.BundleAreas.Pantry()); case "Crafts Room": return(L10n.BundleAreas.CraftsRoom()); case "Fish Tank": return(L10n.BundleAreas.FishTank()); case "Boiler Room": return(L10n.BundleAreas.BoilerRoom()); case "Vault": return(L10n.BundleAreas.Vault()); case "Bulletin Board": return(L10n.BundleAreas.BulletinBoard()); case "Abandoned Joja Mart": return(L10n.BundleAreas.AbandonedJojaMart()); default: return(bundle.Area); } }
/// <summary>Get the translated name for a bundle's area.</summary> /// <param name="bundle">The bundle.</param> private string GetTranslatedBundleArea(BundleModel bundle) { switch (bundle.Area) { case "Pantry": return(this.Translate(L10n.BundleAreas.Pantry)); case "Crafts Room": return(this.Translate(L10n.BundleAreas.CraftsRoom)); case "Fish Tank": return(this.Translate(L10n.BundleAreas.FishTank)); case "Boiler Room": return(this.Translate(L10n.BundleAreas.BoilerRoom)); case "Vault": return(this.Translate(L10n.BundleAreas.Vault)); case "Bulletin Board": return(this.Translate(L10n.BundleAreas.BulletinBoard)); default: return(bundle.Area); } }
private void AddBuckets(BundleModel bundle) { foreach (var bucket in _buckets) { bundle.AddBucket(bucket); } }
public async Task <BundleModel> GetSearchBundleModel(IList <ResourceStore> ResourceStoreList, Bug.Common.Enums.FhirVersion fhirVersion) { var IServiceBaseUrl = await IServiceBaseUrlCache.GetPrimaryAsync(fhirVersion); //Construct the History Bundle var BundleModel = new BundleModel(BundleType.Searchset) { Total = ResourceStoreList.Count }; BundleModel.Entry = new List <BundleModel.EntryComponent>(); foreach (var ResourceStore in ResourceStoreList) { var entry = new BundleModel.EntryComponent { FullUrl = new Uri($"{IServiceBaseUrl.Url}/{ResourceStore.ResourceId}") }; BundleModel.Entry.Add(entry); if (ResourceStore.ResourceBlob is object) { entry.Resource = IFhirResourceParseJsonService.ParseJson(ResourceStore.FhirVersionId, IGZipper.Decompress(ResourceStore.ResourceBlob)); } } return(BundleModel); }
/// <summary> /// Handles requests for bundles /// </summary> /// <param name="bundle">The bundle model</param> /// <returns></returns> public async Task <FileResult> Bundle( [FromServices] BundleModel bundle) { var found = _bundleManager.GetFiles(bundle.FileKey, Request); if (found == null || !found.Any()) { //TODO: Throw an exception, this will result in an exception anyways return(null); } //need to convert each file path to it's hash since that is what the minified file will be saved as var filePaths = found.Select(file => Path.Combine( _fileSystemHelper.CurrentCacheFolder, _hasher.Hash(file.FilePath) + bundle.Extension)); using (var resultStream = await GetCombinedStreamAsync(filePaths)) { var compressedStream = await Compressor.CompressAsync(bundle.Compression, resultStream); var compositeFilePath = await CacheCompositeFileAsync(bundle.FileKey, compressedStream, bundle.Compression); return(File(compressedStream, bundle.Mime)); } }
internal OrangeConstraintRepeater(ConstraintNetwork constraintNetwork, OrangeModelSolverMap modelSolverMap, BundleModel bundle, OrangeValueMapper theValueMapper) { _constraintNetwork = constraintNetwork; _modelSolverMap = modelSolverMap; _bundle = bundle; _valueMapper = theValueMapper; _arcBuilder = new ArcBuilder(_modelSolverMap, _valueMapper); }
/// <summary> /// Initialize an all different constraint editor view model with the bundle. /// </summary> public AllDifferentConstraintEditorViewModel(BundleModel theBundle) { _bundle = theBundle; Validator = new AllDifferentConstraintEditorViewModelValidator(); ConstraintName = string.Empty; SelectedVariable = string.Empty; Variables = new ObservableCollection <string>(); }
public BundleModelItemViewModel(BundleModel bundle, ModelEditorTabViewModel modelEditorTab) : base(bundle) { _modelEditorTab = modelEditorTab; Validator = new BundleModelItemValidator(); Bundle = bundle; DisplayName = Bundle.Name; }
public BundleModel Build() { var newBundle = new BundleModel(new ModelName(_name)); AddSingletons(newBundle); AddConstraints(newBundle); return(newBundle); }
public ActionResult Index(int id, bool?create) { var m = new BundleModel(id); if (m.Bundle == null) { return(Content("no bundle")); } return(View(m)); }
/// <summary> /// Initialize a workspace builder with a model name. /// </summary> public WorkspaceBuilder(string theModelName) { if (string.IsNullOrWhiteSpace(theModelName)) { throw new ArgumentException(nameof(theModelName)); } _workspace = new WorkspaceModel(new ModelName(theModelName)); _model = _workspace.Model; }
protected void ListView1_DataBound(object sender, EventArgs e) { var ctl = new BundleModel(); Total.Text = ctl.Total(peopleid, YearSearch.SelectedValue.ToInt(), StatusSearch.SelectedValue.ToInt(), TypeSearch.SelectedValue.ToInt(), FundSearch.SelectedValue.ToInt()) .ToString("c"); }
private void AddConstraints(BundleModel bundle) { foreach (var constraint in _constraints) { switch (constraint) { case AllDifferentConstraintModel allDifferentConstraint: bundle.AddAllDifferentConstraint(allDifferentConstraint); break; } } }
public AssetBundleRequest GetAssetAsync <T>(string uid, string assetName) where T : Object { for (int i = 0, max = bundleList.Count; i < max; i++) { BundleModel info = bundleList[i]; if (info.UID == uid) { return(info.bundle.LoadAssetAsync <T>(assetName)); } } return(null); }
public AssetBundle GetBundle(string uid) { for (int i = 0; i < bundleList.Count; i++) { BundleModel info = bundleList[i]; if (info.UID == uid) { return(info.bundle); } } return(null); }
public ActionResult Delete(int id) { var m = new BundleModel(id); var q = from d in m.Bundle.BundleDetails select d.Contribution; DbUtil.Db.Contributions.DeleteAllOnSubmit(q); DbUtil.Db.BundleDetails.DeleteAllOnSubmit(m.Bundle.BundleDetails); DbUtil.Db.BundleHeaders.DeleteOnSubmit(m.Bundle); DbUtil.Db.SubmitChanges(); return(Content("/Bundles")); }
public T GetAsset <T>(uint id, string assetName) where T : Object { for (int i = 0, max = bundleList.Count; i < max; i++) { BundleModel info = bundleList[i]; if (info.ID == id) { return(info.bundle.LoadAsset <T>(assetName)); } } return(null); }
/// <summary>Get the translated name for a bundle's area.</summary> /// <param name="bundle">The bundle.</param> private string GetTranslatedBundleArea(BundleModel bundle) { return(bundle.Area switch { "Pantry" => I18n.BundleArea_Pantry(), "Crafts Room" => I18n.BundleArea_CraftsRoom(), "Fish Tank" => I18n.BundleArea_FishTank(), "Boiler Room" => I18n.BundleArea_BoilerRoom(), "Vault" => I18n.BundleArea_Vault(), "Bulletin Board" => I18n.BundleArea_BulletinBoard(), "Abandoned Joja Mart" => I18n.BundleArea_AbandonedJojaMart(), _ => bundle.Area });
public void AddBundle(uint id, string url, uint version, BundleType type, AssetBundle bundle) { if (HasBundle(id)) { ZLog.Warning("add bundle failed!!!that had same bundle id = " + id + ";url = " + url); return; } BundleModel model = new BundleModel(url, version, type); model.bundle = bundle; model.ID = id; bundleList.Add(model); }
/// <summary>Read parsed data about the Community Center bundles.</summary> /// <param name="monitor">The monitor with which to log errors.</param> /// <remarks>Derived from the <see cref="StardewValley.Locations.CommunityCenter"/> constructor and <see cref="StardewValley.Menus.JunimoNoteMenu.openRewardsMenu"/>.</remarks> public IEnumerable <BundleModel> GetBundles(IMonitor monitor) { foreach ((string key, string value) in Game1.netWorldState.Value.BundleData) { BundleModel bundle; try { // parse key string[] keyParts = key.Split('/'); string area = keyParts[0]; int id = int.Parse(keyParts[1]); // parse bundle info string[] valueParts = value.Split('/'); string name = valueParts[0]; string reward = valueParts[1]; string displayName = LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.en ? name // field isn't present in English : valueParts.Last(); // number of fields varies, but display name is always last // parse ingredients List <BundleIngredientModel> ingredients = new List <BundleIngredientModel>(); string[] ingredientData = valueParts[2].Split(' '); for (int i = 0; i < ingredientData.Length; i += 3) { int index = i / 3; int itemID = int.Parse(ingredientData[i]); int stack = int.Parse(ingredientData[i + 1]); ItemQuality quality = (ItemQuality)int.Parse(ingredientData[i + 2]); ingredients.Add(new BundleIngredientModel(index, itemID, stack, quality)); } // create bundle bundle = new BundleModel( ID: id, Name: name, DisplayName: displayName, Area: area, RewardData: reward, Ingredients: ingredients.ToArray() ); } catch (Exception ex) { monitor.LogOnce($"Couldn't parse community center bundle '{key}' due to an invalid format.\nRecipe data: '{value}'\nError: {ex}", LogLevel.Warn); continue; } yield return(bundle); } }
public ActionResult Index(int id, bool?create) { var m = new BundleModel(id); if (User.IsInRole("FinanceDataEntry") && m.BundleStatusId != BundleStatusCode.OpenForDataEntry) { return(Redirect("/Bundles")); } if (m.Bundle == null) { return(Content("no bundle")); } return(View(m)); }
public AssetBundle[] GetBundles(BundleType type) { List <AssetBundle> bundles = new List <AssetBundle>(); for (int i = 0; i < bundleList.Count; i++) { BundleModel info = bundleList[i]; if (info.type == type) { bundles.Add(info.bundle); } } return(bundles.ToArray()); }
public AssetBundle GetBundle(string url, int version) { string keyName = url + "_" + version; for (int i = 0; i < bundleList.Count; i++) { BundleModel info = bundleList[i]; if (info.UID == keyName) { return(info.bundle); } } return(null); }