Esempio n. 1
0
        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);
        }
Esempio n. 2
0
 public void ThrowTrigger(GlobalEnums trigg, bool enterExit)
 {
     if (trigg == Misc.Enums.GlobalEnums.CurvePoints)
     {
         _halt = enterExit;
     }
 }
Esempio n. 3
0
        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"));
        }
Esempio n. 4
0
        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();
        }
Esempio n. 6
0
        public bool AutoUpdates(bool restoreProcedures)
        {
            if (restoreProcedures || this.GetStoredID(GlobalEnums.ConfigID) < GlobalEnums.MaxConfigVersionID())
            {
                this.RestoreProcedures();
            }

            return(this.GetStoredID(GlobalEnums.ConfigID) == GlobalEnums.MaxConfigVersionID());
        }
Esempio n. 7
0
 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;
        }
Esempio n. 9
0
		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;
		}
Esempio n. 10
0
 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);
 }
Esempio n. 11
0
        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);
        }
Esempio n. 12
0
		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;
		}
Esempio n. 13
0
        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");
        }
Esempio n. 14
0
        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);
 }
Esempio n. 16
0
 private void MenuEnums_Click(object sender, RoutedEventArgs e)
 {
     (new EnumsView(GlobalEnums.GetIntance())).Show();
 }
Esempio n. 17
0
 public override void ThrowTrigger(GlobalEnums trigg, bool enterExit)
 {
     _stateMachine.ThrowTrigger(trigg, enterExit);
 }
Esempio n. 18
0
        //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;
            }
        }
Esempio n. 19
0
 public void ThrowTrigger(GlobalEnums trigg, bool enterExit)
 {
 }
Esempio n. 20
0
 public void ThrowTrigger(GlobalEnums trigg)
 {
 }