internal static void OnActiveProviderChanged(PropertyProvider provider) { if (ActiveProviderChanged != null) { ActiveProviderChanged(provider); } }
public ActionResult Edit(int Id) { if (!AuthorizationProvider.IsInquiryEditor() && !AuthorizationProvider.IsViewer()) { string message = string.Format("User '{0}' does not have permission to edit Inquiry {1}.", this.User.Identity.Name, Id.ToString()); DojoLogger.Warn(message, typeof(InquiryController)); return(RedirectToAction("Index", "Inquiry") .WithError("It looks like you do not have permisssion to edit this inquiry.")); } try { ViewBag.Title = "Edit Inquiry"; ViewBag.ButtonText = "Update Inquiry"; InquiryProvider inquiryProvider = new InquiryProvider(_dbContext); PropertyProvider propertyProvider = new PropertyProvider(_dbContext); InquiriesValidation inquiry = inquiryProvider.Retrieve(Id); if (inquiry == null) { return(RedirectToAction("NotFound", "Error")); } ViewBag.Properties = propertyProvider.AggregatedProperties(); return(PartialView("EditPartial", inquiry)); } catch (Exception ex) { string message = string.Format("Retrieve Inquiry {0} for Editing fails. {1}", Id.ToString(), ex.Message + ex.StackTrace); DojoLogger.Error(message, typeof(InquiryController)); } return(RedirectToAction("Index", "Inquiry") .WithError("The inquiry item cannot be found.")); }
public JsonResult GetPayoutMethods(DateTime month) { var provider = new PropertyProvider(_dbContext); var payoutMethodList = provider.PayoutMethods(month); return(Json(payoutMethodList, JsonRequestBehavior.AllowGet)); }
public JsonResult GetOwnerStatementPropertyList(DateTime month) { var provider = new PropertyProvider(_dbContext); var propertyList = provider.GetOwnerStatementPropertyList(month); return(Json(propertyList, JsonRequestBehavior.AllowGet)); }
public ActionResult Info(string Id) { try { ViewBag.Title = "View Property"; PropertyProvider dataProvider = new PropertyProvider(_dbContext); CPL property = dataProvider.Retrieve(Id); if (property == null) { return(RedirectToAction("NotFound", "Error")); } var account = new SelectListItem { Text = property.Account, Value = property.Account }; ViewBag.Accounts = new List <SelectListItem>(); ViewBag.Accounts.Add(account); return(View("Entry", property)); } catch (Exception ex) { // TODO: log } return(RedirectToAction("Index", "Property") .WithError("The property item cannot be found.")); }
public JsonResult GetOwnerPayoutAccounts(DateTime month) { var provider = new PropertyProvider(_dbContext); var accounts = provider.GetOwnerPayoutAccounts(month); return(Json(accounts, JsonRequestBehavior.AllowGet)); }
public JsonResult GetPropertyCodes() { var provider = new PropertyProvider(_dbContext); var propertyCodes = provider.GetPropertyCodes(); return(Json(propertyCodes, JsonRequestBehavior.AllowGet)); }
public ActionResult ModalEdit(String Id) { if (!AuthorizationProvider.IsPropertyEditor() && !AuthorizationProvider.IsViewer()) { return(RedirectToAction("Index", "Property") .WithError("It looks like you do not have permisssion to edit this property.")); } try { ViewBag.Title = "Edit Property"; ViewBag.ButtonText = "Update Property"; PropertyProvider dataProvider = new PropertyProvider(_dbContext); CPL property = dataProvider.Retrieve(Id); if (property == null) { return(RedirectToAction("NotFound", "Error")); } InitSelectFields(property); ViewBag.Accounts = (new AirbnbAccountProvider(_dbContext)).AggregatedAccounts(); return(PartialView("_PropertyFormPartial", property)); } catch (Exception) { // TODO: log } return(RedirectToAction("Index", "Property") .WithError("The property item cannot be found.")); }
public ActionResult ModalDetails(string Id) { if (!AuthorizationProvider.IsViewer()) { return(PartialView("DetailsPartial", new CPL())); } try { PropertyProvider propertyProvider = new PropertyProvider(_dbContext); ViewBag.Title = "View Property Details"; CPL details = propertyProvider.Retrieve(Id); if (details == null) { string message = string.Format("Property '{0}' not found.", Id); DojoLogger.Warn(message, typeof(PropertyController)); return(RedirectToAction("NotFound", "Error")); } return(PartialView("DetailsPartial", details)); } catch (Exception ex) { string message = string.Format("Retrieve Property Details fails. {0}", ex.Message); DojoLogger.Error(message, typeof(PropertyController)); } return(RedirectToAction("Index", "Property") .WithError("The Property cannot be found.")); }
public PartialViewResult Approve(InquiriesValidation form) { try { InquiryProvider inquiryProvider = new InquiryProvider(_dbContext); PropertyProvider propertyProvider = new PropertyProvider(_dbContext); InquiriesValidation inquiry = inquiryProvider.Retrieve(form.Id); form.CPL = propertyProvider.Retrieve(inquiry.PropertyCode); inquiry.Doesitrequire2pricingteamapprovals = form.Doesitrequire2pricingteamapprovals; inquiry.PricingApprover1 = form.PricingApprover1; inquiry.PricingApprover2 = form.PricingApprover2; inquiry.PricingDecision1 = form.PricingDecision1; inquiry.PricingReason1 = form.PricingReason1; inquiry.ApprovedbyOwner = form.ApprovedbyOwner; inquiryProvider.Update(inquiry.Id, inquiry); inquiryProvider.Commit(); } catch (Exception ex) { // TODO: Log error this.ModelState.AddModelError("", ex); } return(PartialView("ApprovePartial", form)); }
public void FromValue_should_return_self_if_already_property_provider() { var existing = new Properties(); var pp = PropertyProvider.FromValue(existing); Assert.Same(existing, pp); }
public JsonResult RetrieveProperties(DateTime beginDate, DateTime endDate) { PropertyProvider dataProvider = new PropertyProvider(_dbContext); var Properties = dataProvider.Retrieve(beginDate, endDate); return(Json(Properties, JsonRequestBehavior.AllowGet)); }
public void TryGetProperty_should_return_false_on_KeyNotFoundException() { var pp = PropertyProvider.FromValue(new A()); object dummy; Assert.False(pp.TryGetProperty("S", out dummy)); }
public void TryPopulateModel(object model, IParameterCollection parameterCollection) { if (parameterCollection == null) { throw new ArgumentNullException("parameterCollection"); } var errors = new Dictionary <string, Exception>(); ICachedType type = PropertyProvider.Get(model.GetType()); foreach (IParameter parameter in parameterCollection) { try { object value = parameter.Value; type.SetConvertedValue(model, parameter.Name, value); } catch (Exception err) { errors[parameter.Name] = err; } } if (errors.Count != 0) { throw new PropertyException(errors); } }
/// <summary> /// Create instances of SampleClassificationObjectType, adding them to the private objects collection. /// </summary> /// <param name="entry"></param> private void ProcessResourceEntry(SampleResourceEntry entry) { // Create Property provider by matching property adapters with data sources // PropertyProvider is called by ResourceStaticAnalysis when code attempts to retrieve a property that has not yet been created var pp = new PropertyProvider(); // Add a pair: property adapter and an object that serves as source foreach (var adapter in resourceFilePropertyAdapters) { pp.AddPropertyAdapterDataSourcePair(adapter, entry); } // Initialize an instance of SampleClassificationObjectType using the PropertyProvider built above var obj = new SampleClassificationObjectType(pp); foreach (var adapter in selfPropertyAdapters) { // Now, add one more poperty adapter that uses the SampleClassificationObjectType object itself as data source // this one builds properties from existing properties. pp.AddPropertyAdapterDataSourcePair(adapter, obj); } // This reduces amount of memory used by object by compacting internal representation. pp.Compact(); // Add to the list of all objects being constructed by this adapter. objects.Add(obj); }
public void UnitTest_GetAll_Returns_ListOfProperties() { var dummyData = new List <usp_GetAllProperties_Result> { new usp_GetAllProperties_Result() { PropertyID = 1, Location = "111 street", Bedroom = 3, Bathroom = 2, ConfidentialNotes = null, Status = 1 }, new usp_GetAllProperties_Result() { PropertyID = 2, Location = "222 street", Bedroom = 3, Bathroom = 1, ConfidentialNotes = null, Status = 2 }, new usp_GetAllProperties_Result() { PropertyID = 3, Location = "333 street", Bedroom = 5, Bathroom = 3, ConfidentialNotes = null, Status = 4 } }; var mockedObjectResult = new Mock <ObjectResult <usp_GetAllProperties_Result> >(); mockedObjectResult.Setup(x => x.GetEnumerator()).Returns(dummyData.GetEnumerator()); mockUnitOfWork.Setup(x => x.GetDB().usp_GetAllProperties()).Returns(mockedObjectResult.Object); PropertyProvider provider = new PropertyProvider(mockUnitOfWork.Object); var result = provider.GetAll(); Assert.AreEqual(3, result.Count()); }
public ActionResult CreatePropertyProvider(PropertyProvider pp) { //Console.WriteLine(Request.Path); Console.WriteLine(pp); Console.WriteLine(pp); Random rand = new Random(); // pp.Id = (ushort)(rand.Next()/1000); mur.CreatePropertyProvider(pp); Console.WriteLine(pp); Console.WriteLine(pp); /* * foreach (var prop in pp.Properties) { * mur.CreateProperty(prop); * } * * foreach (var ppic in pp.PropertyProviderPictures) * { * mur.CreatePropertyProviderPicture(ppic); * } */ //return Ok(pp); Console.WriteLine("Wohoo"); return(Created("https://localhost:5001/jeff/bezos/pp/", pp)); }
public bool animateTo <T>( string id, PropertyProvider <T> target, float delay = 0, float?duration = null, PropertyProvider <T> from = null, Curve curve = null) where T : class { var obj = getObject(id); if (obj == null) { return(false); } if (obj is MovieClipObjectWithProperty <T> objWithProperty) { var f = objWithProperty.getProperty(timestamp + delay); objWithProperty.animateTo( target: target(f), startTime: timestamp + delay, duration: duration ?? _defaultDuration, from: @from?.Invoke(f), curve: curve); return(true); } return(false); }
public void UnitTest_UpdateExistingProperty() { var dummyData = new List <usp_GetPropertyById_Result> { new usp_GetPropertyById_Result() { PropertyID = 1, Location = "123 street", Bedroom = 2, Bathroom = 1, ConfidentialNotes = null, Status = 1 }, }; var mockedObjectResult = new Mock <ObjectResult <usp_GetPropertyById_Result> >(); mockedObjectResult.Setup(x => x.GetEnumerator()).Returns(dummyData.GetEnumerator()); mockUnitOfWork.Setup(x => x.GetDB().usp_InsertSingleProperty("111 street", 2, 1, null, 1, false, DateTime.Now, DateTime.Now)); mockUnitOfWork.Setup(x => x.GetDB().usp_UpdateProperty(1, "123 street", 2, 1, null, 1, false, DateTime.Now)); mockUnitOfWork.Setup(x => x.GetDB().usp_GetPropertyById(1)).Returns(mockedObjectResult.Object); PropertyProvider provider = new PropertyProvider(mockUnitOfWork.Object); var newProerty = provider.CreateProperty(new Model.PropertyDtoModel { PropertyID = 1, Location = "111 street", Bedroom = 2, Bathroom = 1, ConfidentialNotes = null, Status = 1 }); var updatedModel = provider.UpdateProperty(new Model.PropertyDtoModel { PropertyID = 1, Location = "123 street", Bedroom = 2, Bathroom = 1, ConfidentialNotes = null, Status = 1 }); var result = provider.GetById(updatedModel.PropertyID); Assert.AreEqual("123 street", result.Location); }
public bool animateTo <T>( string id, string paramName, PropertyProvider <T> target, float delay = 0, float?duration = null, PropertyProvider <T> from = null, Curve curve = null) where T : class { var obj = getObject(id); if (obj == null) { return(false); } if (obj is BuilderMovieClipObject builderObject) { var f = builderObject.getParameter(paramName, timestamp + delay) as T; return(builderObject.animateTo( paramName, target: target(f), startTime: timestamp + delay, duration: duration ?? _defaultDuration, useFrom: from != null, from: @from?.Invoke(f), curve: curve)); } return(false); }
public PropertyProvider GetPropertyProvider(string username, string password) { PropertyProvider propertyProvider = null; try { propertyProvider = PropertyProviders.Find(x => x.Email == username && x.Password == password).Single(); /* * if (propertyProvider == null) * { * throw new NullReferenceException(); * } */ } catch (KeyNotFoundException knfe) { Console.WriteLine("An exception has occured \n Here are some details " + knfe); return(propertyProvider); } catch (Exception e) { Console.WriteLine("An exception has occured \n Here are some details " + e); return(propertyProvider); } return(propertyProvider); }
public JsonResult GetPropertyCodeWithAddress(DateTime month) { var provider = new PropertyProvider(_dbContext); var data = provider.GetPropertyCodeWithAddress("Expense", month); return(Json(data, JsonRequestBehavior.AllowGet)); }
public ActionResult <PropertyProvider> GetPropertyProvider(string username, string password) { HttpContext context = Request.HttpContext; // var url = context.Request.G string url = Microsoft.AspNetCore.Http.Extensions.UriHelper.GetEncodedUrl(context.Request); if (username == null || password == null) { return(NotFound()); } string[] parts = url.Split('?'); string pathString = parts[0]; Console.WriteLine(username); Console.WriteLine(username); Console.WriteLine(password); Console.WriteLine(password); string queryString = parts[1]; string[] queryParameters = queryString.Split('='); PropertyProvider pp = null; pp = mur.GetPropertyProvider(username, password); if (pp == null) { return(NotFound()); } else { return(Ok(pp)); } }
private void InnerExecute() { var path = DestinationFolder.FullPath(); Directory.CreateDirectory(path); var propertyProvider = new PropertyProvider() { { "version", GitVersionInformation.NuGetVersionV2 } }; var packageBuilder = new PackageBuilder(); using (var spec = File.OpenRead(NuSpecFile.FullPath())) { var manifest = Manifest.ReadFrom(spec, propertyProvider, false); packageBuilder.Populate(manifest.Metadata); } packageBuilder.PopulateFiles("", new[] { new ManifestFile { Source = ReferenceLibrary.FullPath(), Target = "lib" } }); var debug = Path.ChangeExtension(ReferenceLibrary.FullPath(), ".pdb"); if (File.Exists(debug)) { packageBuilder.PopulateFiles("", new[] { new ManifestFile { Source = debug, Target = "lib" } }); } if (File.Exists(PackagesConfig.FullPath())) { var dependencies = new List <PackageDependency>(); var doc = XDocument.Load(PackagesConfig.FullPath()); var packages = doc.Descendants() .Where(x => x.Name == "package" && x.Attribute("developmentDependency")?.Value != "true") .Select(p => new { id = p.Attribute("id").Value, version = SemanticVersion.Parse(p.Attribute("version").Value) }) .Select(p => new PackageDependency(p.id, new VersionSpec() { IsMinInclusive = true, MinVersion = p.version })); dependencies.AddRange(packages); packageBuilder.DependencySets.Add(new PackageDependencySet(null, dependencies)); } var packagePath = Path.Combine(path, packageBuilder.GetFullName() + ".nupkg"); using (var file = new FileStream(packagePath, FileMode.Create)) { Log.LogMessage($"Saving file {packagePath}"); packageBuilder.Save(file); } }
static void Main(string[] args) { var path = ""; if (args.Length == 1) { path = Path.GetFullPath(args[0]); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } } Environment.CurrentDirectory = Path.GetDirectoryName(typeof(Program).Assembly.Location); var propertyProvider = new PropertyProvider() { { "version", GitVersionInformation.NuGetVersionV2 } }; var packageBuilder = new PackageBuilder(); using (var spec = File.OpenRead(Path.Combine("Assets", "Costura.Fody.nuspec"))) { var manifest = Manifest.ReadFrom(spec, propertyProvider, false); packageBuilder.Populate(manifest.Metadata); } packageBuilder.PopulateFiles("", new[] { new ManifestFile { Source = "Costura.Fody.dll", Target = "" }, new ManifestFile { Source = "Costura.Fody.pdb", Target = "" } }); packageBuilder.PopulateFiles("Assets", new[] { new ManifestFile { Source = "Costura.Fody.targets", Target = "build" }, new ManifestFile { Source = "install.ps1", Target = "tools" }, new ManifestFile { Source = "uninstall.ps1", Target = "tools" } }); var packagePath = Path.Combine(path, packageBuilder.GetFullName() + ".nupkg"); using (var file = new FileStream(packagePath, FileMode.Create)) { Console.WriteLine($"Saving file {packagePath}"); packageBuilder.Save(file); } }
public PropertyProvider GetPropertyProvider(int id) { PropertyProvider pp = null; ushort Id = (ushort)(id); propertyProviders.TryGetValue(Id, out pp); return(pp); }
public void Format_parse_and_render_string_format() { var pp = PropertyProvider.FromValue(new { planet = "Phazon", }); Assert.Equal("Hello, Phazon", PropertyProvider.Format("Hello, ${planet}", pp)); }
public void NewShouldBeReturned() { var provider = new PropertyProvider(); var properties = provider.GetProperties(typeof(ID)); properties.Select(x => x.Name).ShouldBe(new[] { "D" }); properties.Select(x => x.DeclaringType).ShouldBe(new[] { typeof(ID) }); }
public void GetProperty_will_access_item_by_name() { var pp = new PropertyProviderCollection(); pp["name"] = PropertyProvider.FromArray(0, 1); Assert.Equal(1, pp.GetProperty("1")); Assert.Equal(typeof(int), ((IPropertyProvider)pp).GetPropertyType("1")); }
public void FromValue_can_enumerate_key_value_pairs() { var pp = PropertyProvider.FromArray("a", "c"); Assert.Equal(new [] { KeyValuePair.Create("0", (object)"a"), KeyValuePair.Create("1", (object)"c"), }, ((IEnumerable <KeyValuePair <string, object> >)pp).ToArray()); }
private void ExecuteBuildNuGetPackages(BuildConfiguration configuration) { foreach (var buildNuGetPackage in configuration.BuildNuGetPackages) { try { var properties = new PropertyProvider(); string version = buildNuGetPackage.Version; if (version == null) version = VersionRetriever.GetVersion(TargetPath); properties.Properties["version"] = version; string manifest = TranslatePath(buildNuGetPackage.Manifest); var builder = new PackageBuilder( manifest, buildNuGetPackage.BasePath ?? TargetDir, properties, false ); string target = buildNuGetPackage.Target != null ? TranslatePath(buildNuGetPackage.Target) : Path.Combine(TargetDir, Path.GetFileNameWithoutExtension(manifest) + "." + version + ".nupkg"); bool isExistingPackage = File.Exists(target); try { using (Stream stream = File.Create(target)) { builder.Save(stream); } } catch { if (!isExistingPackage && File.Exists(target)) File.Delete(target); throw; } } catch (Exception ex) { Log.LogErrorFromException(ex); } } }
public ProviderInstance(IPropertyProvider provider) { myInstance = provider; myDelegate = null; }
void IPropertyProviderService.AddOrRemovePropertyProvider(Type extendableElementType, PropertyProvider provider, bool includeSubtypes, EventHandlerAction action) { if ((object)provider == null) { throw new ArgumentNullException("provider"); } AddOrRemovePropertyProvider(extendableElementType, new ProviderInstance(provider), includeSubtypes, action); }
/// <summary> /// </summary> /// <param name = "propertyProvider">provides all important properties of the decomposed object</param> public PropertyFactory(PropertyProvider propertyProvider) { _propertyProvider = propertyProvider; }