Exemplo n.º 1
0
        private void Level1DataOutputbutton_Click(object sender, RoutedEventArgs e)
        {
            string sFileStyle = "Text documents (.vsignal)|*.vsignal";
            string UIKey      = "Level1DataOutPutFilePathteBox";
            string UIKey1     = "OutPutDatasteBox";
            string sFilePath  = UIdictionary[UIKey].MyString;

            UIdictionary[UIKey1].MyString = "";
            try
            {
                bool bOpenEnable = Outputfile(ref sFilePath, sFileStyle);
                if (bOpenEnable == true)
                {
                    BaseFactory factory = new BaseFactory();
                    factory.BaseParameter = CreateConvertParameter();
                    factory.TempTable     = Level1DataExcelData;
                    Level1Data level1Data = (Level1Data)factory.CreatDataClass("Level1Data");
                    CreateDataMath <string, List <ConveyorRow> > dataMath = level1Data.CreateLineSignal;
                    var level1DataList = level1Data.CreateList(dataMath);
                    UIdictionary[UIKey].MyString  = sFilePath;
                    UIdictionary[UIKey1].MyString = DataConvert.ToString1(level1DataList);
                    System.IO.File.WriteAllText(@sFilePath, UIdictionary[UIKey1].MyString, Encoding.UTF8);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Build Level1 Data Error: " + ex.Message);
            }
            GC.Collect();
        }
Exemplo n.º 2
0
        void IEntityControl.InitNavigator(IUINavigator Navigator)
        {
            BindingSource MainBs = BaseWinFramework.FindMainBindingSource(
                this, typeof(ParentEntity));

            if (MainBs == null)
            {
                throw new ApplicationException("Main BindingSource not found !");
            }

            if (MainBs.DataSource as ParentEntity == null)
            {
                Type EntityType = ((Type)MainBs.DataSource).UnderlyingSystemType;
                MainBs.DataSource = BaseFactory.CreateInstance(EntityType);
            }

            BaseWinFramework.WinForm.AutoFormat
            .AutoFormatForm(this, false);

            if (Navigator != null)
            {
                Navigator.BindingSource = MainBs;

                InitNavigator(Navigator);
                ((IRuleInitUI)MainBs.DataSource).AfterInitNavigator(Navigator);

                Navigator.SetAutoFormMode();
                if (!ShowNavigator)
                {
                    Navigator.Visible = false;
                }
            }
        }
Exemplo n.º 3
0
        public List <UsageManagementModel> GetUsageManagement(UsageManagementRequest request)
        {
            var result = new List <UsageManagementModel>();

            request.DateFrom = new DateTime(request.DateFrom.Year, request.DateFrom.Month, request.DateFrom.Day, 0, 0, 0);
            request.DateTo   = new DateTime(request.DateTo.Year, request.DateTo.Month, request.DateTo.Day, 23, 59, 59);
            BaseFactory _baseFactory = new BaseFactory();

            using (var cxt = new NuWebContext())
            {
                //get business day

                var _lstBusDayAllStore = _baseFactory.GetBusinessDays(request.DateFrom, request.DateTo, request.StoreId, request.Mode);
                if (_lstBusDayAllStore != null && _lstBusDayAllStore.Any())
                {
                    var dFrom = _lstBusDayAllStore.Min(ss => ss.DateFrom);
                    var dTo   = _lstBusDayAllStore.Max(ss => ss.DateTo);
                    int index = 1;
                    var query = (from u in cxt.I_UsageManagement
                                 join d in cxt.I_UsageManagementDetail on u.Id equals d.UsageManagementId
                                 join i in cxt.I_Ingredient on d.IngredientId equals i.Id
                                 where u.DateFrom >= dFrom && u.DateTo <= dTo
                                 select new { d, i });
                    if (query != null && query.Any())
                    {
                        var lstTmp = new List <UsageManagementModel>();
                        UsageManagementModel obj = null;
                        foreach (var item in query)
                        {
                            obj = new UsageManagementModel();
                            //obj.Index = index;
                            obj.Id      = item.d.Id;
                            obj.Code    = item.i.Code;
                            obj.Name    = item.i.Name;
                            obj.UOMName = item.i.BaseUOMName;
                            obj.Usage   = item.d.Usage;

                            lstTmp.Add(obj);
                            //index++;
                        }
                        var lstGroupIngrdient = lstTmp.GroupBy(gg => gg.Code);
                        foreach (var item in lstGroupIngrdient)
                        {
                            obj       = new UsageManagementModel();
                            obj.Index = index;
                            obj.ListUsageManagementDetailId = string.Join("|", item.Select(ss => ss.Id));
                            obj.Code    = item.Key;
                            obj.Name    = item.Select(ss => ss.Name).FirstOrDefault();
                            obj.UOMName = item.Select(ss => ss.UOMName).FirstOrDefault();
                            obj.Usage   = item.Sum(ss => ss.Usage);

                            result.Add(obj);
                            index++;
                        }
                        //result = result.OrderBy(oo => oo.Index).ToList();
                    }
                }
            }
            return(result);
        }
Exemplo n.º 4
0
        public bool IsConectado(string conexao)
        {
            BaseFactory bf = new BaseFactory();
            IBase       bs = bf.Factory(BaseFactory.BASESQLSERVER, conexao);

            return(bs.IsConectado());
        }
Exemplo n.º 5
0
 public FakeStandardValuesProvider(
     BaseItemManager itemManager,
     BaseTemplateManager templateManager,
     BaseFactory factory)
     : base(itemManager, templateManager, factory)
 {
 }
 public CategoryRepository(BaseFactory factory, BaseItemManager itemManager)
 {
     Debug.Assert(factory != null);
     Debug.Assert(itemManager != null);
     Factory     = factory;
     ItemManager = itemManager;
 }
Exemplo n.º 7
0
        public static void FastClone(BaseEntity DestObj, BaseEntity SourceObj)
        {
            if (DestObj == null)
            {
                DestObj = (BusinessEntity)BaseFactory
                          .CreateInstance(SourceObj.GetType());
            }
            TableDef       td = GetTableDef(SourceObj.GetType());
            BusinessEntity be = (BusinessEntity)DestObj;

            be.EntityOnLoad = true;
            try
            {
                foreach (FieldDef fd in td.KeyFields.Values)
                {
                    fd.SetLoadValue(DestObj, fd.GetValue(SourceObj));
                }
                foreach (FieldDef fd in td.NonKeyFields.Values)
                {
                    fd.SetLoadValue(DestObj, fd.GetValue(SourceObj));
                }
            }
            finally
            {
                be.EntityOnLoad = false;
            }
        }
Exemplo n.º 8
0
        private void ElementSearchOutputFilePathbutton_Click(object sender, RoutedEventArgs e)
        {
            string sFileStyle   = "XML | *.xml";
            string UIKey        = "ElementSearchOutputFilePathBox";
            string UIKey1       = "OutPutDatasteBox";
            string sOutFilePath = UIdictionary[UIKey].MyString;
            bool   bOpenEnable  = Outputfile(ref sOutFilePath, sFileStyle);

            UIdictionary[UIKey1].MyString = "";
            try
            {
                if (bOpenEnable)
                {
                    BaseFactory       factory          = new BaseFactory(CreateConvertParameter());
                    ElementSearchData elmentSearchData = (ElementSearchData)factory.CreatDataClass("ElementSearchData");
                    CreateDataMath <ElementSeacrhStruct, ConveyorRow> elmentSearchMath = elmentSearchData.CreateElements;
                    List <ElementSeacrhStruct> lelmentSearchData = elmentSearchData.CreateList(elmentSearchMath);
                    ElementSearchXml           elementSearchXml  = new ElementSearchXml();
                    elementSearchXml.Elements     = lelmentSearchData;
                    UIdictionary[UIKey1].MyString = DataConvert.ToString(lelmentSearchData);
                    UIdictionary[UIKey].MyString  = sOutFilePath;
                    XmlSerialiaztion.XmlSerial(sOutFilePath, elementSearchXml);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Build Element Search Data Error: " + ex.Message);
            }
            GC.Collect();
        }
Exemplo n.º 9
0
    public void OnTriggerEnter2D(Collider2D coll)
    {
        if (coll.tag == "Enemy")
        {
            StaticData.Hp -= 5;
            EventCenter.Broadcast(EventType.ScoreType);
        }
        if (coll.tag == "Enemy3")
        {
            StaticData.Hp -= 10;
            EventCenter.Broadcast(EventType.ScoreType);
        }
        if (coll.tag == "Bullet3")
        {
            StaticData.Hp -= 5;
            EventCenter.Broadcast(EventType.ScoreType);
        }
        if (StaticData.PlyaerHP == 0)
        {
            // EventCenter.Broadcast(EventType.GameOver);
            JsonSingle.Single.PlayerJsonData.Clear();
            BaseFactory.ClearDict();
            StaticData.PlayerBool = false;
            EventCenter.m_EventTable.Clear();

            SceneManager.LoadSceneAsync(0);
        }
    }
Exemplo n.º 10
0
        protected GameObject GenerateKeyboardButtonAndSetPosition(BaseFactory factory)
        {
            GameObject button = factory.Generate();

            SetKeyboardButtonPosition(button);
            return(button);
        }
Exemplo n.º 11
0
 public RoleOrganizationFactory()
 {
     _baseFactory = new BaseFactory();
     _MPFactory   = new ModulePermissionFactory();
     _RoSfactory  = new RoleOnStoreFactory();
     ListModPer   = new List <ModulePermissionModels>();
 }
Exemplo n.º 12
0
 static BaseFactory()
 {
     if (_instanse == null)
     {
         _instanse = new BaseFactory();
     }
 }
Exemplo n.º 13
0
        protected void InitFilterForm(Form Frm,
                                      XtraScrollableControl xtraScrollableControl1,
                                      SplitContainerControl splitContainerControl1)
        {
            Frm.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            Frm.Height          = Frm.ClientSize.Height;
            Frm.TopLevel        = false;
            Frm.Parent          = xtraScrollableControl1;
            Frm.Dock            = DockStyle.Top;
            splitContainerControl1.SplitterPosition = Frm.Height + 7;

            //Find DataSource
            BindingSource bs = BaseWinFramework
                               .FindMainBindingSource(Frm, typeof(ReportEntity));

            if (bs != null && bs.DataSource as ReportEntity == null)
            {
                Type EntityType = ((Type)bs.DataSource).UnderlyingSystemType;
                re         = (ReportEntity)BaseFactory.CreateInstance(EntityType);
                _Evaluator = BaseFactory.CreateInstance <Evaluator>();
                TableDef td = MetaData.GetTableDef(EntityType);
                td.SetDefault((BaseEntity)re);

                re.InitUI();
                re.SetReportRefresh(ReportRefresh);
                re.SetFormChanged(OnFormChanged);
                bs.DataSource = re;
            }
            Frm.Show();
        }
Exemplo n.º 14
0
        public List <DatabaseTO> GetDatabases(string conexao)
        {
            BaseFactory bf = new BaseFactory();
            IBase       bs = bf.Factory(BaseFactory.BASESQLSERVER, conexao);

            return(bs.GetDatabases());
        }
Exemplo n.º 15
0
        public virtual void ShouldFailWithNotSupportedCaseException(bool A, bool B, bool C)
        {
            Input input = new Input {
                A = A, B = B, C = C
            };

            Assert.Throws <NotSupportedCaseException>(() => BaseFactory.Create(RuleType).GetOutput(input));
        }
Exemplo n.º 16
0
        public RegisterModels()
        {
            BaseFactory _BaseFactory = new BaseFactory();

            CustomerDetail = new CustomerDetailDTO();
            MerchantDetail = new MerchantDTO();
            ListCounTry    = new List <CountryModel>();
        }
        public CustomMediaManager(BaseFactory factory)
        {
            XmlNode configNode = factory.GetConfigNode("mediaLibrary");

            this.config  = configNode == null ? new MediaConfig() : new MediaConfig(configNode);
            this.creator = this.ResolveCreator(factory, configNode);
            cdnHelper    = ServiceLocator.ServiceProvider.GetService <ICdnHelper>();
        }
 public OverrideDefaultSettings(BaseFactory factory, BaseLog log)
 {
     Assert.ArgumentNotNull(factory, "factory");
     Assert.ArgumentNotNull(log, "log");
     _factory = factory;
     _log     = log;
     _ds      = new Sitecore.Configuration.DefaultSettings(factory, log);
 }
        public bool DeleteAll(int costProfileId, ref SaveStatus status)
        {
            bool isValid             = false;
            int  expectedDeleteCount = 0;

            using (var context = new EntityContext())
            {
                try
                {
                    var results = context.Entity_CostProfileItem.Where(s => s.CostProfileId == costProfileId)
                                  .ToList();
                    if (results == null || results.Count == 0)
                    {
                        return(true);
                    }
                    expectedDeleteCount = results.Count;
                    foreach (var item in results)
                    {
                        context.Entity_CostProfileItem.Remove(item);
                        int count = context.SaveChanges();
                        if (count > 0)
                        {
                            isValid = true;
                        }
                        else
                        {
                            //if doing a delete on spec, may not have been any properties
                        }
                    }
                }
                catch (System.Data.Entity.Infrastructure.DbUpdateConcurrencyException dbcex)
                {
                    if (dbcex.Message.IndexOf("an unexpected number of rows (0)") > 0)
                    {
                        //don't know why this happens, quashing for now.
                        LoggingHelper.DoTrace(1, string.Format(thisClassName + ".DeleteAll. costProfileId: {0}, expectedDeletes: {1}. DbUpdateConcurrencyException: {2}", costProfileId, expectedDeleteCount, dbcex.Message));
                        isValid = true;
                    }
                    else
                    {
                        var msg = BaseFactory.FormatExceptions(dbcex);
                        LoggingHelper.DoTrace(1, string.Format(thisClassName + ".DeleteAll. costProfileId: {0}, DbUpdateConcurrencyException: {1}", costProfileId, msg));
                    }
                }
                catch (Exception ex)
                {
                    var msg = BaseFactory.FormatExceptions(ex);
                    LoggingHelper.DoTrace(1, string.Format(thisClassName + ".DeleteAll. costProfileId: {0}, Exception: {1}", costProfileId, msg));

                    if (msg.IndexOf("was deadlocked on lock resources") > 0)
                    {
                        //retry = true;
                    }
                }
            }

            return(isValid);
        }
Exemplo n.º 20
0
        /// <summary>
        /// WPF XAML数据输出
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void XMLOutputbutton_Click(object sender, RoutedEventArgs e)
        {
            string sFileStyle = "WPF (.Xaml)|*.Xaml";
            string UIKey      = "XMLOutPutFilePathteBox";
            string UIKey1     = "OutPutDatasteBox";
            string UIKey2     = "L1raButton";
            string UIKey3     = "L2raButton";
            string UIKey4     = "TeBlackraButton";
            string UIKey5     = "ElementradioButton";
            string UIKey6     = "ViewNameteBox";
            string sFilePath  = UIdictionary[UIKey].MyString;

            UIdictionary[UIKey1].MyString = "";
            try
            {
                bool bOpenEnable = Outputfile(ref sFilePath, sFileStyle);
                if (bOpenEnable == true)
                {
                    BaseFactory factory = new BaseFactory();
                    factory.BaseParameter = CreateConvertParameter();
                    XamlData Data = (XamlData)factory.CreatDataClass("XamlData");
                    CreateDataMath <BgElementCommonXaml, ConveyorRow> bgXmalMath;
                    CreateDataMath <BgTextBlock, ConveyorRow>         blockTextMath;

                    List <BgElementCommonXaml> bgXamlGroup    = new List <BgElementCommonXaml>();
                    List <BgTextBlock>         textBlockGroup = new List <BgTextBlock>();

                    if (UIdictionary[UIKey2].Mybool == true)
                    {
                        bgXmalMath  = Data.CreatL1CommonXaml12307;
                        bgXamlGroup = Data.CreateList(bgXmalMath);
                    }
                    else if (UIdictionary[UIKey3].Mybool == true)
                    {
                        if (UIdictionary[UIKey5].Mybool == true)
                        {
                            bgXmalMath  = Data.CreatL2CommonXaml;
                            bgXamlGroup = Data.CreateList(bgXmalMath);
                        }
                        else if (UIdictionary[UIKey4].Mybool == true)
                        {
                            blockTextMath  = Data.CreatTextBlock;
                            textBlockGroup = Data.CreateList(blockTextMath);
                        }
                    }
                    ElementXaml elementXaml = new ElementXaml(bgXamlGroup, textBlockGroup, UIdictionary[UIKey6].MyString);
                    XmlSerialiaztion.XmlSerial(@sFilePath, elementXaml);
                    UIdictionary[UIKey].MyString  = sFilePath;
                    UIdictionary[UIKey1].MyString = "Build Xaml Successful!";
                    //System.IO.File.WriteAllText(@sFilePath, UIdictionary[UIKey1].MyString, Encoding.UTF8);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Build XML Data Error: " + ex.Message);
            }
            GC.Collect();
        }
Exemplo n.º 21
0
        private void ConfOutputbutton_Click(object sender, RoutedEventArgs e)
        {
            string sFileStyle  = "Excel(.xml) | *.xml";
            string UIKey       = "ConfOutPutFilePathteBox";
            string UIKey1      = "OutPutDatasteBox";
            string UIKey2      = "OPCInforaButton";
            string UIKey3      = "AlarmListradioButton";
            string sFilePath   = UIdictionary[UIKey].MyString;
            bool   bOpenEnable = Outputfile(ref sFilePath, sFileStyle);

            UIdictionary[UIKey1].MyString = "";
            try
            {
                if (bOpenEnable)
                {
                    BaseFactory factory = new BaseFactory();
                    factory.BaseParameter = CreateConvertParameter();
                    factory.bOPCIfo       = (bool)UIdictionary[UIKey2].Mybool;
                    factory.bConvAlarm    = (bool)UIdictionary[UIKey3].Mybool;
                    CreateDataMath <List <string>, ConveyorRow> createMath;
                    ConfigData            dConfigData;
                    List <List <string> > lls = new List <List <string> >();
                    //ConfigData dConfigData = (ConfigData)factory.CreatDataClass("ConfigData");
                    if (UIdictionary[UIKey2].Mybool == true)
                    {
                        string[] sListColName = { "Tag Name", "Type", "Channel", "Device", "DataType" };
                        factory.sListColName = sListColName.ToList();
                        dConfigData          = (ConfigData)factory.CreatDataClass("ConfigData");
                        createMath           = dConfigData.CreateOPCInfoRows;
                        lls = dConfigData.CreateList(createMath);
                    }
                    if (UIdictionary[UIKey3].Mybool == true)
                    {
                        string[] sListColName = { "SignalName",        "AckType",       "AlarmTag",     "PartName",
                                                  "Alarm Description", "AlarmGroup",    "AlarmType",    "AlarmCategory",
                                                  "Delayed",           "ConditionName", "Priority",     "GeneralComment","Level1View",
                                                  "Level2View",        "Resetable",     "ResetBit",     "ALNumber",      "CCTVRecording",
                                                  "ElementID",         "ResetSignal",   "ExtraTagList", "CISData",       "Technical" };
                        factory.sListColName = sListColName.ToList();
                        dConfigData          = (ConfigData)factory.CreatDataClass("ConfigData");
                        createMath           = dConfigData.CreateAlarmListRows;
                        lls = dConfigData.CreateList(createMath);
                    }
                    UIdictionary[UIKey].MyString = sFilePath;
                    //ExcelFunction.ExcelWrite(sFilePath, dt);
                    //XmlFuction xmlFuction = new XmlFuction();
                    //xmlFuction.XmlWrite(sFilePath, dt);
                    XmlSerialiaztion.XmlSerial(sFilePath, new Workbook(lls));
                    UIdictionary[UIKey1].MyString = "Build Datas Successful";
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Build OPC Data Error: " + ex.Message);
            }
            GC.Collect();
        }
Exemplo n.º 22
0
        public virtual void ShouldSelectCorrectLetter(bool A, bool B, bool C, HType expected)
        {
            Input input = new Input {
                A = A, B = B, C = C
            };
            Output output = BaseFactory.Create(RuleType).GetOutput(input);

            Assert.Equal(expected, output.H);
        }
Exemplo n.º 23
0
 public ReturnNoteFactory()
 {
     _baseFactory = new BaseFactory();
     //=====
     _RNFactory        = new ReceiptNoteFactory();
     _RNDFactory       = new ReturnNoteDetailFactory();
     _PODetailFactory  = new PurchaseOrderDetailFactory();
     _inventoryFactory = new InventoryFactory();
 }
Exemplo n.º 24
0
 public InitializeEnterspeed(
     BaseItemManager itemManager,
     BaseFactory factory,
     BasePublishManager publishManager)
 {
     _itemManager    = itemManager;
     _factory        = factory;
     _publishManager = publishManager;
 }
Exemplo n.º 25
0
        public static BaseEntity CloneAll(BaseEntity SourceObj)
        {
            TableDef   td      = GetTableDef(SourceObj.GetType());
            BaseEntity DestObj = (BaseEntity)BaseFactory
                                 .CreateInstance(td._ClassType);

            IRuleInitUI px = DestObj as IRuleInitUI;

            //CallLoadRule = CallLoadRule && px != null;

            DestObj.EntityOnLoad = true;
            try
            {
                DestObj = SourceObj.ShallowClone();

                if (td.ChildEntities.Count > 0)
                {
                    foreach (EntityCollDef ecd in td.ChildEntities)
                    {
                        //IEntityCollection cols = (IEntityCollection)
                        //    Activator.CreateInstance(ecd.ConstructionType);
                        //if (ecd.mi.MemberType == MemberTypes.Field)
                        //    ((FieldInfo)ecd.mi).SetValue(DestObj, cols);
                        //else
                        //    ((PropertyInfo)ecd.mi).SetValue(DestObj, cols, null);

                        IList SrcCols  = ecd.GetValue(SourceObj);
                        IList DestCols = (IList)ecd.CreateNew((BusinessEntity)DestObj);

                        ((IEntityCollection)DestCols).OnLoad = true;
                        foreach (BusinessEntity obj in SrcCols)
                        {
                            DestCols.Add(CloneAll(obj));
                        }
                        ((IEntityCollection)DestCols).OnLoad = false;
                    }
                }

                //if (CallLoadRule)
                //{
                //    px.AfterLoadFound();
                //    BaseFramework.DoEntityAction(DestObj, enEntityActionMode.AfterLoadFound);
                //}
                ParentEntity pe = DestObj as ParentEntity;
                if (pe != null)
                {
                    pe.AfterClone((ParentEntity)SourceObj);
                }
            }
            finally
            {
                DestObj.EntityOnLoad = false;
                DestObj.DataChanged();
            }
            return(DestObj);
        }
Exemplo n.º 26
0
        public void TestMove()
        {
            var player = new BaseFactory <Humans>().CreateWarrior("Name");
            var battle = new Battle(player);

            battle.Player.X = 15;
            battle.Player.Move("Left");

            Assert.AreEqual(3, battle.Player.X);
        }
Exemplo n.º 27
0
        public MainWindow()
        {
            InitializeComponent();
            InitializeUserInputActions();

            _gameSession = BaseFactory.Create <GameSessionFactory, GameSession>();

            _gameSession.OnMessageRaised += OnGameMessageRaised;
            DataContext = _gameSession;
        }
    public static void Main()
    {
        var x = new TypedFactory <Item>();
        BaseFactory <Item> factory = x;

        Item someItem = factory.funcA("I am alive");

        Console.WriteLine(someItem.id);
        Console.WriteLine(factory.funcB("I am alive too", someItem).id);
    }
Exemplo n.º 29
0
        static BaseGL()
        {
            if (BaseSecurity.CurrentLogin.IsLogged())
            {
                CurrentLogin_onLogon();
            }

            BaseSecurity.CurrentLogin.onLogon += new LogonChanged(CurrentLogin_onLogon);
            BaseFactory.RegisterObjType <Evaluator, GLEvaluator>();
        }
Exemplo n.º 30
0
        public PipelineService()
        {
            var factory = ServiceLocator.ServiceProvider.GetRequiredService <IReflectionServiceFactory>();

            ReflectionService = factory.GetVersionSpecificService();
            SettingsService   = ServiceLocator.ServiceProvider.GetRequiredService <ISettingsService>();
            BaseFactory       = ServiceLocator.ServiceProvider.GetRequiredService <BaseFactory>();

            InitializePipelines();
        }