示例#1
0
        private static Dictionary <DbLayer, Dictionary <Type, List <DtObject> > > GetLayerTypeObjectsDictionary(IntegrationBase integrationBase)
        {
            DtoProject project = integrationBase.ApiCore.Projects.GetDtoProject(integrationBase.CurrentProject.Id);

            Dictionary <DbLayer, Dictionary <Type, List <DtObject> > > layerTypeObjectsDictionary = new Dictionary <DbLayer, Dictionary <Type, List <DtObject> > >();

            List <DtoProjectDiscipline> disciplines = new List <DtoProjectDiscipline>();

            try
            {
                if (project.Disciplines != null && project.Disciplines.FirstOrDefault() != null)
                {
                    foreach (DtoProjectDiscipline discipline in project.Disciplines)
                    {
                        if (disciplines.FirstOrDefault(d => d.DisciplineId == discipline.DisciplineId) == null)
                        {
                            disciplines.Add(discipline);
                        }
                    }
                }

                List <DtoElementType> existingTypes = new List <DtoElementType>();
                Dictionary <Type, List <DtObject> > typeObjectDict = new Dictionary <Type, List <DtObject> >();
                layerTypeObjectsDictionary = new Dictionary <DbLayer, Dictionary <Type, List <DtObject> > >();

                using (new TraceCodeTime("Load elements", "Import types"))
                {
                    using (new TraceCodeTime("GetProjectElementTypes", "Import types"))
                    {
                        existingTypes = integrationBase.ApiCore.Projects.GetProjectElementTypes(integrationBase.CurrentProject.Id);
                    }

                    foreach (DtoElementType elementType in existingTypes)
                    {
                        Type type = DbObjectList.GetType(elementType.Type);

                        DbLayer layer = DbLayerHandler.GetLayer(DbObjectList.Discpline(elementType.Id));

                        if (!layerTypeObjectsDictionary.ContainsKey(layer))
                        {
                            layerTypeObjectsDictionary.Add(layer, new Dictionary <Type, List <DtObject> >());
                        }

                        if (!layerTypeObjectsDictionary[layer].ContainsKey(type))
                        {
                            layerTypeObjectsDictionary[layer].Add(type, new List <DtObject>());
                        }
                    }
                }
            }
            catch (Exception)
            {
            }

            return(layerTypeObjectsDictionary);
        }
示例#2
0
        private void FrmBaseInfoMemberTesterInput_Load(object sender, EventArgs e)
        {
            //sp.Volume = 40;
            //sp.Rate = -4;
            //sp.Speak("彩虹乐园欢迎您!黄腾达,手机:1 3 5 5 6 4 2 6 4 9 6 体验时间已到!", spFlags);
            DbObjectList <BaseInfoMemberTester> bimt = BaseInfoMemberTester.Find(CK.K["FinishedDate"] < DateTime.Now.AddDays(-1) && CK.K["Status"] == 0);
            int count = bimt.Count;

            if (count > 0)
            {
                for (int i = 0; i < count; i++)
                {
                    bimt[i].Status = "1";
                    bimt[i].Save();
                }
            }
            dgvTester.DataSource = BllBaseInfoMemberTester.ReturnFinishedTester(UserStatics.OptrType);
            timerWarning.Enabled = true;
        }
示例#3
0
        private void timerWarning_Tick(object sender, EventArgs e)
        {
            DbObjectList <BaseInfoMemberTester> bimt = BaseInfoMemberTester.Find(CK.K["FinishedDate"] < DateTime.Now && CK.K["Status"] == 0);
            int    count = bimt.Count;
            string text  = "";

            if (count > 0)
            {
                for (int i = 0; i < count; i++)
                {
                    text           = bimt[i].Name + "\n 体验时间已到!";
                    bimt[i].Status = "1";
                    bimt[i].Save();
                    MessageBox.Show(text);
                    sp.Volume = 40;
                    sp.Speak(text, spFlags);
                }
            }
            dgvTester.DataSource = null;
            dgvTester.DataSource = BllBaseInfoMemberTester.ReturnFinishedTester(UserStatics.OptrType);
        }