public async Task <ActionResult> GetPendingManagerApprovals(string argRequestType) { #region Declarations PendingManagerApprovals l_Requests = new PendingManagerApprovals(); PendingManagerApprovalsBECollection l_ApprovalBECollection = new PendingManagerApprovalsBECollection(); PendingManagerApprovalCollection l_ApprovalCollection = new PendingManagerApprovalCollection(); string l_skillsURL = string.Empty; #endregion l_skillsURL = apiBaseURL + "/GetManagerApprovals?argLoggedInUser="******"&argType=" + argRequestType + ""; HttpResponseMessage l_SkillsData = await client.GetAsync(l_skillsURL); if (l_SkillsData != null && l_SkillsData.IsSuccessStatusCode) { var l_SkillResponse = l_SkillsData.Content.ReadAsStringAsync().Result; l_ApprovalBECollection = JsonConvert.DeserializeObject <PendingManagerApprovalsBECollection>(l_SkillResponse); } l_ApprovalCollection = ConverMendingManagerApprovalsToModel(l_ApprovalBECollection); return(PartialView("_partialPendingManagerApprovals", l_ApprovalCollection)); }
public IHttpActionResult GetManagerApprovals(int argLoggedInUser, string argType) { #region Declarations ManagerActionablesBLO l_ManagerActionablesBLO = new ManagerActionablesBLO(); PendingManagerApprovalsBECollection l_PendingManagerApprovalsBECollection = new PendingManagerApprovalsBECollection(); #endregion try { l_PendingManagerApprovalsBECollection = l_ManagerActionablesBLO.GetPendingManagerApprovals(argLoggedInUser, argType); if (l_PendingManagerApprovalsBECollection == null || l_PendingManagerApprovalsBECollection.Count == 0) { return(NotFound()); } } catch (Exception ex) { throw ex; } return(Ok(l_PendingManagerApprovalsBECollection)); }
/// <summary> /// Method to convert ManagerApproval business entity to model /// </summary> /// <param name="argApprovalsBECollection"></param> /// <returns></returns> private PendingManagerApprovalCollection ConverMendingManagerApprovalsToModel(PendingManagerApprovalsBECollection argApprovalsBECollection) { #region Declarations PendingManagerApprovalCollection l_PendingApprovalsCollection = new PendingManagerApprovalCollection(); PendingManagerApprovals l_Approvals; #endregion try { if (argApprovalsBECollection != null && argApprovalsBECollection.Count > 0) { foreach (var item in argApprovalsBECollection) { l_Approvals = new PendingManagerApprovals(); l_Approvals.Comments = item.Comments; l_Approvals.Status = item.Status; l_Approvals.RequestedDate = item.RequestedDate; l_Approvals.RequestType = item.RequestType; l_Approvals.SkillName = item.SkillName; l_Approvals.SkillPoints = item.SkillPoints; l_Approvals.SubSkillName = item.SubSkillName; l_Approvals.RequestedBy = item.RequestedBy; l_Approvals.UniqueID = item.UniqueID; l_Approvals.FileGUID = item.FileGUID; l_Approvals.FileName = item.FileName; l_Approvals.RequestCode = item.RequestCode; l_Approvals.BadgeGivenFor = item.BadgeGivenFor; l_Approvals.BadgeID = item.BadgeID; l_Approvals.BadgeName = item.BadgeName; l_Approvals.BadgeImageURL = item.BadgeImageURL; l_PendingApprovalsCollection.Add(l_Approvals); } } } catch (Exception ex) { throw ex; } return(l_PendingApprovalsCollection); }
/// <summary> /// Get the list of pending manager approvals /// </summary> /// <param name="argLoggedInUser">Logged in user ID</param> /// <param name="argType">Request Type</param> /// <returns></returns> public PendingManagerApprovalsBECollection GetPendingManagerApprovals(int argLoggedInUser, string argType) { #region Declarations PendingManagerApprovalsBECollection l_requestCollection = new PendingManagerApprovalsBECollection(); SkillsDBManager l_SkillsDBManager = new SkillsDBManager("SkillsDBConnection"); List <IDbDataParameter> l_Parameters = new List <IDbDataParameter>(); DataTable l_SkillDataTable = new DataTable(); PendingManagerApprovalsBE l_RequestBE; int l_SkillCount = 0; #endregion try { l_Parameters.Add(l_SkillsDBManager.CreateParameter(ProcedureParams.LOGGEDINUSERID, argLoggedInUser, DbType.Int32)); if (string.IsNullOrEmpty(argType)) { l_Parameters.Add(l_SkillsDBManager.CreateParameter(ProcedureParams.TYPE, DBNull.Value, DbType.String)); } else { l_Parameters.Add(l_SkillsDBManager.CreateParameter(ProcedureParams.TYPE, argType, DbType.String)); } l_SkillDataTable = l_SkillsDBManager.GetDataTable(StoredProcedures.GET_ALLPENDINGMANAGERAPPROVALS, CommandType.StoredProcedure, l_Parameters.ToArray()); if (l_SkillDataTable != null && l_SkillDataTable.Rows.Count > 0) { l_SkillCount = l_SkillDataTable.Rows.Count; for (int i = 0; i < l_SkillCount; i++) { l_RequestBE = new PendingManagerApprovalsBE(); DataRow l_Row = l_SkillDataTable.Rows[i]; l_RequestBE.RequestType = l_Row["Request type"] == DBNull.Value ? string.Empty : Convert.ToString(l_Row["Request type"]); l_RequestBE.Status = l_Row["Status"] == DBNull.Value ? string.Empty : Convert.ToString(l_Row["Status"]); l_RequestBE.Comments = l_Row["Comments"] == DBNull.Value ? string.Empty : Convert.ToString(l_Row["Comments"]); l_RequestBE.RequestedDate = l_Row["Request date"] == DBNull.Value ? DateTime.Now : Convert.ToDateTime(l_Row["Request date"]); l_RequestBE.SkillName = l_Row["SkillName"] == DBNull.Value ? string.Empty : Convert.ToString(l_Row["SkillName"]); l_RequestBE.SubSkillName = l_Row["SubskillName"] == DBNull.Value ? string.Empty : Convert.ToString(l_Row["SubskillName"]); l_RequestBE.SkillPoints = l_Row["SkillPoints"] == DBNull.Value ? 0 : Convert.ToInt32(l_Row["SkillPoints"]); l_RequestBE.UniqueID = l_Row["UniqueID"] == DBNull.Value ? 0 : Convert.ToInt32(l_Row["UniqueID"]); l_RequestBE.SubSkillName = l_Row["SubskillName"] == DBNull.Value ? string.Empty : Convert.ToString(l_Row["SubskillName"]); l_RequestBE.FileName = l_Row["FileName"] == DBNull.Value ? string.Empty : Convert.ToString(l_Row["FileName"]); l_RequestBE.FileGUID = l_Row["FileGUID"] == DBNull.Value ? string.Empty : Convert.ToString(l_Row["FileGUID"]); l_RequestBE.RequestedBy = l_Row["UserName"] == DBNull.Value ? string.Empty : Convert.ToString(l_Row["UserName"]); l_RequestBE.RequestCode = l_Row["RequestCode"] == DBNull.Value ? string.Empty : Convert.ToString(l_Row["RequestCode"]); //Badge Details l_RequestBE.BadgeGivenFor = l_Row["BadgeGivenFor"] == DBNull.Value ? string.Empty : Convert.ToString(l_Row["BadgeGivenFor"]); l_RequestBE.BadgeName = l_Row["BadgeName"] == DBNull.Value ? string.Empty : Convert.ToString(l_Row["BadgeName"]); l_RequestBE.BadgeImageURL = l_Row["BadgeImageURL"] == DBNull.Value ? string.Empty : Convert.ToString(l_Row["BadgeImageURL"]); l_RequestBE.BadgeID = l_Row["BadgeID"] == DBNull.Value ? 0 : Convert.ToInt32(l_Row["BadgeID"]); l_requestCollection.Add(l_RequestBE); } } } catch (Exception ex) { throw ex; } return(l_requestCollection); }