private void GetQuests() { using (EldevinEntities db = new EldevinEntities()) { this.quests = db.quests.Where(x => x.skill_id.Equals(skill_id)).ToList(); } }
private void GetSkills() { using (EldevinEntities db = new EldevinEntities()) { skills = db.skills.ToList(); } }
private List <f_getTotalQtyByQuestID_Result2> GetTotalQuantity(List <string> quests_id) { List <f_getTotalQtyByQuestID_Result2> result = new List <f_getTotalQtyByQuestID_Result2>(); using (EldevinEntities db = new EldevinEntities()) { foreach (string qid in quests_id) { List <f_getTotalQtyByQuestID_Result2> temp = db.f_getTotalQtyByQuestID(qid).ToList(); result = Union2List(result, temp); } } result = result.OrderBy(x => x.item).ToList(); return(result); }
private bool GetSkill() { skill s = null; using (EldevinEntities db = new EldevinEntities()) { s = db.skills.Find(skill_id); } if (s == null) { MessageBox.Show("Skill null"); return(false); } this.skill = s; return(true); }
private void New() { //Open window select quests wSelectQuest wSelectQuest = new wSelectQuest(); wSelectQuest.ShowDialog(); if (selected_quests_id.Count <= 0) { return; } //Handle selected quests dgAllItem.ItemsSource = GetTotalQuantity(selected_quests_id).OrderBy(x => x.skill_id); //Add tab for each skill using (EldevinEntities db = new EldevinEntities()) { quests = db.quests.Include("skill").Where(x => selected_quests_id.Contains(x.quest_id)).ToList(); } skills = new List <skill>(); foreach (quest q in quests) { skills.Add(q.skill); } skills = skills.Distinct().ToList(); foreach (skill s in skills) { TabItem tab = new TabItem(); tab.Name = "tab_" + s.skill_id; tab.Header = s.skill_name; DataGrid dataGrid = new DataGrid(); dataGrid.Name = "dg_" + s.skill_id; tab.Content = dataGrid; tabControl.Items.Add(tab); List <string> param = new List <string>(); List <quest> temp; using (EldevinEntities db = new EldevinEntities()) { temp = db.quests.Where(x => selected_quests_id.Contains(x.quest_id) && x.skill_id.Equals(s.skill_id)).ToList(); } foreach (quest q in temp) { param.Add(q.quest_id); } dataGrid.ItemsSource = GetTotalQuantity(param).OrderBy(x => x.skill_id); TabItem tab2 = new TabItem(); tab2.Name = "tab_req_" + s.skill_id; tab2.Header = s.skill_name + "REQ"; DataGrid dataGrid2 = new DataGrid(); dataGrid2.Name = "dg_req_" + s.skill_id; tab2.Content = dataGrid2; tabControl.Items.Add(tab2); List <quest_req> reqs; using (EldevinEntities db = new EldevinEntities()) { reqs = db.quest_req.Where(x => selected_quests_id.Contains(x.quest_id) && x.quest.skill_id.Equals(s.skill_id)).ToList(); } dataGrid2.ItemsSource = reqs; } }