/// <summary>
        /// This is a generic method to get subskills for a skill
        /// </summary>
        /// <param name="argSkillID"></param>
        /// <returns></returns>
        public async Task <SubSkillBECollection> GetSubskillsForSkill(int argSkillID)
        {
            #region Declarations
            SubSkillBECollection l_SubskillBECollection = new SubSkillBECollection();
            int    l_LoggedInUser = 0;
            string l_skillsURL    = string.Empty;
            #endregion

            try
            {
                InitializeClient();
                l_LoggedInUser = GetLoggedInUserID();
                l_skillsURL    = apiBaseURL + "/GetAllSubSkills?argLoggedInUser="******"&argSkillID=" + argSkillID + "";
                HttpResponseMessage l_SkillsData = await client.GetAsync(l_skillsURL);

                if (l_SkillsData != null && l_SkillsData.IsSuccessStatusCode)
                {
                    var l_SkillResponse = l_SkillsData.Content.ReadAsStringAsync().Result;
                    l_SubskillBECollection = JsonConvert.DeserializeObject <SubSkillBECollection>(l_SkillResponse);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(l_SubskillBECollection);
        }
        /// <summary>
        /// Convert subskill collection to view model
        /// </summary>
        /// <param name="argSubskillsBE"></param>
        /// <returns></returns>
        protected SubSkillCollection ConvertSubskillCollectionToModel(SubSkillBECollection argSubskillsBE)
        {
            SubSkillCollection l_SubskillCollection = new SubSkillCollection();
            Subskills          l_Subskills;

            try
            {
                if (argSubskillsBE != null && argSubskillsBE.Count > 0)
                {
                    foreach (var subskills in argSubskillsBE)
                    {
                        l_Subskills              = new Subskills();
                        l_Subskills.SubSkillID   = subskills.SubSkillID;
                        l_Subskills.SubSkillName = subskills.SubSkillName;
                        l_Subskills.SkillID      = subskills.SkillID;
                        l_SubskillCollection.Add(l_Subskills);
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }

            return(l_SubskillCollection);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// This method is used to convert Intial Request to business entity
        /// </summary>
        /// <param name="argSkillRequest"></param>
        /// <returns></returns>
        private UserInitialSkillRequestBE ConvertSkillRequestToBusinessEntity(UserInitialSkillRequest argSkillRequest)
        {
            #region Declarations
            UserInitialSkillRequestBE l_UserInitialSkillRequestBE = new UserInitialSkillRequestBE();
            SubSkillBECollection      l_SubskillsBECollection     = new SubSkillBECollection();
            SubskillsBE l_Subskills;
            #endregion
            try
            {
                if (argSkillRequest != null)
                {
                    //Comments
                    l_UserInitialSkillRequestBE.Comments = argSkillRequest.Comments;

                    //Subskills
                    if (argSkillRequest.SubskillCollection != null && argSkillRequest.SubskillCollection.Count > 0)
                    {
                        foreach (var subskills in argSkillRequest.SubskillCollection)
                        {
                            l_Subskills            = new SubskillsBE();
                            l_Subskills.SubSkillID = subskills.SubSkillID;
                            l_Subskills.SkillID    = subskills.SkillID;
                            l_SubskillsBECollection.Add(l_Subskills);
                        }
                        l_UserInitialSkillRequestBE.UserSubskills = l_SubskillsBECollection;
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(l_UserInitialSkillRequestBE);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Method to fetch subskill data on the basis of skill ID and skill type
        /// </summary>
        /// <param name="argSkillID">Skill ID</param>
        /// <param name="argSubSkillTable">DataTable with subskill details</param>
        /// <param name="argSkillType">Skill Type (Required/Acquired)</param>
        /// <returns></returns>
        private SubSkillBECollection GetSubSkillData(int argSkillID, DataTable argSubSkillTable, string argSkillType)
        {
            SubSkillBECollection l_SubSkillBECollection = new SubSkillBECollection();
            SubskillsBE          l_SubskillsBE;

            try
            {
                if (argSubSkillTable != null && argSubSkillTable.Rows.Count > 0)
                {
                    var requiredSubSkills = argSubSkillTable.AsEnumerable().Where(r => (int)r["RequiredSkillID"] == argSkillID && r["SubSkillType"].ToString().ToUpper() == argSkillType.ToUpper());

                    foreach (var item in requiredSubSkills)
                    {
                        l_SubskillsBE              = new SubskillsBE();
                        l_SubskillsBE.SkillID      = item["RequiredSkillID"] == DBNull.Value ? 0 : Convert.ToInt32(item["RequiredSkillID"]);
                        l_SubskillsBE.SubSkillID   = item["RequiredSubskillID"] == DBNull.Value ? 0 : Convert.ToInt32(item["RequiredSubskillID"]);
                        l_SubskillsBE.SkillName    = item["SkillName"] == DBNull.Value ? string.Empty : Convert.ToString(item["SkillName"]);
                        l_SubskillsBE.SubSkillName = item["SubskillName"] == DBNull.Value ? string.Empty : Convert.ToString(item["SubskillName"]);
                        l_SubskillsBE.SubSkillType = item["SubSkillType"] == DBNull.Value ? string.Empty : Convert.ToString(item["SubSkillType"]);
                        l_SubskillsBE.SkillPoints  = item["SkillPoints"] == DBNull.Value ? 0 : Convert.ToInt32(item["SkillPoints"]);

                        l_SubSkillBECollection.Add(l_SubskillsBE);
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(l_SubSkillBECollection);
        }
        /// <summary>
        /// Method to convert subskill model collection from Business Entity
        /// </summary>
        /// <param name="argsubSkillBECollection">Subskill business entity</param>
        /// <returns></returns>
        private SubSkillCollection GetSubskillcollection(SubSkillBECollection argsubSkillBECollection)
        {
            #region Declarations
            SubSkillCollection l_SubSkillCollection = new SubSkillCollection();
            Subskills          l_SubSkills;
            #endregion
            try
            {
                if (argsubSkillBECollection != null && argsubSkillBECollection.Count > 0)
                {
                    foreach (var subskillBE in argsubSkillBECollection)
                    {
                        l_SubSkills              = new Subskills();
                        l_SubSkills.SubSkillID   = subskillBE.SubSkillID;
                        l_SubSkills.SubSkillName = subskillBE.SubSkillName;
                        l_SubSkills.SkillID      = subskillBE.SkillID;
                        l_SubSkills.SkillPoints  = subskillBE.SkillPoints;
                        l_SubSkills.SubSkillType = subskillBE.SubSkillType;
                        l_SubSkills.SkillName    = subskillBE.SkillName;

                        l_SubSkillCollection.Add(l_SubSkills);
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }

            return(l_SubSkillCollection);
        }
Ejemplo n.º 6
0
        public async Task <JsonResult> GetSubskills(int argSkillID)
        {
            #region Declarations
            SubSkillBECollection l_SubSkills          = new SubSkillBECollection();
            SubSkillCollection   l_SubskillCollection = new SubSkillCollection();
            #endregion

            l_SubSkills = await GetSubskillsForSkill(argSkillID);

            if (l_SubSkills != null && l_SubSkills.Count > 0)
            {
                l_SubskillCollection = ConvertSubskillCollectionToModel(l_SubSkills);
            }

            return(Json(l_SubskillCollection, JsonRequestBehavior.AllowGet));
        }
        /// <summary>
        /// This function is used to convert model to Business Entity
        /// </summary>
        /// <param name="argImproveSkills"></param>
        /// <param name="argGUID"></param>
        /// <returns></returns>
        private ImproveSkillsBE ConvertImproveSkillRequestToBusinessEntity(ImproveSkills argImproveSkills, string argGUID)
        {
            #region Declarations
            ImproveSkillsBE      l_ImproveSkillsBE       = new ImproveSkillsBE();
            SubSkillBECollection l_SubskillsBECollection = new SubSkillBECollection();
            SubskillsBE          l_Subskills;
            #endregion
            try
            {
                if (argImproveSkills != null)
                {
                    //Comments
                    l_ImproveSkillsBE.Comments = argImproveSkills.Comments;

                    //File details
                    if (argImproveSkills.File != null)
                    {
                        l_ImproveSkillsBE.FileUploadName = argImproveSkills.File.FileName;
                        l_ImproveSkillsBE.FileUploadGUID = argGUID;
                    }

                    //Mode
                    l_ImproveSkillsBE.Mode = argImproveSkills.Mode;

                    //Subskills
                    if (argImproveSkills.SubskillCollection != null && argImproveSkills.SubskillCollection.Count > 0)
                    {
                        foreach (var subskills in argImproveSkills.SubskillCollection)
                        {
                            l_Subskills            = new SubskillsBE();
                            l_Subskills.SubSkillID = subskills.SubSkillID;
                            l_Subskills.SkillID    = subskills.SkillID;
                            l_SubskillsBECollection.Add(l_Subskills);
                        }
                        l_ImproveSkillsBE.UserSubskills = l_SubskillsBECollection;
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(l_ImproveSkillsBE);
        }
        public async Task <ActionResult> GetSubskills(int argSkillID)
        {
            #region Declarations
            ImproveSkills        l_ImproveSkills      = new ImproveSkills();
            SubSkillBECollection l_SubSkills          = new SubSkillBECollection();
            SubSkillCollection   l_SubskillCollection = new SubSkillCollection();
            #endregion

            l_SubSkills = await GetSubskillsForSkill(argSkillID);

            if (l_SubSkills != null && l_SubSkills.Count > 0)
            {
                l_SubskillCollection = ConvertSubskillCollectionToModel(l_SubSkills);
                l_ImproveSkills.SubskillCollection = l_SubskillCollection;
            }


            return(PartialView("_partialImproveSubskills", l_ImproveSkills));
        }
Ejemplo n.º 9
0
        public async Task <ActionResult> GetSubskills(int argSkillID)
        {
            #region Declarations
            UserInitialSkillRequest l_UserInitialSkillRequest = new UserInitialSkillRequest();
            SubSkillBECollection    l_SubSkills          = new SubSkillBECollection();
            SubSkillCollection      l_SubskillCollection = new SubSkillCollection();
            #endregion

            l_SubSkills = await GetSubskillsForSkill(argSkillID);

            if (l_SubSkills != null && l_SubSkills.Count > 0)
            {
                l_SubskillCollection = ConvertSubskillCollectionToModel(l_SubSkills);
                l_UserInitialSkillRequest.SubskillCollection = l_SubskillCollection;
            }


            return(PartialView("_partialSubskills", l_UserInitialSkillRequest));
        }
Ejemplo n.º 10
0
        /// <summary>
        /// This method is used to generate Skill XML
        /// </summary>
        /// <param name="argSubskills"></param>
        /// <returns></returns>
        private XElement GenerateSkillXML(SubSkillBECollection argSubskills)
        {
            XElement l_skillXML = null;

            try
            {
                l_skillXML = new XElement("SkillSet",
                                          from skill in argSubskills
                                          select new XElement("Skill",
                                                              new XElement("SkillID", skill.SkillID),
                                                              new XElement("SubskillID", skill.SubSkillID)
                                                              ));
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(l_skillXML);
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Used to fetch all subskills for a skill
        /// </summary>
        /// <param name="argLoggedInUser">Logged in UserID</param>
        /// <param name="argSkillID">SkillID</param>
        /// <returns></returns>
        public SubSkillBECollection GetAllSubSkills(int argLoggedInUser, int argSkillID)
        {
            #region Declarations
            SubSkillBECollection    l_SubSkillCollection = new SubSkillBECollection();
            SkillsDBManager         l_SkillsDBManager    = new SkillsDBManager("SkillsDBConnection");
            List <IDbDataParameter> l_Parameters         = new List <IDbDataParameter>();
            DataTable   l_SubSkillDataTable = new DataTable();
            SubskillsBE l_SubSkill;
            int         l_SubSkillCount = 0;
            #endregion
            try
            {
                l_Parameters.Add(l_SkillsDBManager.CreateParameter(ProcedureParams.LOGGEDINUSERID, argLoggedInUser, DbType.Int32));
                l_Parameters.Add(l_SkillsDBManager.CreateParameter(ProcedureParams.SKILLID, argSkillID, DbType.Int32));

                l_SubSkillDataTable = l_SkillsDBManager.GetDataTable(StoredProcedures.GET_ALLSUBSKILLS_FORASKILL, CommandType.StoredProcedure, l_Parameters.ToArray());

                if (l_SubSkillDataTable != null && l_SubSkillDataTable.Rows.Count > 0)
                {
                    l_SubSkillCount = l_SubSkillDataTable.Rows.Count;
                    for (int i = 0; i < l_SubSkillCount; i++)
                    {
                        l_SubSkill = new SubskillsBE();

                        DataRow l_Row = l_SubSkillDataTable.Rows[i];

                        l_SubSkill.SkillID      = l_Row["SkillID"] == DBNull.Value ? 0 : Convert.ToInt32(l_Row["SkillID"]);
                        l_SubSkill.SubSkillID   = l_Row["SubskillID"] == DBNull.Value ? 0 : Convert.ToInt32(l_Row["SubskillID"]);
                        l_SubSkill.SubSkillName = l_Row["SubskillName"] == DBNull.Value ? string.Empty : Convert.ToString(l_Row["SubskillName"]);

                        l_SubSkillCollection.Add(l_SubSkill);
                    }
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            return(l_SubSkillCollection);
        }
Ejemplo n.º 12
0
        public IHttpActionResult GetAllSubSkills(int argLoggedInUser, int argSkillID)
        {
            #region Declarations
            SkillBLO             l_SkillsBLO          = new SkillBLO();
            SubSkillBECollection l_SubSkillCollection = new SubSkillBECollection();
            #endregion
            try
            {
                l_SubSkillCollection = l_SkillsBLO.GetAllSubSkills(argLoggedInUser, argSkillID);

                if (l_SubSkillCollection == null || l_SubSkillCollection.Count == 0)
                {
                    return(NotFound());
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(Ok(l_SubSkillCollection));
        }