private bool LabelGroupPanel(ImporterGroup importerGroup, LabelGroup labelGroup) { using (new GUILayout.VerticalScope("GroupBox")) { //头部 using (new GUILayout.HorizontalScope()) { labelGroup.Active = EditorGUILayout.ToggleLeft(GUIContent.none, labelGroup.Active, GUILayout.Width(20)); labelGroup.LabelExpression = EditorGUILayout.TextField(labelGroup.LabelExpression); if (GUILayout.Button("×", GUILayout.Width(20))) //删除LabelGroup { RemoveLabelGroup(importerGroup, labelGroup); return(true); } } using (new EditorGUI.DisabledGroupScope(!labelGroup.Active)) { //每一个属性 using (new GUILayout.HorizontalScope()) { foreach (var propertyGroup in labelGroup.PropertyGroups) { PropertyGroupPanel(importerGroup, propertyGroup); } } } } return(false); }
public async Task <IList <LabelGroup> > LabelGroupList(RelationLabelGroupIn RelationLabelGroupInfo) { //初步过滤 var RelationLabelGroups = _repository.GetAll().Where(RelationLabelGroupInfo.Expression); List <LabelGroup> labelGroups = new List <LabelGroup>(); if (RelationLabelGroups != null) { var RelationLabel = await RelationLabelGroups.ToListAsync(); foreach (var Item in RelationLabel) { string[] LableID = Item.LableID.Split(','); string[] LableName = Item.LableName.Split(','); if (LableID.Length > 0) { for (int a = 0; a < LableID.Length; a++) { LabelGroup labelGroup = new LabelGroup(); labelGroup.GroupName = Item.GroupName; labelGroup.LableID = int.Parse(LableID[a]); labelGroup.LableName = LableName[a]; labelGroups.Add(labelGroup); } } } } return(labelGroups.Distinct().ToList()); }
private void Render() { SuspendLayout(); List <Group> groups = new List <Group>(); if (gameID > 0) { groups = Attendance.GetPresent(gameID); groups.Sort((x, y) => Score.GetGame(gameID, y.ID).CompareTo(Score.GetGame(gameID, x.ID))); } else { groups = Group.GetAll(); groups.Sort((x, y) => Score.GetTotal(y.ID).CompareTo(Score.GetTotal(x.ID))); } foreach (Group group in groups) { RowCount += 1; RowStyles.Add(new RowStyle(SizeType.Percent, 100F)); LabelGroup lblGroup = new LabelGroup(group.Name, layout); short score = (gameID > 0) ? Score.GetGame(gameID, group.ID) : Score.GetTotal(group.ID); LabelScore lblScore = new LabelScore(score, layout); Controls.Add(lblGroup, 0, RowCount - 1); Controls.Add(lblScore, 1, RowCount - 1); } ResumeLayout(false); PerformLayout(); }
private static LabelGroup ElementToLabelGroup(XmlElement labelGroupEle, string fieldId) { if (labelGroupEle == null) { return(null); } String name = XmlUtils.GetAttributeValue(labelGroupEle, "name"); LabelGroup lg_result = new LabelGroup(); lg_result.Name = name; List <XmlElement> labelEleList = XmlUtils.GetChildElements(labelGroupEle, "label"); foreach (XmlElement labelEle in labelEleList) { Label label = new Label(); String labelName = XmlUtils.GetAttributeValue(labelEle, "name"); String labelValue = XmlUtils.GetAttributeValue(labelEle, "value"); String labelDesc = XmlUtils.GetAttributeValue(labelEle, "desc"); label.Name = labelName; label.Value = labelValue; label.Desc = labelDesc; lg_result.Add(label); } List <XmlElement> labelGroupEleList = XmlUtils.GetChildElements(labelGroupEle, "label-group"); foreach (XmlElement subLabelGroupEle in labelGroupEleList) { LabelGroup subGroup = new LabelGroup(); subGroup = ElementToLabelGroup(subLabelGroupEle, fieldId); lg_result.Add(subGroup); } return(lg_result); }
public override void Read(FileReader reader, Header header) { Padding = reader.ReadBytes(8); long pos = reader.Position; EntryCount = reader.ReadUInt32(); for (int i = 0; i < EntryCount; i++) { LabelGroup group = new LabelGroup(); group.NumberOfLabels = reader.ReadUInt32(); group.Offset = reader.ReadUInt32(); Groups.Add(group); } foreach (LabelGroup group in Groups) { reader.Seek(pos + group.Offset, SeekOrigin.Begin); for (int i = 0; i < group.NumberOfLabels; i++) { LabelEntry entry = new LabelEntry(); entry.Length = reader.ReadByte(); entry.Name = reader.ReadString((int)entry.Length); entry.Index = reader.ReadUInt32(); entry.Checksum = (uint)Groups.IndexOf(group); Labels.Add(entry); } } reader.Align(8); }
public void CreateBookItem(BookItemViewModel bookView, ApplicationDbContext db, HttpPostedFileBase cover, HttpPostedFileBase tableOfContents) { BookItem bookItem = new BookItem() { Title = bookView.Title, ISBN = bookView.ISBN, Descryption = bookView.Descryption, Publisher = bookView.Publisher, ReleaseDate = bookView.ReleaseDate, Category = db.Categories.Find(bookView.CategoryID), Number = bookView.Number, AddDate = DateTime.Now }; db.Set <BookItem>().AddOrUpdate(bookItem); db.SaveChanges(); var book = db.BookItems.FirstOrDefault(x => x.ISBN == bookItem.ISBN); db.Categories.Find(bookView.CategoryID).BookItem.Add(book); foreach (var authorId in bookView.SelectedAuthors) { var author = db.Authors.Single(a => a.AuthorID == authorId); var ag = new AuthorGroup() { Author = author, BookItem = book }; db.Set <AuthorGroup>().AddOrUpdate(ag); } db.SaveChanges(); foreach (var labelId in bookView.SelectedLabels) { var label = db.Labels.Single(l => l.LabelID == labelId); var labelgroup = new LabelGroup() { Label = label, BookItem = book, }; db.Set <LabelGroup>().AddOrUpdate(labelgroup); } db.SaveChanges(); if (cover != null) { AddAttachments_displayable(db, bookItem.BookItemID, cover, FileType.Cover); } if (tableOfContents != null) { AddAttachments_displayable(db, bookItem.BookItemID, tableOfContents, FileType.TableOfContents); } foreach (var file in bookView.FileList) { AddAttachments(db, bookItem.BookItemID, file, FileType.Attachment); } }
public LabelGroup AddSubLabelGroup(string name) { LabelGroup newLabelGroup = new LabelGroup(); newLabelGroup.Name = name; this.labelGroup.Add(newLabelGroup); return(newLabelGroup); }
private void RemoveLabelGroup(ImporterGroup importerGroup, LabelGroup labelGroup) { if (labelGroup.PropertyGroups.All(x => x.Properties.Count == 0) || G.Module.DisplayDialog("确定删除该组?\n\n" + labelGroup.LabelExpression, "确定", "取消")) { importerGroup.LabelGroups.Remove(labelGroup); G.Module.IsDirty = true; EditorGUIUtility.editingTextField = false; } }
public Input(int from, int to, int group) { From = from; To = to; Group = group; Kind = GroupKind.Edge; Labels = LabelGroup.Edge(); Labels.Group = group; }
public Input(int from, int to, int group, LabelGroup labelGroup) { From = from; To = to; Group = group; Kind = labelGroup.Kind; Labels = labelGroup; Labels.Group = group; }
internal static void AddGroup(PassOrPlayGroups view, Group group) { view.SuspendLayout(); LabelGroup labelGroup = new LabelGroup(group.Name); view.labelGroups.Add(labelGroup); view.RowCount += 1; view.RowStyles.Add(new RowStyle(SizeType.Absolute, 100F)); view.Controls.Add(labelGroup, 0, view.RowCount - 1); view.ResumeLayout(false); view.PerformLayout(); }
private void AddLabelGroup(ImporterGroup importerGroup) { var labelGroup = new LabelGroup(); foreach (var propertyGroup in labelGroup.PropertyGroups) { propertyGroup.ImporterSetting = (ImporterSetting)ScriptableObject.CreateInstance(importerGroup.SettingType); propertyGroup.SerializedObject = new SerializedObject(propertyGroup.ImporterSetting); } importerGroup.LabelGroups.Add(labelGroup); G.Module.IsDirty = true; EditorGUIUtility.editingTextField = false; }
private void Render() { SuspendLayout(); List <Group> groups = new List <Group>(); groups = Attendance.GetPresent(Question.GetByID(questionID).Game); foreach (Group group in groups) { RowCount += 1; RowStyles.Add(new RowStyle(SizeType.Percent, 100F)); LabelGroup lblGroup = new LabelGroup(group.Name); LabelAnswer lblAnswer = new LabelAnswer(group.GetQuestionAnswer(questionID).ToUpper(CultureInfo.CurrentCulture)); Controls.Add(lblGroup, 0, RowCount - 1); Controls.Add(lblAnswer, 1, RowCount - 1); } ResumeLayout(false); PerformLayout(); }
private static LabelField ElementToLabelField(XmlElement fieldElm, string fieldId, string fieldName) { if (fieldElm == null) { return(null); } LabelField labelField = (LabelField)SchemaFactory.CreateField(FieldTypeEnum.LABEL); labelField.Id = fieldId; labelField.Name = fieldName; //rules XmlElement rulesEle = XmlUtils.GetChildElement(fieldElm, "rules"); if (rulesEle != null) { List <XmlElement> ruleEleList = XmlUtils.GetChildElements(rulesEle, "rule"); foreach (XmlElement ruleEle in ruleEleList) { Rule rule = ElementToRule(ruleEle, labelField.Id); labelField.Add(rule); } } //property XmlElement propertiesEle = XmlUtils.GetChildElement(fieldElm, "properties"); if (propertiesEle != null) { List <XmlElement> propertyEleList = XmlUtils.GetChildElements(propertiesEle, "property"); foreach (XmlElement propertyEle in propertyEleList) { Property.Property property = ElementToProperty(propertyEle, labelField.Id); labelField.Add(property); } } //labelGroup XmlElement labelGroupEle = XmlUtils.GetChildElement(fieldElm, "label-group"); if (labelGroupEle != null) { LabelGroup labelGroup = ElementToLabelGroup(labelGroupEle, fieldId); labelField.SetLabelGroup(labelGroup); } return(labelField); }
internal static void RemoveGroup(PassOrPlayGroups view, Group group) { view.SuspendLayout(); LabelGroup removeLabelGroup = new LabelGroup(""); foreach (LabelGroup labelGroup in view.labelGroups) { if (group.Name == labelGroup.Text) { view.Controls.Remove(labelGroup); removeLabelGroup = labelGroup; view.RowCount -= 1; break; } } view.labelGroups.Remove(removeLabelGroup); view.ResumeLayout(false); view.PerformLayout(); }
public Task AddAsync(LabelGroup audio) { labelGroupsDataSet.Add(audio); return(dbContext.SaveChangesAsync()); }
public Text ParseText(BsonDocument value, SefariaSQLiteConversionContext targetContext) { Text text = new Text(); LabelGroup versionTitleLG = new LabelGroup(); versionTitleLG.Labels = new List <Label>(); //BsonDocument value = _texts.Find(_ => true).Skip(index).FirstOrDefault(); foreach (var element in value.Elements) { switch (element.Name) { case "title": var titleName = element.Value.AsString; Topic topic = targetContext.FindFirstOrDefaultWhere(targetContext.Topics, t => t.Name == titleName); if (topic != null) { text.Topic = topic; } else { text.Topic = new Topic { Name = titleName, LabelGroup = versionTitleLG }; targetContext.Add(targetContext.Topics, text.Topic); } break; case "priority": text.Priority = element.Value.ToInt32(); break; case "versionNotes": text.VersionNotes = element.Value.AsString; break; case "versionSource": text.VersionSource = element.Value.BsonType != BsonType.Null? element.Value.AsString:null; break; case "language": switch (element.Value.AsString) { case "en": text.LanguageId = (int)LanguageTypes.English; break; case "he": text.LanguageId = (int)LanguageTypes.Hebrew; break; default: text.LanguageId = (int)LanguageTypes.Undefined; break; } break; case "license": text.License = element.Value.AsString; break; case "versionTitle": versionTitleLG.Labels.Add(new Label { LanguageId = (int)LanguageTypes.English, Text = element.Value.AsString }); text.VersionTitle = versionTitleLG; break; case "versionTitleInHebrew": versionTitleLG.Labels.Add(new Label { LanguageId = (int)LanguageTypes.Hebrew, Text = element.Value.AsString }); break; case "chapter": text.Chapter = GenerateChapterTree(text, element.Value); break; default: break; } } text.ChapterCount = CountChapters(text.Chapter); return(text); }
public void SetLabelGroup(LabelGroup labelGroup) { this.labelGroup = labelGroup; }
public async Task <string> SendWecharMesaage(string KeyWord) { // 查询标签关联的组数据 RelationLabelGroupIn relationLabelGroupIn = new RelationLabelGroupIn(); relationLabelGroupIn.AndAlso(a => a.IsDelete == false); if (!string.IsNullOrEmpty(KeyWord)) { relationLabelGroupIn.AndAlso(a => a.LableName.Contains(KeyWord)); } else { // 当输入为空时 不查询 return(null); } var LabelGroupList = await _RelationLabelGrouprepository.GetAll().Where(relationLabelGroupIn.Expression).ToListAsync(); List <LabelGroup> labelGroups = new List <LabelGroup>(); if (LabelGroupList != null) { foreach (var Item in LabelGroupList) { string[] LableID = Item.LableID.Split(','); string[] LableName = Item.LableName.Split(','); if (LableID.Length > 0) { for (int a = 0; a < LableID.Length; a++) { LabelGroup labelGroup = new LabelGroup(); labelGroup.GroupName = Item.GroupName; labelGroup.LableID = int.Parse(LableID[a]); labelGroup.LableName = LableName[a]; labelGroups.Add(labelGroup); } } } } // 查询业务与标签之间的关系 RelationLabelListIn relationLabelListIn = new RelationLabelListIn(); relationLabelListIn.AndAlso(a => a.IsDelete == false); var relationLabelList = _RelationLabelListrepository.GetAll().Where(relationLabelListIn.Expression); List <RelationLabelList> relationLabelLists = new List <RelationLabelList>(); if (LabelGroupList != null) { var RelationLabelLists = from a in labelGroups join b in relationLabelList on a.LableID equals b.LableID select b; if (RelationLabelLists != null) { relationLabelLists = RelationLabelLists.Distinct().ToList(); } } StringBuilder sbClinic = new StringBuilder(); StringBuilder sbDoctor = new StringBuilder(); StringBuilder sbPaper = new StringBuilder(); StringBuilder sbQuestion = new StringBuilder(); if (relationLabelLists != null) { // 关键字查询科室信息 var ClinicList = relationLabelLists.Where(a => a.RelationCode == "Clinic").ToList(); if (ClinicList != null && ClinicList.Count > 0) { ClinicInfomationIn clinicInfomationIn = new ClinicInfomationIn(); clinicInfomationIn.AndAlso(a => a.IsDelete == false); // 增加查询状态 var YaeherCinlinList = _ClinicInfomationrepository.GetAll().Where(clinicInfomationIn.Expression); var RecomCinlinList = from a in ClinicList join b in YaeherCinlinList on a.BusinessID equals b.Id select b; if (RecomCinlinList != null) { var CinlinList = RecomCinlinList.Distinct().ToList().OrderBy(a => a.OrderSort).ThenByDescending(a => a.CreatedOn).Take(4); //int CinlinCount = 0; foreach (var Item in CinlinList) { var ClinicUrl = Commons.WecharWeb + "doctor-list-patient?id=" + Item.Id + "&clinicNmae=" + Item.ClinicName + "&rShow=no"; sbClinic.Append("<a href=\"" + ClinicUrl + "\">" + Item.ClinicName + "</a> "); sbClinic.Append("\n"); // 去掉科室换行 //CinlinCount += 1; //if (CinlinCount >= 2) //{ // sbClinic.Append("\n"); // sbClinic.Append("\n"); // CinlinCount = 0; //} } } } #region 关键字查询医生信息 暂时去掉 // 关键字查询医生信息 //var DoctorList = relationLabelLists.Where(a => a.RelationCode == "Doctor").ToList(); //if (DoctorList != null&&DoctorList.Count>0) //{ // YaeherDoctorIn yaeherDoctorIn = new YaeherDoctorIn(); // yaeherDoctorIn.AndAlso(a => a.IsDelete == false); // yaeherDoctorIn.AndAlso(a => a.AuthCheckRes =="success"); // // 增加查询状态 // var YaeherDoctotList = _YaeherDoctorrepository.GetAll().Where(yaeherDoctorIn.Expression); // //查询医生开启状态 // ServiceMoneyListIn serviceMoneyListIn = new ServiceMoneyListIn(); // serviceMoneyListIn.AndAlso(a => a.IsDelete == false); // serviceMoneyListIn.AndAlso(a => a.ServiceState == true); // var DocotorService= _ServiceMoneyListrepository.GetAll().Where(serviceMoneyListIn.Expression); // var RecomDoctotList = from a in DoctorList // join b in YaeherDoctotList on a.BusinessID equals b.Id // join c in DocotorService on b.Id equals c.DoctorID // select b; // if (RecomDoctotList != null) // { // var DoctotList = RecomDoctotList.Distinct().ToList().OrderByDescending(a=>a.CreatedOn).Take(12); // int DoctotCount = 0; // foreach (var Item in DoctotList) // { // var DoctotUrl= Commons.WecharWeb + "doctor-detail-patient?id="+Item.Id+"&rShow=no"; // sbDoctor.Append("<a href=\""+DoctotUrl+"\">"+Item.DoctorName+"</a> "); // DoctotCount += 1; // if (DoctotCount >=3) // { // sbDoctor.Append("\n"); // sbDoctor.Append("\n"); // DoctotCount = 0; // } // } // } //} //// 关键字查询文章信息 //var PaperList = relationLabelLists.Where(a => a.RelationCode == "Paper").ToList(); //if (PaperList != null&&PaperList.Count>0) //{ // ReleaseManageIn releaseManageIn = new ReleaseManageIn(); // releaseManageIn.AndAlso(a => a.IsDelete == false); // // 增加查询状态 // var ReleasList = _ReleaseManagerepository.GetAll().Where(releaseManageIn.Expression); // var RecomReleasList = from a in PaperList // join b in ReleasList on a.BusinessID equals b.Id // select b; // if (RecomReleasList != null) // { // var ReleasLists = RecomReleasList.Distinct().ToList().OrderByDescending(a=>a.CreatedOn).Take(5); // foreach (var Item in ReleasLists) // { // var ReleasUrl= Commons.WecharWeb + "article-detail?id="+Item.Id+"&rShow=no&look=no"; // sbPaper.Append("<a href=\""+ReleasUrl+"\">"+Item.PaperTiltle+"</a>\n"); // } // } //} //// 关键字查询问答信息 //var QuestionList = relationLabelLists.Where(a => a.RelationCode == "Question").ToList(); //if (QuestionList != null&&QuestionList.Count>0) //{ // QuestionReleaseIn questionReleaseIn = new QuestionReleaseIn(); // questionReleaseIn.AndAlso(a => a.IsDelete == false); // // 增加查询状态 // var QuestinList = _QuestionReleaserepository.GetAll().Where(questionReleaseIn.Expression); // var RecomQuestionList = from a in QuestionList // join b in QuestinList on a.BusinessID equals b.Id // select b; // if (RecomQuestionList != null) // { // var QuestionLists = RecomQuestionList.Distinct().ToList().OrderByDescending(a=>a.CreatedOn).Take(5); // foreach (var Item in QuestionLists) // { // var QuestionUrl= Commons.WecharWeb + "question-detail?id="+Item.Id+"&rShow=no"; // sbQuestion.Append("<a href=\""+QuestionUrl+"\">"+Item.Title+"</a>\n"); // } // } //} #endregion } StringBuilder sbWecharMessage = new StringBuilder(); if (sbClinic.ToString() != null && sbClinic.ToString() != "") { sbWecharMessage.Append("推荐科室: \n"); sbWecharMessage.Append(sbClinic.ToString() + "\n"); } #region 暂时去掉 //if (sbDoctor.ToString() != null&&sbDoctor.ToString()!="") //{ // sbWecharMessage.Append("推荐医生: \n"); // sbWecharMessage.Append(sbDoctor.ToString() +"\n"); //} //if (sbPaper.ToString() != null&&sbPaper.ToString()!="") //{ // sbWecharMessage.Append("推荐文章: \n"); // sbWecharMessage.Append(sbPaper.ToString() +"\n"); //} //if (sbQuestion.ToString() != null&&sbQuestion.ToString()!="") //{ // sbWecharMessage.Append("推荐问答: \n"); // sbWecharMessage.Append(sbQuestion.ToString() +"\n"); //} #endregion return(sbWecharMessage.ToString()); }
public BookItem EditBookItem(BookEditViewModel bookView, ApplicationDbContext db, HttpPostedFileBase cover, HttpPostedFileBase tableOfContents) { var existingBook = db.BookItems.Single(x => x.BookItemID == bookView.BookItemViewModel.ID); existingBook.Title = bookView.BookItemViewModel.Title; existingBook.ISBN = bookView.BookItemViewModel.ISBN; existingBook.Descryption = bookView.BookItemViewModel.Descryption; existingBook.Publisher = bookView.BookItemViewModel.Publisher; existingBook.Category = db.Categories.Find(bookView.BookItemViewModel.CategoryID); existingBook.Number = bookView.BookItemViewModel.Number; //Update AuthorGroup Table List <int> oldAuthorGroupID = db.Authors.Where(a => a.AuthorGroups.Any(g => g.BookItem.BookItemID == existingBook.BookItemID)).Select(x => x.AuthorID).ToList(); var authorDiffAdd = bookView.BookItemViewModel.SelectedAuthors.Except(oldAuthorGroupID); var authorDiffDel = oldAuthorGroupID.Except(bookView.BookItemViewModel.SelectedAuthors); foreach (var arg in authorDiffDel) { AuthorGroup delete = db.AuthorGroups.Single(x => x.Author.AuthorID == arg && x.BookItem.BookItemID == bookView.BookItemViewModel.ID); db.AuthorGroups.Remove(delete); } db.SaveChanges(); foreach (var arg in authorDiffAdd) { AuthorGroup add = new AuthorGroup() { Author = db.Authors.Find(arg), BookItem = existingBook }; db.AuthorGroups.Add(add); } db.SaveChanges(); //Update LabelGroupTable List <int> oldLabelGroupID = db.Labels.Where(a => a.LabelGroups.Any(g => g.BookItem.BookItemID == existingBook.BookItemID)).Select(x => x.LabelID).ToList(); var labelDiffAdd = bookView.BookItemViewModel.SelectedLabels.Except(oldLabelGroupID); var labelDiffDel = oldLabelGroupID.Except(bookView.BookItemViewModel.SelectedLabels); foreach (var arg in labelDiffDel) { LabelGroup delete = db.LabelGroups.Single(x => x.Label.LabelID == arg && x.BookItem.BookItemID == bookView.BookItemViewModel.ID); db.LabelGroups.Remove(delete); } db.SaveChanges(); foreach (var arg in labelDiffAdd) { LabelGroup add = new LabelGroup() { Label = db.Labels.Find(arg), BookItem = existingBook }; db.LabelGroups.Add(add); } db.SaveChanges(); if (cover != null) { DeleteCover_Table(db, bookView.BookItemViewModel.ID, FileType.Cover); AddAttachments_displayable(db, bookView.BookItemViewModel.ID, cover, FileType.Cover); } if (tableOfContents != null) { DeleteCover_Table(db, bookView.BookItemViewModel.ID, FileType.TableOfContents); AddAttachments_displayable(db, bookView.BookItemViewModel.ID, tableOfContents, FileType.TableOfContents); } if (bookView.Cover == null && cover == null) { DeleteCover_Table(db, bookView.BookItemViewModel.ID, FileType.Cover); } if (bookView.Table == null && tableOfContents == null) { DeleteCover_Table(db, bookView.BookItemViewModel.ID, FileType.TableOfContents); } DeleteOldFile(db, bookView.BookItemViewModel.ID, bookView.OldFiles); if (bookView.BookItemViewModel.FileList != null) { foreach (var file in bookView.BookItemViewModel.FileList) { AddAttachments(db, bookView.BookItemViewModel.ID, file, FileType.Attachment); } } return(existingBook); }
public Task UpdateAsync(LabelGroup labelGroup) { labelGroupsDataSet.Update(labelGroup); return(dbContext.SaveChangesAsync()); }