private bool RestoreProcedures() { var commodities = this.totalSmartPortalEntities.Commodities.ToList(); foreach (Commodity commodity in commodities) { if (commodity.CodePartB.IndexOf("[") > 0 || commodity.CodePartC.IndexOf("[") > 0 || (commodity.CodePartD != null && commodity.CodePartD.IndexOf("[") > 0)) { throw new Exception("[9999999999999"); } string newCode = ((commodity.CommodityTypeID != (int)GlobalEnums.CommodityTypeID.Items && !String.IsNullOrWhiteSpace(commodity.CodePartA) ? commodity.CodePartA + " " : "") + (!String.IsNullOrWhiteSpace(commodity.CodePartB) ? commodity.CodePartB + " " : "") + (!String.IsNullOrWhiteSpace(commodity.CodePartC) ? commodity.CodePartC + " " : "") + (!String.IsNullOrWhiteSpace(commodity.CodePartD) ? commodity.CodePartD + " " : "") + (commodity.CommodityTypeID == (int)GlobalEnums.CommodityTypeID.Items && !String.IsNullOrWhiteSpace(commodity.CodePartA) ? commodity.CodePartA + " " : "") + (!String.IsNullOrWhiteSpace(commodity.CodePartE) ? commodity.CodePartE + " x " : "") + (!String.IsNullOrWhiteSpace(commodity.CodePartF) ? commodity.CodePartF : "")).Trim(); this.ExecuteStoreCommand("UPDATE Commodities SET Code = N'" + newCode + "', OfficialCode = N'" + TotalBase.CommonExpressions.AlphaNumericString(newCode) + "' WHERE CommodityID = " + commodity.CommodityID, new ObjectParameter[] { }); } this.totalSmartPortalEntities.ColumnAdd("Repacks", "SerialID", "int", "0", true); this.totalSmartPortalEntities.ColumnAdd("WarehouseAdjustments", "CustomerID", "int", "1", true); this.totalSmartPortalEntities.ColumnAdd("WarehouseAdjustmentDetails", "CustomerID", "int", "1", true); this.InitReports(); this.CreateStoredProcedure(); //SET LASTEST VERSION AFTER RESTORE SUCCESSFULL this.ExecuteStoreCommand("UPDATE Configs SET StoredID = " + GlobalEnums.MaxConfigVersionID() + " WHERE StoredID < " + GlobalEnums.MaxConfigVersionID(), new ObjectParameter[] { }); return(true); }
public void ThrowTrigger(GlobalEnums trigg, bool enterExit) { if (trigg == Misc.Enums.GlobalEnums.CurvePoints) { _halt = enterExit; } }
public void ExampleTest() { GlobalEnums.LoadEnums("Resources\\ConfigurationsForExample"); using StreamReader r = new StreamReader("Resources\\ConfigurationsForExample\\Example.json"); string json = r.ReadToEnd(); JObject array = (JObject)JsonConvert.DeserializeObject(json); ConfigurationFile c = new ConfigurationFile(array); Assert.IsInstanceOfType(c.Content["use_bloop"], typeof(ConfigurationComposite)); Assert.IsInstanceOfType(c.Content["folder"], typeof(ConfigurationString)); Assert.IsInstanceOfType(c.Content["index"], typeof(ConfigurationInteger)); Assert.IsInstanceOfType(c.Content["threshold"], typeof(ConfigurationFloat)); Assert.IsInstanceOfType(c.Content["choose"], typeof(ConfigurationList)); Assert.IsInstanceOfType(c.Content["bloop"], typeof(ConfigurationList)); Assert.IsInstanceOfType(c.Content["run_with_profiler"], typeof(ConfigurationBool)); Assert.IsInstanceOfType(c.Content["method"], typeof(ConfigurationString)); Assert.IsInstanceOfType(c.Content["try_bool"], typeof(ConfigurationBool)); Assert.IsInstanceOfType(c.Content["try_int"], typeof(ConfigurationInteger)); Assert.IsInstanceOfType(c.Content["try_int_lower_bound"], typeof(ConfigurationInteger)); Assert.IsInstanceOfType(c.Content["try_int_higher_bound"], typeof(ConfigurationInteger)); Assert.IsInstanceOfType(c.Content["try_int_both_bounds"], typeof(ConfigurationInteger)); Assert.IsInstanceOfType(c.Content["try_float"], typeof(ConfigurationFloat)); Assert.IsInstanceOfType(c.Content["try_float_lower_bound"], typeof(ConfigurationFloat)); Assert.IsInstanceOfType(c.Content["try_float_higher_bound"], typeof(ConfigurationFloat)); Assert.IsInstanceOfType(c.Content["try_float_both_bounds"], typeof(ConfigurationFloat)); Assert.IsInstanceOfType(c.Content["try_string"], typeof(ConfigurationString)); Assert.IsInstanceOfType(c.Content["try_enum_inplace"], typeof(ConfigurationEnumeration)); Assert.IsInstanceOfType(c.Content["try_enum_global"], typeof(ConfigurationEnumeration)); Assert.AreEqual(((ConfigurationBool)((ConfigurationComposite)c.Content["use_bloop"])["first"]).Value.Value, true); Assert.AreEqual(((ConfigurationBool)((ConfigurationComposite)c.Content["use_bloop"])["second"]).Value.Value, true); Assert.AreEqual(((ConfigurationBool)((ConfigurationComposite)c.Content["use_bloop"])["third"]).Value.Value, false); Assert.AreEqual(((ConfigurationString)c.Content["folder"]).Value.Value, "C:\\Users\\Trumpy\\Documents"); Assert.AreEqual(((ConfigurationInteger)c.Content["index"]).Value.Value, 3); Assert.AreEqual(((ConfigurationFloat)c.Content["threshold"]).Value.Value, 5.8, 0.00001); Assert.AreEqual(((ConfigurationInteger)((ConfigurationList)c.Content["choose"]).Variables[2]).Value.Value, 3); Assert.AreEqual(((ConfigurationBool)c.Content["run_with_profiler"]).Value.Value, false); Assert.AreEqual(((ConfigurationString)c.Content["method"]).Value.Value, "soft"); Assert.AreEqual(((ConfigurationBool)c.Content["try_bool"]).Value.Value, true); Assert.AreEqual(((ConfigurationInteger)c.Content["try_int"]).Value.Value, 5); Assert.AreEqual(((ConfigurationFloat)c.Content["try_float"]).Value.Value, 5.7, 0.00001); Assert.AreEqual((((ConfigurationFloat)c.Content["try_float_both_bounds"]).Value as FloatType).LowestValue, 4.8, 0.00001); Assert.AreEqual((((ConfigurationFloat)c.Content["try_float_both_bounds"]).Value as FloatType).HighestValue, 7.0, 0.00001); Assert.AreEqual(((ConfigurationString)c.Content["try_string"]).Value.Value, "bananana"); Assert.AreEqual(((ConfigurationEnumeration)c.Content["try_enum_inplace"]).Value.Value, "dummy_method"); Assert.AreEqual((((ConfigurationEnumeration)c.Content["try_enum_inplace"]).Value as EnumType).IsGlobalEnum, false); Assert.AreEqual((((ConfigurationEnumeration)c.Content["try_enum_inplace"]).Value as EnumType).EnumValues.Count, 3); Assert.AreEqual((((ConfigurationEnumeration)c.Content["try_enum_inplace"]).Value as EnumType).EnumValues[0], "dummy_method"); Assert.AreEqual((((ConfigurationEnumeration)c.Content["try_enum_inplace"]).Value as EnumType).EnumValues[1], "parallel_method"); Assert.AreEqual((((ConfigurationEnumeration)c.Content["try_enum_inplace"]).Value as EnumType).EnumValues[2], "serial_method"); Assert.AreEqual(((ConfigurationEnumeration)c.Content["try_enum_global"]).Value.Value, "Blue"); Assert.AreEqual((((ConfigurationEnumeration)c.Content["try_enum_global"]).Value as EnumType).IsGlobalEnum, true); Assert.AreEqual((((ConfigurationEnumeration)c.Content["try_enum_global"]).Value as EnumType).EnumName, "Colors"); Assert.IsTrue(GlobalEnums.GetGlobalEnum("Colors").ContainsValue("Blue")); }
public async Task SetChannelAsync(GlobalEnums ConfigChannel = GlobalEnums.none, SocketGuildChannel Channel = null) { var Config = GuildHandler.GuildConfigs[Context.Guild.Id]; if (ConfigChannel == GlobalEnums.none && Channel == null) { await ReplyAsync($"Usage: {Config.Prefix}setchannel AdminChannel #channelname\nChannels you can set\n`AdminChannel`,`JoinChannel`,`LeaveChannel`"); } switch (ConfigChannel) { case GlobalEnums.AdminChannel: Config.AdminLog.TextChannel = Channel.Id; await ReplyAsync($"Admin log channel has been set to: **{Channel.Name}**"); break; case GlobalEnums.JoinChannel: Config.JoinEvent.TextChannel = Channel.Id; await ReplyAsync($"Join log channel has been set to: **{Channel.Name}**"); break; case GlobalEnums.LeaveChannel: Config.LeaveEvent.TextChannel = Channel.Id; await ReplyAsync($"Leave log channel has been set to: **{Channel.Name}**"); break; } GuildHandler.GuildConfigs[Context.Guild.Id] = Config; await GuildHandler.SaveAsync(GuildHandler.GuildConfigs); }
public EnumsView(GlobalEnums ge) { GlobalEnums GE = ge; DataContext = ge; InitializeComponent(); }
public bool AutoUpdates(bool restoreProcedures) { if (restoreProcedures || this.GetStoredID(GlobalEnums.ConfigID) < GlobalEnums.MaxConfigVersionID()) { this.RestoreProcedures(); } return(this.GetStoredID(GlobalEnums.ConfigID) == GlobalEnums.MaxConfigVersionID()); }
public void ThrowTrigger(GlobalEnums trigg, bool enterExit) { if (trigg == Misc.Enums.GlobalEnums.CurvePoints) { if (enterExit) { _stateMachine.Tank.Flip(); _patrolPoint = Vector2.zero; } } }
private void AddEnum(object sender) { TextBox tb = sender as TextBox; string content = tb.Text; if (!content.Equals("") && !content.Equals(default_enum_string)) { GlobalEnums.GetIntance().AddEnum(content); UpdateLayout(); } tb.Text = default_enum_string; }
public static AbstractLayout CreateGenerator (GlobalEnums.ReportLayout reportLayout, ReportModel model, ReportItemCollection items) { AbstractLayout layout = null; switch (reportLayout) { case GlobalEnums.ReportLayout.ListLayout: layout = new ListLayout(model,items); break; case GlobalEnums.ReportLayout.TableLayout: layout = new TableLayout(model,items); break; } return layout; }
public bool VersionValidate(bool bothKeyID) { if (bothKeyID) { //CHECK BOTH VersionID AND StoredID if (this.totalSmartPortalEntities.GetVersionValidate(GlobalEnums.ConfigID, GlobalEnums.ConfigVersionID(GlobalEnums.ConfigID)).Single() == null) { this.HandleException("This web application must be updated. Please contact your administrators."); } } else { //CHECK ONLY VersionID. int?versionID = this.GetVersionID(GlobalEnums.ConfigID); if (versionID == null || (int)versionID != GlobalEnums.ConfigVersionID(GlobalEnums.ConfigID)) { this.HandleException("This web application must be updated. Please contact your administrators."); } } return(true); }
public static new ConfigurationVariable TryConvert(string name, JToken fromJson, Changable father) { if (fromJson.Type != JTokenType.Object) { return(null); } JObject j = (JObject)fromJson; if (!j.ContainsKey("type")) { return(null); } string description = j.ContainsKey("description") ? j["description"].ToString() : ""; string notes = j.ContainsKey("notes") ? j["notes"].ToString() : ""; JToken t = j["type"]; if (t.Type == JTokenType.String) { string type_name = t.ToObject <string>(); if (GlobalEnums.HasEnum(type_name)) { return(new ConfigurationEnumeration(j["value"].ToObject <string>(), father, type_name, name, description, notes)); } } else if (t.Type == JTokenType.Array) { JArray vals = (JArray)t; if (vals[0].Type != JTokenType.String) { return(null); } List <string> values = new List <string>(); foreach (JToken value in vals) { values.Add(value.ToObject <string>()); } return(new ConfigurationEnumeration(j["value"].ToObject <string>(), father, values, name, description, notes)); } return(null); }
private void FixLayout (ICSharpCode.Reports.Core.BaseSection section, BaseReportItem item,GlobalEnums.ItemsLayout layout) { item.Size = new Size (GlobalValues.PreferedSize.Width,GlobalValues.PreferedSize.Height); Point p =Point.Empty; switch (layout) { case GlobalEnums.ItemsLayout.Left: p = new Point (this.ReportModel.ReportSettings.LeftMargin, GlobalValues.ControlMargins.Top); break; case GlobalEnums.ItemsLayout.Center: p = new Point((section.Size.Width / 2) - (item.Size.Width /2), GlobalValues.ControlMargins.Top); break; case GlobalEnums.ItemsLayout.Right: p = new Point(section.Size.Width - item.Size.Width - GlobalValues.ControlMargins.Right, GlobalValues.ControlMargins.Top); break; default: break; } item.Location = p; }
private void VersionValidate() { if (MenuSession.GetFreshSession(this.HttpContext) == null || MenuSession.GetFreshSession(this.HttpContext) == "Restore") { foreach (GlobalEnums.FillingLine fillingLine in Enum.GetValues(typeof(GlobalEnums.FillingLine))) { this.moduleRepository.ExecuteStoreCommand("UPDATE Configs SET VersionID = " + GlobalEnums.ConfigVersionID((int)fillingLine) + " WHERE ConfigID = " + (int)fillingLine + " AND VersionID < " + GlobalEnums.ConfigVersionID((int)fillingLine), new ObjectParameter[] { }); } if (!this.moduleRepository.VersionValidate(false)) //JUST CHECK ONLY VersionID. THEN CALL AutoUpdates RIGHT BELOW TO UPDATE StoredID IF NEEDED { throw new Exception("This web application must be updated. Please contact your administrators."); } if (!this.moduleRepository.AutoUpdates(MenuSession.GetFreshSession(this.HttpContext) == "Restore")) { throw new Exception("This web application must be updated. Please contact your administrators."); } } MenuSession.SetFreshSession(this.HttpContext, "CLOSED"); }
protected override void invokeEdit(int?id) { try { base.invokeEdit(id); this.reloadTabPages(); if (this.reportViewModel.OptionBoxIDs != null) { this.dateTimexFromDate.Visible = this.reportViewModel.OptionBoxIDs.IndexOf(GlobalEnums.OBx(GlobalEnums.OptionBoxID.FromDate)) != -1; this.labelFromDate.Visible = this.dateTimexFromDate.Visible; this.pictureFromDate.Visible = this.dateTimexFromDate.Visible; this.dateTimexToDate.Visible = this.reportViewModel.OptionBoxIDs.IndexOf(GlobalEnums.OBx(GlobalEnums.OptionBoxID.ToDate)) != -1; this.labelToDate.Visible = this.dateTimexToDate.Visible; this.pictureToDate.Visible = this.dateTimexToDate.Visible; labelToDate.Text = this.dateTimexFromDate.Visible ? "To" : "As at"; this.comboSummaryVersusDetail.Visible = this.reportViewModel.OptionBoxIDs.IndexOf(GlobalEnums.OBx(GlobalEnums.OptionBoxID.SummaryVersusDetail)) != -1; this.comboQuantityVersusVolume.Visible = this.reportViewModel.OptionBoxIDs.IndexOf(GlobalEnums.OBx(GlobalEnums.OptionBoxID.QuantityVersusVolume)) != -1; this.buttonQuantityVersusVolume.Visible = this.comboSummaryVersusDetail.Visible || this.comboQuantityVersusVolume.Visible; this.comboDateVersusMonth.Visible = this.reportViewModel.OptionBoxIDs.IndexOf(GlobalEnums.OBx(GlobalEnums.OptionBoxID.DateVersusMonth)) != -1; this.buttonDateVersusMonth.Visible = this.comboDateVersusMonth.Visible; this.comboSalesVersusPromotion.Visible = this.reportViewModel.OptionBoxIDs.IndexOf(GlobalEnums.OBx(GlobalEnums.OptionBoxID.SalesVersusPromotion)) != -1; this.comboForecastFilters.Visible = this.reportViewModel.OptionBoxIDs.IndexOf(GlobalEnums.OBx(GlobalEnums.OptionBoxID.ForecastFilters)) != -1; this.buttonSalesVersusPromotion.Visible = this.comboSalesVersusPromotion.Visible || this.comboForecastFilters.Visible; this.comboSlowMoving.Visible = this.reportViewModel.OptionBoxIDs.IndexOf(GlobalEnums.OBx(GlobalEnums.OptionBoxID.SlowMoving)) != -1; this.labelSlowMoving.Visible = this.comboSlowMoving.Visible; this.numericSlowMoving.Visible = this.comboSlowMoving.Visible; this.comboUserName.Visible = this.reportViewModel.OptionBoxIDs.IndexOf(GlobalEnums.OBx(GlobalEnums.OptionBoxID.UserName)) != -1; this.buttonUserName.Visible = this.comboUserName.Visible; } } catch (Exception exception) { ExceptionHandlers.ShowExceptionMessageBox(this, exception); } }
public void ThrowTrigger(GlobalEnums trigg, bool enterExit) { CurrentState.ThrowTrigger(trigg, enterExit); }
private void MenuEnums_Click(object sender, RoutedEventArgs e) { (new EnumsView(GlobalEnums.GetIntance())).Show(); }
public override void ThrowTrigger(GlobalEnums trigg, bool enterExit) { _stateMachine.ThrowTrigger(trigg, enterExit); }
//zaki - overloaded mehtod - to provide a flag (enum) "searchType" public static void SearchItem(IList List, String SearchTitle, String SearchFor, IList columnConfigList, int WWidth, GlobalEnums.enumSearchType searchType) { try { System.Web.HttpContext.Current.Session[GlobalSearchType] = searchType; System.Web.HttpContext.Current.Session[SearchColumnConfigSessionVarName] = columnConfigList; SearchItem(List, SearchTitle, SearchFor, String.Empty, false, String.Empty, WWidth, String.Empty); } catch (Exception ex) { throw ex; } }
public void ThrowTrigger(GlobalEnums trigg, bool enterExit) { }
public void ThrowTrigger(GlobalEnums trigg) { }