private static void SmallWidget() { AbstractWidget widget = new SmallWidget(); WagBuilder builder = new WidgetBuilder(widget); WagDirector director = new WidgetDirector(); IWag smallWidget = director.Build(builder); Console.WriteLine(smallWidget); }
private static void MediumWidget() { AbstractWidget widget = new MediumWidget(FinishColor.PaintedGreen); WagBuilder builder = new WidgetBuilder(widget); WagDirector director = new WidgetDirector(); IWag mediumWidget = director.Build(builder); Console.WriteLine(mediumWidget); }
protected void uxUpdateConfigOnlyButton_Click(object sender, EventArgs e) { WidgetDirector widgetDirector = new WidgetDirector(); SystemConfig.UpdateNewConfigValue(widgetDirector.WidgetConfigurationCollection); DatabaseConverter convert = new DatabaseConverter(); convert.UpdateStoreConfigurations(); AdminUtilities.ClearAllCache(); uxMessageLabel.ForeColor = System.Drawing.Color.Green; uxMessageLabel.Text = "<strong>Update Config Completed</storng>"; }
private static void BuilderPatternDemo() { AbstractWidget abstractWidget = new SmallWidget(FinishColor.PlatedPlatinum); WagBuilder wagBuilder = new WidgetBuilder(abstractWidget); WagDirector wagDirector = new WidgetDirector(); IWag widget = wagDirector.Build(wagBuilder); Console.WriteLine(widget); AbstractGadget abstractGadget = new SmallGadget(FinishColor.PlainBlack); WagBuilder builder = new GadgetBuilder(abstractGadget); WagDirector director = new GadgetDirector(); IWag gadget = director.Build(builder); Console.WriteLine(gadget); }
protected void uxGrid_RowCommand(object sender, GridViewCommandEventArgs e) { string url = ((TextBox)uxGrid.FooterRow.FindControl("uxUrlNameText")).Text; string name = ((TextBox)uxGrid.FooterRow.FindControl("uxNameText")).Text; try { if (e.CommandName == "Add") { if (!VerifyStoreName(name, "0")) { uxMessage.DisplayError(Resources.StoreMessages.DuplicateStoreName); return; } if (VerifyUrlWithKey(url)) { if (VerifyUrlName(url)) { Store store = new Store(); store.StoreName = name; store.UrlName = GetUrlPath(url); store.IsEnabled = ((CheckBox)uxGrid.FooterRow.FindControl("uxIsEnabledCheck")).Checked; store = DataAccessContext.StoreRepository.Save(store); store.CreateStoreConfigCollection(store.StoreID); SetDefaultDisplayCurrencyCode(store); SetProductPrice(store); WidgetDirector widgetDirector = new WidgetDirector(); foreach (string widgetConfigName in widgetDirector.WidgetConfigurationNameAll) { DataAccessContext.ConfigurationRepository.UpdateValue( DataAccessContext.Configurations[widgetConfigName], DataAccessContext.Configurations.GetValue(widgetConfigName, Store.Null), store); } uxMessage.DisplayMessage(Resources.StoreMessages.AddSuccess); RefreshGrid(); } else { uxMessage.DisplayError(Resources.StoreMessages.DuplicateUrl); } } else { uxMessage.DisplayError(Resources.StoreMessages.DomainKeyError); } } else if (e.CommandName == "Edit") { uxGrid.ShowFooter = false; uxAddButton.Visible = true; } } catch (Exception ex) { uxMessage.DisplayException(ex); } }