Пример #1
0
        /// <summary>
        /// Used to save Schedule Demo by skill expert
        /// </summary>
        /// <param name="argLoggedInUser">Logged in user ID</param>
        /// <param name="argScheduleDemoBE">Demo details</param>
        /// <returns></returns>
        public void ScheduleDemo(int argLoggedInUser, ScheduleDemoBE argScheduleDemoBE)
        {
            #region Declarations
            SkillsDBManager         l_SkillsDBManager = new SkillsDBManager("SkillsDBConnection");
            List <IDbDataParameter> l_Parameters      = new List <IDbDataParameter>();
            #endregion
            try
            {
                if (argScheduleDemoBE != null)
                {
                    //Create Parameters
                    l_Parameters.Add(l_SkillsDBManager.CreateParameter(ProcedureParams.LOGGEDINUSERID, argLoggedInUser, DbType.Int32));
                    l_Parameters.Add(l_SkillsDBManager.CreateParameter(ProcedureParams.DEMOSCHEDULE, argScheduleDemoBE.DemoSchedule, DbType.DateTime));
                    l_Parameters.Add(l_SkillsDBManager.CreateParameter(ProcedureParams.UNIQUEID, argScheduleDemoBE.UniqueID, DbType.Int32));
                    l_Parameters.Add(l_SkillsDBManager.CreateParameter(ProcedureParams.COMMENTS, argScheduleDemoBE.Comments, DbType.String));
                    l_Parameters.Add(l_SkillsDBManager.CreateParameter(ProcedureParams.ROOM, argScheduleDemoBE.Room, DbType.String));

                    //Call stored procedure
                    l_SkillsDBManager.Update(StoredProcedures.SAVE_SCHEDULEDEMO, CommandType.StoredProcedure, l_Parameters.ToArray());
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #2
0
        public IHttpActionResult ScheduleDemo(int argLoggedInUser, [FromBody] ScheduleDemoBE argScheduleDemoBE)
        {
            #region Declarations
            SkillExpertActionableBLO l_SkillExpertActionableBLO = new SkillExpertActionableBLO();
            #endregion
            try
            {
                l_SkillExpertActionableBLO.ScheduleDemo(argLoggedInUser, argScheduleDemoBE);
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(Ok());
        }
Пример #3
0
        /// <summary>
        /// This method is used to convert Demo Model to business Entity
        /// </summary>
        /// <param name="argScheduleDemo"></param>
        /// <returns></returns>
        private ScheduleDemoBE ConvertDemoScheduleToBE(ScheduleDemo argScheduleDemo)
        {
            ScheduleDemoBE l_ScheduleDemoBE = new ScheduleDemoBE();

            try
            {
                if (argScheduleDemo != null)
                {
                    l_ScheduleDemoBE.Room         = argScheduleDemo.Room;
                    l_ScheduleDemoBE.Comments     = argScheduleDemo.Comments;
                    l_ScheduleDemoBE.DemoSchedule = argScheduleDemo.DemoSchedule;
                    l_ScheduleDemoBE.UniqueID     = argScheduleDemo.UniqueID;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(l_ScheduleDemoBE);
        }
Пример #4
0
        /// <summary>
        /// This method is used to cal WebAPI to save demo details
        /// </summary>
        /// <param name="argScheduleDemo">Demo details</param>
        /// <returns></returns>
        private async Task <HttpResponseMessage> SaveDemoToDatabase(ScheduleDemo argScheduleDemo)
        {
            #region Declarations
            HttpResponseMessage l_Response       = new HttpResponseMessage();
            ScheduleDemoBE      l_ScheduleDemoBE = new ScheduleDemoBE();
            string l_ManagerResponseURL          = apiBaseURL + "/ScheduleDemo?argLoggedInUser=" + GetLoggedInUserID();
            #endregion

            try
            {
                l_ScheduleDemoBE = ConvertDemoScheduleToBE(argScheduleDemo);

                if (l_ScheduleDemoBE != null)
                {
                    l_Response = await client.PostAsJsonAsync(l_ManagerResponseURL, l_ScheduleDemoBE);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(l_Response);
        }
Пример #5
0
        /// <summary>
        /// Get dashboard data for user
        /// </summary>
        /// <param name="argLoggedInUser">Logged in user ID</param>
        /// <param name="argUserID">User for whom dashboard details should be loaded</param>
        /// <returns></returns>
        public DashboardBE GetDashboardDetails(int argLoggedInUser, int argUserID)
        {
            #region Declarations
            DashboardBE             l_DashboardBE               = new DashboardBE();
            SkillsDBManager         l_SkillsDBManager           = new SkillsDBManager("SkillsDBConnection");
            List <IDbDataParameter> l_Parameters                = new List <IDbDataParameter>();
            DataSet                  l_DashboardDataset         = new DataSet();
            DataTable                l_SkillTable               = new DataTable();
            DataTable                l_SubSkillTable            = new DataTable();
            DataTable                l_DemoDetailsTable         = new DataTable();
            DataTable                l_BadgeDetailsTable        = new DataTable();
            DataTable                l_UserDetailsTable         = new DataTable();
            SkillsBECollection       l_skillsBECollection       = new SkillsBECollection();
            ScheduleDemoBECollection l_ScheduleDemoBECollection = new ScheduleDemoBECollection();
            ScheduleDemoBE           l_ScheduleDemoBE;
            BadgeBECollection        l_BadgeBECollection = new BadgeBECollection();
            BadgeBE                  l_BadgeBE;
            SkillsBE                 l_SkillsBE;
            #endregion
            try
            {
                l_Parameters.Add(l_SkillsDBManager.CreateParameter(ProcedureParams.LOGGEDINUSERID, argLoggedInUser, DbType.Int32));
                l_Parameters.Add(l_SkillsDBManager.CreateParameter(ProcedureParams.USERID, argUserID, DbType.Int32));

                l_DashboardDataset = l_SkillsDBManager.GetDataSet(StoredProcedures.GET_DASHBOARDDETAILS, CommandType.StoredProcedure, l_Parameters.ToArray());

                if (l_DashboardDataset != null && l_DashboardDataset.Tables.Count > 0)
                {
                    l_UserDetailsTable = l_DashboardDataset.Tables[0];
                    l_SkillTable       = l_DashboardDataset.Tables[1];
                    l_SubSkillTable    = l_DashboardDataset.Tables[2];

                    //Get UserDetails
                    if (l_UserDetailsTable != null && l_UserDetailsTable.Rows.Count > 0)
                    {
                        l_DashboardBE.UserID             = l_UserDetailsTable.Rows[0]["UserID"] == DBNull.Value ? 0 : Convert.ToInt32(l_UserDetailsTable.Rows[0]["UserID"]);
                        l_DashboardBE.UserName           = l_UserDetailsTable.Rows[0]["UserName"] == DBNull.Value ? string.Empty : Convert.ToString(l_UserDetailsTable.Rows[0]["UserName"]);
                        l_DashboardBE.EmailID            = l_UserDetailsTable.Rows[0]["EmailID"] == DBNull.Value ? string.Empty : Convert.ToString(l_UserDetailsTable.Rows[0]["EmailID"]);
                        l_DashboardBE.InitialSkillExists = l_UserDetailsTable.Rows[0]["InitialSkillExists"] == DBNull.Value ? false : Convert.ToBoolean(l_UserDetailsTable.Rows[0]["InitialSkillExists"]);
                    }

                    //Get skill and subskill
                    if (l_SkillTable != null && l_SkillTable.Rows.Count > 0)
                    {
                        for (int i = 0; i < l_SkillTable.Rows.Count; i++)
                        {
                            l_SkillsBE = new SkillsBE();
                            DataRow l_Row = l_SkillTable.Rows[i];
                            l_SkillsBE.SkillID              = l_Row["SkillID"] == DBNull.Value ? 0 : Convert.ToInt32(l_Row["SkillID"]);
                            l_SkillsBE.SkillName            = l_Row["SkillName"] == DBNull.Value ? string.Empty : Convert.ToString(l_Row["SkillName"]);
                            l_SkillsBE.SkillPoints          = l_Row["SkillPoints"] == DBNull.Value ? 0 : Convert.ToInt32(l_Row["SkillPoints"]);
                            l_SkillsBE.SkillType            = l_Row["SkillType"] == DBNull.Value ? string.Empty : Convert.ToString(l_Row["SkillType"]);
                            l_SkillsBE.SubSkillBECollection = GetSubSkillData(l_SkillsBE.SkillID, l_SubSkillTable, l_SkillsBE.SkillType);
                            l_skillsBECollection.Add(l_SkillsBE);
                        }

                        l_DashboardBE.SkillsBECollection = l_skillsBECollection;
                    }

                    //Get badge data
                    l_BadgeDetailsTable = l_DashboardDataset.Tables[3];
                    if (l_BadgeDetailsTable != null && l_BadgeDetailsTable.Rows.Count > 0)
                    {
                        for (int i = 0; i < l_BadgeDetailsTable.Rows.Count; i++)
                        {
                            DataRow l_Row = l_BadgeDetailsTable.Rows[i];
                            l_BadgeBE = new BadgeBE();

                            l_BadgeBE.BadgeID    = l_Row["BadgeID"] == DBNull.Value ? 0 : Convert.ToInt32(l_Row["BadgeID"]);
                            l_BadgeBE.BadgeName  = l_Row["BadgeName"] == DBNull.Value ? string.Empty : Convert.ToString(l_Row["BadgeName"]);
                            l_BadgeBE.BadgeURL   = l_Row["BadgeImageURL"] == DBNull.Value ? string.Empty : Convert.ToString(l_Row["BadgeImageURL"]);
                            l_BadgeBE.BadgeCount = l_Row["BadgeCount"] == DBNull.Value ? 0 : Convert.ToInt32(l_Row["BadgeCount"]);

                            l_BadgeBECollection.Add(l_BadgeBE);
                        }

                        l_DashboardBE.BadgeBECollection = l_BadgeBECollection;
                    }

                    //Get demo details
                    l_DemoDetailsTable = l_DashboardDataset.Tables[4];
                    if (l_DemoDetailsTable != null && l_DemoDetailsTable.Rows.Count > 0)
                    {
                        for (int i = 0; i < l_DemoDetailsTable.Rows.Count; i++)
                        {
                            DataRow l_Row = l_DemoDetailsTable.Rows[i];
                            l_ScheduleDemoBE = new ScheduleDemoBE();

                            l_ScheduleDemoBE.UniqueID         = l_Row["UDID"] == DBNull.Value ? 0 : Convert.ToInt32(l_Row["UDID"]);
                            l_ScheduleDemoBE.UserID           = l_Row["UserID"] == DBNull.Value ? 0 : Convert.ToInt32(l_Row["UserID"]);
                            l_ScheduleDemoBE.SkillID          = l_Row["SkillID"] == DBNull.Value ? 0 : Convert.ToInt32(l_Row["SkillID"]);
                            l_ScheduleDemoBE.SubSkillID       = l_Row["SubskillID"] == DBNull.Value ? 0 : Convert.ToInt32(l_Row["SubskillID"]);
                            l_ScheduleDemoBE.SkillName        = l_Row["SkillName"] == DBNull.Value ? string.Empty : Convert.ToString(l_Row["SkillName"]);
                            l_ScheduleDemoBE.SubSkillName     = l_Row["SubskillName"] == DBNull.Value ? string.Empty : Convert.ToString(l_Row["SubskillName"]);
                            l_ScheduleDemoBE.Room             = l_Row["Room"] == DBNull.Value ? string.Empty : Convert.ToString(l_Row["Room"]);
                            l_ScheduleDemoBE.EventConductedBy = l_Row["EventConductedBy"] == DBNull.Value ? string.Empty : Convert.ToString(l_Row["EventConductedBy"]);
                            l_ScheduleDemoBE.DemoSchedule     = l_Row["DateAndTime"] == DBNull.Value ? DateTime.Now : Convert.ToDateTime(l_Row["DateAndTime"]);

                            l_ScheduleDemoBECollection.Add(l_ScheduleDemoBE);
                        }

                        l_DashboardBE.ScheduleDemoBECollection = l_ScheduleDemoBECollection;
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }

            return(l_DashboardBE);
        }