/// <summary>Either creates a siamese of the given <code>Convolution</code> instance or clones it.</summary> /// <param name="original">The original instance to be created a siamese of or cloned.</param> /// <param name="siamese"><code>true</code> if a siamese is to be created, <code>false</code> otherwise.</param> protected Convolution(Convolution original, bool siamese) { this.inputDepth = original.InputDepth; this.inputWidth = original.InputWidth; this.inputHeight = original.inputHeight; this.outputDepth = original.OutputDepth; this.outputWidth = original.OutputWidth; this.outputHeight = original.OutputHeight; this.padding = original.padding; this.kernelSide = original.kernelSide; this.stride = original.stride; this.scale = original.scale; if (siamese) { this.biases = original.biases; this.biasesDeltas = original.biasesDeltas; this.biasesMomentums = original.biasesMomentums; this.kernelFilters = original.kernelFilters; this.kernelGradients = original.kernelGradients; this.kernelMomentums = original.kernelMomentums; this.siameseID = original.SiameseID; } else { this.biases = Backbone.CreateArray <float>(original.OutputDepth); this.biasesDeltas = Backbone.CreateArray <float>(original.OutputDepth); this.biasesMomentums = Backbone.CreateArray <float>(original.OutputDepth); this.kernelFilters = Backbone.CreateArray <float>(original.OutputDepth, inputDepth * kernelSide * kernelSide); Backbone.RandomizeMatrix(this.kernelFilters, original.OutputDepth, inputDepth * kernelSide * kernelSide, 2.0F / (inputDepth * kernelSide * kernelSide + outputDepth)); this.kernelGradients = Backbone.CreateArray <float>(original.OutputDepth, inputDepth * kernelSide * kernelSide); this.kernelMomentums = Backbone.CreateArray <float>(original.OutputDepth, inputDepth * kernelSide * kernelSide); this.siameseID = new object(); } }
/// <summary> /// Configures Rebus to establish an <see cref="IPrincipal"/> and set it on <see cref="Thread.CurrentPrincipal"/> /// if the special <see cref="Headers.UserName"/> header is present. It will only be set if the user name header /// is present and if the value does in fact contain something. /// </summary> public RebusBehaviorConfigurer SetCurrentPrincipalWhenUserNameHeaderIsPresent() { Backbone.ConfigureEvents(e => { e.MessageContextEstablished += (bus, context) => { // if no user name header is present, just bail out if (!context.Headers.ContainsKey(Headers.UserName)) { return; } var userName = context.Headers[Headers.UserName].ToString(); // only accept user name if it does in fact contain something if (string.IsNullOrWhiteSpace(userName)) { return; } // be sure to store the current principal to be able to restore it later var currentPrincipal = Thread.CurrentPrincipal; context.Disposed += () => Thread.CurrentPrincipal = currentPrincipal; // now set the principal for the duration of the message context var principalForThisUser = new GenericPrincipal(new GenericIdentity(userName), new string[0]); Thread.CurrentPrincipal = principalForThisUser; }; }); return(this); }
public ActionResult ResetPassword(ResetPasswordViewModel forgot) { if (TempData["ForgotPasswordEmail"] != null && !string.IsNullOrWhiteSpace(forgot.Email)) { if (ModelState.IsValid) { photogEntities db = new photogEntities(); var users = db.Users.FirstOrDefault(x => x.email.ToLower() == forgot.Email.ToLower()); if (users != null) { var passwordHash = Backbone.ComputeSha256Hash(forgot.Password); users.password = passwordHash; db.SaveChanges(); TempData["ResetPasswordSuccess"] = "1"; return(RedirectToAction("SignIn", "Account")); } } else { TempData.Keep("ForgotPasswordEmail"); return(View(forgot)); } } return(RedirectToAction("Index", "Home")); }
public void ProcessOrder(OrderData orderData) { try { var commerceContext = new CommerceContext { OrderData = orderData, MailingProvider = this._mailingProvider, PaymentProvider = this._paymentProvider, StoreRepository = this._storeRepository, ShippingProvider = this._shippingProvider, CommerceEvents = this._commerceEvents }; var backbone = new Backbone <CommercePipelineEvents, CommerceContext>("commerce"); backbone.Execute(backbone.Initialize(), commerceContext); } catch (Exception ex) { // 7 if (this._commerceEvents.SendNotification != null) { var args = new SendNotificationEventArgs(orderData, this._mailingProvider); this._commerceEvents.SendNotification(args); } throw new Exception(ex.Message); } }
public IActionResult GetProduct(string sort = "name", string name = null, string fields = null, int page = 1, int pageSize = maxPageSize) { var pipelineContext = new GetProductsPipelineContext() { Input = new RequestInput() { Name = name, Fields = fields, Page = page, PageSize = pageSize }, Dbcontext = _context, Mapper = _mapper, DataShapeFactory = _dataShapeFactory }; var modules = from type in Assembly.GetExecutingAssembly().GetTypes() where typeof(IGetProducts).IsAssignableFrom(type) && !type.IsInterface select type; var backbone = new Backbone <GetProductsEvent>(modules); try { backbone.Execute(pipelineContext); } catch (Exception ex) { _logger.LogError(ex.Message); return(StatusCode(500)); } HttpContext.Response.Headers.Add("X-Pagination", pipelineContext.Pagination); return(Ok(pipelineContext.Data)); }
/// <summary>Creates an instance of the <code>RandomConvolution</code> class.</summary> /// <param name="inputDepth">The input depth.</param> /// <param name="inputWidth">The input width.</param> /// <param name="inputHeight">The input height.</param> /// <param name="depth">The output depth.</param> /// <param name="kernelSide">The kernel side.</param> /// <param name="stride">The stride.</param> /// <param name="padding">Whether padding is to be used.</param> /// <param name="createIO">Whether the input image and the output image of the layer are to be created.</param> public RandomConvolution(int inputDepth, int inputWidth, int inputHeight, int depth, int kernelSide, int stride, bool padding, bool createIO = false) { this.inputDepth = inputDepth; this.inputWidth = inputWidth; this.inputHeight = inputHeight; this.outputDepth = depth; if (padding) { this.outputWidth = inputWidth; this.outputHeight = inputHeight; this.padding = (kernelSide - 1) / 2; } else { this.outputWidth = inputWidth - kernelSide + 1; this.outputHeight = inputHeight - kernelSide + 1; this.padding = 0; } if (createIO) { this.input = new Image(inputDepth, inputWidth, inputHeight); this.output = new Image(outputWidth, outputWidth, outputHeight); } this.kernelFilters = Backbone.CreateArray <float>(depth, inputDepth * kernelSide * kernelSide); this.kernelSide = kernelSide; this.stride = stride; this.siameseID = new object(); }
/// <summary>Creates an instance of the <code>Convolution</code> class.</summary> /// <param name="inputDepth">The depth of the input of the layer.</param> /// <param name="inputWidth">The width of the input of the layer.</param> /// <param name="inputHeight">The height of the input of the layer.</param> /// <param name="depth">The depth of the output of the layer.</param> /// <param name="kernelSide">The side of the kernel to be used.</param> /// <param name="stride">The stride to be used.</param> /// <param name="scale">The scale factor.</param> /// <param name="padding"><code>true</code> if padding is to be used, <code>false</code> otherwise.</param> /// <param name="createIO">Whether the input image and the output image of the layer are to be created.</param> public Convolution(int inputDepth, int inputWidth, int inputHeight, int depth, int kernelSide, bool padding, int stride = 1, int scale = 1, bool createIO = false) { this.inputDepth = inputDepth; this.inputWidth = inputWidth; this.inputHeight = inputHeight; this.outputDepth = depth; if (padding) { this.outputWidth = inputWidth * scale; this.outputHeight = inputHeight * scale; this.padding = (kernelSide - 1) / 2; } else { this.outputWidth = inputWidth * scale - kernelSide + 1; this.outputHeight = inputHeight * scale - kernelSide + 1; this.padding = 0; } if (createIO) { this.input = new Image(inputDepth, inputWidth, inputHeight); this.output = new Image(outputDepth, outputWidth, outputHeight); } this.biases = Backbone.CreateArray <float>(depth); this.biasesDeltas = Backbone.CreateArray <float>(depth); this.biasesMomentums = Backbone.CreateArray <float>(depth); this.kernelFilters = Backbone.CreateArray <float>(depth, inputDepth * kernelSide * kernelSide); Backbone.RandomizeMatrix(this.kernelFilters, depth, inputDepth * kernelSide * kernelSide, 2.0F / (inputDepth * kernelSide * kernelSide + outputDepth)); this.kernelGradients = Backbone.CreateArray <float>(depth, inputDepth * kernelSide * kernelSide); this.kernelMomentums = Backbone.CreateArray <float>(depth, inputDepth * kernelSide * kernelSide); this.kernelSide = kernelSide; this.stride = stride; this.scale = scale; this.siameseID = new object(); }
public bool DeleteBackbone(Backbone backbone) { ListDictionary param = new ListDictionary(); param.Add("BackboneId", backbone.BackboneId); var result = DataAccess.ExecuteSPNonQuery(DataAccess.ConnectionStrings.Ansira, "DeleteBackbone", param); return(Convert.ToBoolean(result)); }
/// <summary> /// Uses the specified implementation of <see cref="IReceiveMessages"/> to receive messages /// </summary> public void UseReceiver(IReceiveMessages receiveMessages) { Backbone.ReceiveMessages = receiveMessages; // if we see the OneWayClientGag, the bus will not be able to receive messages // - therefore, we configure the behavior if (receiveMessages is OneWayClientGag) { Backbone.AddConfigurationStep(s => s.AdditionalBehavior.EnterOneWayClientMode()); } }
/// <summary>Create an instance of the <code>ArrayToImage</code> class.</summary> /// <param name="outputDepth">The depth of the output of the layer.</param> /// <param name="outputWidth">The width of the output of the layer.</param> /// <param name="outputHeight">The height of the output of the layer.</param> /// <param name="createIO">Whether the input array and the output image of the layer are to be created.</param> public ArrayToImage(int outputDepth, int outputWidth, int outputHeight, bool createIO = false) { this.inputSize = outputDepth * outputWidth * outputHeight; this.outputDepth = outputDepth; this.outputWidth = outputWidth; this.outputHeight = outputHeight; if (createIO) { this.SetInputGetOutput(Backbone.CreateArray <float>(this.inputSize)); } this.siameseID = new object(); }
public bool CreateBackbone(Backbone backbone) { //List Dictionary object for parameters of Store procedure ListDictionary param = new ListDictionary(); param.Add("BackboneName", backbone.BackboneName); param.Add("CreatedBy", backbone.CreatedBy); param.Add("CreateTs", backbone.CreateTs); var result = DataAccess.ExecuteSPNonQuery(DataAccess.ConnectionStrings.Ansira, "CreateBackbone", param); return(Convert.ToBoolean(result)); }
/// <summary>Creates an instance of the <code>ConvolutionalNN</code> class.</summary> /// <param name="firstPart">The first part of the convolutional neural network.</param> /// <param name="fnn">The second part of the convolutional neural network.</param> /// <param name="createIO">Whether the input image and the output array of the network are to be created.</param> public ConvolutionalNN(PurelyConvolutionalNN firstPart, FeedForwardNN fnn, bool createIO = true) { this.firstPart = firstPart; this.i2a = new ImageToArray(firstPart.OutputDepth, firstPart.OutputWidth, firstPart.OutputHeight, false); this.fnn = fnn; this.errorArray = Backbone.CreateArray <float>(firstPart.OutputDepth * firstPart.OutputWidth * firstPart.OutputHeight); this.errorImage = new Image(this.firstPart.OutputDepth, this.firstPart.OutputWidth, this.firstPart.OutputHeight); if (createIO) { this.SetInputGetOutput(new Image(firstPart.InputDepth, firstPart.InputWidth, firstPart.InputHeight)); } this.siameseID = new object(); }
public bool UpdateBackbone(Backbone backbone) { ListDictionary param = new ListDictionary(); param.Add("BackboneName", backbone.BackboneName); param.Add("BackboneId", backbone.BackboneId); param.Add("UpdatedBy", backbone.UpdatedBy); param.Add("UpdateTs", backbone.UpdateTs); param.Add("IsActive", backbone.IsActive); var result = DataAccess.ExecuteSPNonQuery(DataAccess.ConnectionStrings.Ansira, "UpdateBackbone", param); return(Convert.ToBoolean(result)); }
private void ConfigureEvents() { Backbone.ConfigureEvents( e => e.MessageSent += (messageBus, destination, message) => OffloadDataBusProperties(DataBusPropertyOffloader, destination, message)); Backbone.ConfigureEvents( e => e.BeforeMessage += (messageBus, message) => LoadDataBusProperties(DataBusPropertyLoader, message)); Backbone.ConfigureEvents(e => e.BusStarted += messageBus => ApplyRecoredSettings()); }
private float[] data; // [depth, width, height] /// <summary>Creates an instance of the <code>Image</code> class.</summary> /// <param name="depth">The depth of the image.</param> /// <param name="width">The width of the image.</param> /// <param name="height">The height of the image.</param> /// <param name="c">Wether to use an array to encode the image.</param> public Image(int depth, int width, int height, bool c = false) { this.depth = depth; this.width = width; this.height = height; if (c) { this.data = new float[depth * width * height]; } else { this.data = Backbone.CreateArray <float>(depth * width * height); } }
/// <summary>Creates an instance of the <code>ImageDropoutLayer</code> class.</summary> /// <param name="depth">The depth of the layer.</param> /// <param name="width">The width of the layer.</param> /// <param name="height">The height of the layer.</param> /// <param name="dropChance">The dropout chance of the layer.</param> /// <param name="createIO">Whether the input image and the output image of the layer are to be created.</param> public ImageDropoutLayer(int depth, int width, int height, float dropChance, bool createIO = false) { this.depth = depth; this.width = width; this.height = height; if (createIO) { this.input = new Image(depth, width, height); this.output = new Image(depth, width, height); } this.dropped = Backbone.CreateArray <bool>(depth * width * height); this.dropChance = dropChance; this.siameseID = new object(); }
/// <summary>Creates an instance of the <code>DeConvolutionalNN</code> class.</summary> /// <param name="firstPart">First part of the network.</param> /// <param name="cnn">Second part of the network.</param> /// <param name="createIO">Whether the input array and the output image of the netwok are to be created.</param> public DeConvolutionalNN(FeedForwardNN firstPart, PurelyConvolutionalNN cnn, bool createIO = true) { this.firstPart = firstPart; this.a2i = new ArrayToImage(cnn.InputDepth, cnn.InputWidth, cnn.InputHeight, false); this.cnn = cnn; this.errorArray = Backbone.CreateArray <float>(cnn.InputDepth * cnn.InputWidth * cnn.InputHeight); this.errorImage = new Image(cnn.InputDepth, cnn.InputWidth, cnn.InputHeight); this.layersConnected = false; if (createIO) { this.SetInputGetOutput(Backbone.CreateArray <float>(firstPart.InputSize)); } this.siameseID = new object(); }
/// <summary>Either creates a siamese of the given <code>ImageDropoutLayer</code> instance or clones it.</summary> /// <param name="original">The original instance to be created a siamese of or cloned.</param> /// <param name="siamese"><code>true</code> if a siamese is to be created, <code>false</code> if a clone is.</param> protected ImageDropoutLayer(ImageDropoutLayer original, bool siamese) { this.depth = original.Depth; this.width = original.width; this.height = original.Height; this.dropped = Backbone.CreateArray <bool>(depth * width * height); this.dropChance = original.DropChance; if (siamese) { this.siameseID = original.SiameseID; } else { this.siameseID = new object(); } }
public IStartableBus CreateBus() { VerifyComponents(Backbone); FillInDefaults(Backbone); Backbone.ApplyDecorators(); var bus = new RebusBus(Backbone.ActivateHandlers, Backbone.SendMessages, Backbone.ReceiveMessages, Backbone.StoreSubscriptions, Backbone.StoreSagaData, Backbone.DetermineDestination, Backbone.SerializeMessages, Backbone.InspectHandlerPipeline, Backbone.ErrorTracker); Backbone.TransferEvents(bus); Backbone.Adapter.SaveBusInstances(bus, bus); return(bus); }
static void Main(string[] args) { try { // Sales order example var pipelineContext = new SalesOrderPipelineContext() { StoreRepository = new StoreRepository(), PaymentProcessor = new PaymentProcessor(), }; var modules = from type in Assembly.GetExecutingAssembly().GetTypes() where typeof(ISalesOrder).IsAssignableFrom(type) && !type.IsInterface select type; var backbone = new Backbone <SalesOrderPipelineEvent>(modules); backbone.Execute(pipelineContext); #region purchase /* Purchase example * var purchasePipelineContext = new PurchaseContext() * { * StoreRepository = new StoreRepository(), * PaymentProcessor = new PaymentProcessor(), * }; * * * var backbonePurchase = new Backbone<PurchasePipelineEvent>(new List<Type>(){ typeof(PurchaseOrder), typeof(PurchaseSupplier) }); * * backbonePurchase.Execute(purchasePipelineContext); */ #endregion Console.ReadKey(); } catch (Exception ex) { Console.Write(ex.Message); Console.ReadKey(); } }
/// <summary> /// Creates the bus by using all the configured implementations from the backbone, running configured decoration /// steps /// </summary> public IStartableBus CreateBus() { VerifyComponents(Backbone); FillInDefaults(Backbone); Backbone.ApplyDecorators(); var bus = new RebusBus(Backbone.ActivateHandlers, Backbone.SendMessages, Backbone.ReceiveMessages, Backbone.StoreSubscriptions, Backbone.StoreSagaData, Backbone.DetermineMessageOwnership, Backbone.SerializeMessages, Backbone.InspectHandlerPipeline, Backbone.ErrorTracker, Backbone.StoreTimeouts, Backbone.AdditionalBehavior); Backbone.TransferEvents(bus); Backbone.FinishConfiguration(bus); return(bus); }
/// <summary>Either creates a siamese or clones the given <code>DeConvolutionalNN</code> instance.</summary> /// <param name="original">The original instance to be created a siamese of or cloned.</param> /// <param name="siamese"><code>true</code> if a siamese is to be created, <code>false</code> if a clone is.</param> protected DeConvolutionalNN(DeConvolutionalNN original, bool siamese) { this.errorArray = Backbone.CreateArray <float>(original.cnn.InputDepth * original.cnn.InputWidth * original.cnn.InputHeight); this.errorImage = new Image(original.cnn.InputDepth, original.cnn.InputWidth, original.cnn.InputHeight); this.layersConnected = false; if (siamese) { this.firstPart = (FeedForwardNN)original.firstPart.CreateSiamese(); this.a2i = (ArrayToImage)original.a2i.CreateSiamese(); this.cnn = (PurelyConvolutionalNN)original.cnn.CreateSiamese(); this.siameseID = original.SiameseID; } else { this.firstPart = (FeedForwardNN)original.firstPart.Clone(); this.a2i = (ArrayToImage)original.a2i.Clone(); this.cnn = (PurelyConvolutionalNN)original.cnn.Clone(); this.siameseID = new object(); } }
/// <summary>Either creates a siamese of the given <code>ConvolutionalNN</code> instance or clones it.</summary> /// <param name="original">The original instance to be created a siamese of or cloned.</param> /// <param name="siamese"><code>true</code> if a siamese is to be created, <code>false</code> otherwise.</param> protected ConvolutionalNN(ConvolutionalNN original, bool siamese) { this.errorArray = Backbone.CreateArray <float>(firstPart.OutputDepth * firstPart.OutputWidth * firstPart.OutputHeight); this.errorImage = new Image(this.firstPart.OutputDepth, this.firstPart.OutputWidth, this.firstPart.OutputHeight); this.layersConnected = false; if (siamese) { this.firstPart = (PurelyConvolutionalNN)original.CreateSiamese(); this.i2a = (ImageToArray)original.i2a.CreateSiamese(); this.fnn = (FeedForwardNN)original.fnn.CreateSiamese(); this.siameseID = original.SiameseID; } else { this.firstPart = (PurelyConvolutionalNN)original.firstPart.Clone(); this.i2a = (ImageToArray)original.i2a.Clone(); this.fnn = (FeedForwardNN)original.fnn.Clone(); this.siameseID = new object(); } }
/// <summary>Either creates a siamese of the given <code>RandomConvolution</code> instance or clones it.</summary> /// <param name="original">The original instance to be created a siamese of or cloned.</param> /// <param name="siamese"><code>true</code> if a siamese is to be created, <code>false</code> if a clone is.</param> protected RandomConvolution(RandomConvolution original, bool siamese) { this.inputDepth = original.InputDepth; this.inputWidth = original.InputWidth; this.inputHeight = original.InputHeight; this.outputDepth = original.OutputDepth; this.outputWidth = original.OutputWidth; this.outputHeight = original.OutputHeight; this.padding = original.padding; this.kernelFilters = Backbone.CreateArray <float>(original.OutputDepth, original.InputDepth * original.KernelSide * original.KernelSide); this.kernelSide = original.KernelSide; this.stride = original.Stride; if (siamese) { this.siameseID = original.SiameseID; } else { this.siameseID = new object(); } }
public void ProcessOrder(OrderData orderData) { try { CommerceContext commerceContext = new CommerceContext() { StoreRepository = _StoreRepository, PaymentProcessor = _PaymentProcessor, Mailer = _Mailer, OrderData = orderData, Events = _Events }; IBackbone <CommercePipelineEvents, CommerceContext> backbone = new Backbone <CommercePipelineEvents, CommerceContext>("commerce"); backbone.Execute(backbone.Initialize(), commerceContext); } catch (Exception) { _Mailer.SendRejectionEmail(orderData); throw; } }
public ActionResult Edit(ProfileViewModel profile) { photogEntities db = new photogEntities(); var userID = UserAuthentication.Identity().id; var user = db.Users.FirstOrDefault(x => x.id == userID); if (ModelState.IsValid) { if (profile.EditID == 1) { user.name = profile.Name; } else if (profile.EditID == 2) { user.phonenumber = profile.PhoneNum; } else if (profile.EditID == 3) { if (user.email.ToLower() == profile.Email.ToLower()) { ModelState.AddModelError("Email", "Email is same with existing email"); } else if (db.Users.FirstOrDefault(x => x.id != user.id && x.email.ToLower() == profile.Email.ToLower()) != null) { ModelState.AddModelError("Email", "Email already exists"); } if (!ModelState.IsValid) { profile = new ProfileViewModel { Email = profile.Email, Name = user.name, PhoneNum = user.phonenumber }; return(View(profile)); } var veriKey = (new Backbone()).Random(8); string url = string.Format("https://{0}/Account/Validate?key={1}", Request.Url.Authority, veriKey); string emailContent = String.Format("Click Here to verify your new Email : {0}", url); var client = new SmtpClient("smtp.titan.email", 587) { Credentials = new NetworkCredential("*****@*****.**", "RareMaHZUU") }; client.Send("*****@*****.**", profile.Email, "Verify your new Email", emailContent); user.emailTemp = profile.Email; user.verifiedKey = veriKey; TempData["Email"] = "An email has been sent to " + profile.Email + ", Please check your inbox to validate your email address change"; } else { var checkold = Backbone.ComputeSha256Hash(profile.OldPassword).ToLower(); if (checkold != user.password.ToLower()) { ModelState.AddModelError("OldPassword", "Invalid old password"); } else if (profile.NewPassword != profile.ConfirmPassword) { ModelState.AddModelError("NewPassword", "New Password does not match"); } if (!ModelState.IsValid) { profile = new ProfileViewModel { Email = user.email, Name = user.name, PhoneNum = user.phonenumber }; return(View(profile)); } var passwordHash = Backbone.ComputeSha256Hash(profile.NewPassword); user.password = passwordHash; } TempData["SuccessMessage"] = "Changes has been saved successfully"; db.SaveChanges(); UserAuthentication.UpdateClaim(); return(RedirectToAction("Edit", "Account")); } profile = new ProfileViewModel { Email = user.email, Name = user.name, PhoneNum = user.phonenumber }; return(View(profile)); }
public ActionResult Create(CreateStudioViewModel createStudio) { createStudio.name = createStudio.name?.Trim(); createStudio.SelectedCity = createStudio.SelectedCity?.Trim(); createStudio.SelectedState = createStudio.SelectedState?.Trim(); ViewBag.IsStudioSetting = "true"; ViewBag.Header = "Create New Studio"; ViewBag.IsStudioSetting = "1"; if (string.IsNullOrWhiteSpace(createStudio.name)) { ModelState.AddModelError("name", "Studio Name cannot be null"); } else { if (db.Studios.FirstOrDefault(x => x.name.ToLower() == createStudio.name.ToLower()) != null) { ModelState.AddModelError("name", "Studio Name is not available"); } } if (!string.IsNullOrWhiteSpace(createStudio.phoneNum) && !int.TryParse(createStudio.phoneNum, out int result)) { ModelState.AddModelError("phoneNum", "Invalid Phone Number"); } if (!string.IsNullOrWhiteSpace(createStudio.email) && !Backbone.IsValidEmail(createStudio.email)) { ModelState.AddModelError("email", "Invalid Email Address"); } if (ModelState.IsValid) { var studio = new Studio(); studio.name = createStudio.name; studio.shortDesc = createStudio.shortDesc; studio.phoneNum = createStudio.phoneNum; studio.email = createStudio.email; studio.State = createStudio.SelectedState; studio.City = createStudio.SelectedCity; studio.longDesc = createStudio.longDesc; studio.uniquename = (new Backbone()).Random(5); if (!string.IsNullOrWhiteSpace(createStudio.Facebook)) { studio.StudioLinks.Add(new StudioLink { name = "Facebook", address = createStudio.Facebook }); } if (!string.IsNullOrWhiteSpace(createStudio.Twitter)) { studio.StudioLinks.Add(new StudioLink { name = "Twitter", address = createStudio.Twitter }); } if (!string.IsNullOrWhiteSpace(createStudio.Instagram)) { studio.StudioLinks.Add(new StudioLink { name = "Instagram", address = createStudio.Instagram }); } UserStudio userCred = new UserStudio { userid = UserAuthentication.Identity().id, studioroleid = 1 }; studio.UserStudios.Add(userCred); db.Studios.Add(studio); db.SaveChanges(); AzureBlob blob = new AzureBlob(4); try { blob.MoveBlobFromTemp(2, studio.id.ToString(), createStudio.ImgLogo); studio.ImgLogo = createStudio.ImgLogo; } catch { } try { blob.MoveBlobFromTemp(2, studio.id.ToString(), createStudio.ImgCover); studio.ImgCover = createStudio.ImgCover; } catch { } db.SaveChanges(); return(Redirect(string.Format("/{0}", studio.uniquename))); } return(View("~/Views/StudioPermalink/Settings.cshtml", createStudio)); }
/// <summary>Sets the input image and creates and sets the output array of the layer.</summary> /// <param name="input">The input image to be set.</param> /// <returns>The created output array.</returns> public float[] SetInputGetOutput(Image input) { float[] retVal = Backbone.CreateArray <float>(this.OutputSize); this.SetInputAndOutput(input, retVal); return(retVal); }
/// <summary> /// Configures Rebus to automatically create a <see cref="TransactionScope"/> around the handling of transport messages, /// allowing client code to enlist and be properly committed when the scope is completed. Please not that this is NOT /// a requirement in order to have transactional handling of messages since the queue transaction surrounds the client /// code entirely and will be committed/rolled back depending on whether the client code throws. /// </summary> public RebusBehaviorConfigurer HandleMessagesInsideTransactionScope() { Backbone.AddConfigurationStep(b => b.AdditionalBehavior.HandleMessagesInTransactionScope = true); return(this); }
/// <summary>Creates a new array which can be used as output error.</summary> /// <returns>The created array.</returns> protected override float[] NewError() { return(Backbone.CreateArray <float>(this.OutputSize)); }