예제 #1
0
        public bool PostSkill(SkillDAO skill)
        {
            SkillServiceClient client = new SkillServiceClient();

            try
            {
                bool result = client.CreateSkill(skill);
                return result;
            }
            catch (FaultException<KaskServiceException> e)
            {
                throw new HttpException(e.Message);
            }
        }
예제 #2
0
 public string relateSkillToSkillGroup(string skillName, string skillGroupName)
 {
     return(SkillDAO.relateSkillToSkillGroup(skillName, skillGroupName));
 }
예제 #3
0
 public string modifySkill(string skillName, string newName)
 {
     return(SkillDAO.modifySkill(skillName, newName));
 }
예제 #4
0
 public string createSkill(string skillName)
 {
     return(SkillDAO.createSkill(skillName));
 }
예제 #5
0
 public SkillEmployeesResult getEmployees(string id)
 {
     return(SkillDAO.getEmployees(id));
 }
예제 #6
0
 public SkillsCategoryResult getSkill(string id)
 {
     return(SkillDAO.getSkill(id));
 }
예제 #7
0
 public SkillsResult Get()
 {
     return(SkillDAO.GetList());
 }
예제 #8
0
 public PartialViewResult Tree(int id)
 {
     return(PartialView(SkillDAO.Example().PerksAvailable));
 }
예제 #9
0
 public static List <UserProfile> GetSkilledUsers(int moduleId, int roleId)
 {
     return(SkillDAO.getUserBySkill(moduleId, roleId));
 }
예제 #10
0
        public async Task<ActionResult> Create(FormCollection collection)
        {
            try
            {
                if (!string.IsNullOrEmpty(Request.Form["skillName"]))
                {
                    // save application form data back to database through service
                    using (HttpClient httpClient = new HttpClient())
                    {
                        httpClient.BaseAddress = new Uri("http://localhost:51309");
                        httpClient.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
                        HttpResponseMessage result = new HttpResponseMessage();
                        string resultContent = "";

                        // gather SkillOpening form data
                        SkillDAO skill = new SkillDAO();
                        skill.SkillName = Request.Form["skillName"];
                        
                        // post (save) SkillOpening data
                        result = httpClient.PostAsJsonAsync(ServiceURIs.ServiceSkillUri, skill).Result;
                        resultContent = result.Content.ReadAsStringAsync().Result;

                        // get skill id from last insert
                        // get correct skill id of the skill we just saved
                        var skills = await ServerResponse<List<SkillDAO>>.GetResponseAsync(ServiceURIs.ServiceSkillUri);
                        int lastSkillId = skills.Last().SkillID;

                        // gather data for QuestionBank
                        
                        // TODO: change the hardcoded "50" into the length of all available mc options
                        for (int i = 0; i < 50; i++)
                        {
                            for (int j = 0; j < 50; j++)
                            {
                                try
                                {
                                    QuestionBankDAO questionBank = new QuestionBankDAO();
                                    questionBank.MCQuestionID = Convert.ToInt32(Request.Form["MCQuestion_" + j]);

                                    // check if this is a selected multiple choice option
                                    if (Request.Form["MCOptionID_" + j + "_" + i] != null)
                                    {
                                        questionBank.MCOptionID = i;

                                        // check if this is a valid option (a "correct answer")
                                        if (Request.Form["Valid_MCOptionID_" + j + "_" + i] != null)
                                        {
                                            questionBank.MCCorrectOption = 1;
                                        }
                                        else
                                        {
                                            questionBank.MCCorrectOption = 0;
                                        }

                                        // post data for QuestionBank
                                        result = httpClient.PostAsJsonAsync(ServiceURIs.ServiceQuestionBankUri, questionBank).Result;
                                        resultContent = result.Content.ReadAsStringAsync().Result;

                                        // get question bank id from last insert
                                        // get correct question bank id of the question bank we just saved
                                        var questionBanks = await ServerResponse<List<QuestionBankDAO>>.GetResponseAsync(ServiceURIs.ServiceQuestionBankUri);
                                        int lastQuestionBankId = questionBanks.Last().QuestionBankID;

                                        // then connect up QuestionBank data to SkillQuestionBank
                                        // gather skill-question bank data
                                        SkillQuestionBankDAO skillQuestionBank = new SkillQuestionBankDAO();
                                        skillQuestionBank.SkillID = lastSkillId;
                                        skillQuestionBank.QuestionBankID = lastQuestionBankId;

                                        // and then post data for skill-question bank
                                        result = httpClient.PostAsJsonAsync(ServiceURIs.ServiceSkillQuestionBankUri, skillQuestionBank).Result;
                                        resultContent = result.Content.ReadAsStringAsync().Result;
                                    }
                                }
                                catch { }
                            }
                        }
                    }

                    return RedirectToAction("Index", "Skills");
                }
                else
                {
                    // TODO: validation later on...
                    return RedirectToAction("Create");
                }
            }
            catch
            {
                // TODO: validation later on...
                return RedirectToAction("Create");
            }
        }
예제 #11
0
 public SkillBC(int userId)
 {
     skillDAO = new SkillDAO(userId);
 }