Exemplo n.º 1
0
 private static void AddUserDashboard(UserDashboard userdashboard)
 {
     using (TeamDbContext dbContext = new TeamDbContext())
     {
         dbContext.UserDashboards.Add(userdashboard);
         dbContext.SaveChanges();
     }
 }
Exemplo n.º 2
0
        public int CreateUserDashboardWidget(int userId, UserDashboardWidgetDto userDashboardWidget)
        {
            int userDashboardId;

            if (userDashboardWidget.PageId == null)
            {
                var newUserDashboard = new UserDashboard
                {
                    UserId = userId,
                    Name   = userDashboardWidget.PageName
                };

                _context.UserDashboard.Add(newUserDashboard);

                _context.SaveChanges();

                userDashboardId = newUserDashboard.Id;
            }
            else
            {
                var existingUserDashboard = _context.UserDashboard.Include(x => x.UserDashboardWidgets)
                                            .FirstOrDefault(x => x.Id == userDashboardWidget.PageId);

                if (existingUserDashboard == null)
                {
                    return(0);
                }

                userDashboardId = existingUserDashboard.Id;

                _context.UserDashboardWidget.RemoveRange(existingUserDashboard.UserDashboardWidgets);
                _context.SaveChanges();
            }

            foreach (var item in from lgDto in userDashboardWidget.Item.Lg.ToList()
                     let widgetName = userDashboardWidget.Widget.FirstOrDefault(w => w.IndexId == Convert.ToInt32(lgDto.I))
                                      ?.Name
                                      let widgetId = _context.Widget.SingleOrDefault(x => x.Name == widgetName)?.Id
                                                     select new UserDashboardWidget
            {
                CreatedAt = DateTime.Now,
                CreatedById = userId,
                Height = lgDto.H,
                Width = lgDto.W,
                XAxis = lgDto.X,
                YAxis = lgDto.Y,
                UserDashboardId = userDashboardId,
                WidgetId = widgetId,
                Index = lgDto.I
            })
            {
                _context.UserDashboardWidget.Add(item);
                _context.SaveChanges();
            }

            return(userDashboardId);
        }
Exemplo n.º 3
0
 public bool DeleteUserDashboard(UserDashboard userDashboard)
 {
     if (userDashboard == null)
     {
         return(false);
     }
     _unitOfWork.UserDashboardRepository.Delete(userDashboard);
     _unitOfWork.Save();
     return(true);
 }
Exemplo n.º 4
0
 private static void AddUserDashboard(UserDashboard userdashboard)
 {
     using (TeamDbContext dbContext = new TeamDbContext())
     {
         if (dbContext.UserDashboards.FirstOrDefault(e => e.Id == userdashboard.Id) == null)
         {
             dbContext.UserDashboards.Add(userdashboard);
             dbContext.SaveChanges();
         }
     }
 }
Exemplo n.º 5
0
 private static void UpdateUserDashboard(UserDashboard userdashboard)
 {
     using (TeamDbContext dbContext = new TeamDbContext())
     {
         if (dbContext.UserDashboards.AsNoTracking().FirstOrDefault(e => e.Id == userdashboard.Id && e.Deleted == false) != null)
         {
             dbContext.UserDashboards.UpdateRange(userdashboard);
             dbContext.SaveChanges();
         }
     }
 }
Exemplo n.º 6
0
        public static UserDashboard GetDashboard(string username)
        {
            using (ctaDBEntities entities = new ctaDBEntities())
            {
                UserDashboard result = new UserDashboard(username);
                entities.Database.Connection.Open();

                int    user_id         = UserService.GetUserId(username);
                string user_type       = entities.Tenants.Where(t => t.Id == user_id).Select(t => t.Tenant_Type.Name).First();
                var    user_portfolios = entities.Portfolios.Where(ptfolio => ptfolio.user_id == user_id);

                foreach (var portfolio in user_portfolios)
                {
                    DashboardItem dashboard_item = new DashboardItem()
                    {
                        Portfolio = portfolio.name, Symbols = new List <ctaCOMMON.Charts.Symbol>(), Portfolio_Id = portfolio.Id
                    };
                    foreach (var stock in portfolio.Portfolio_Stock)
                    {
                        List <Candel> quotes       = new List <Candel>();
                        Candel        today_candel = null;
                        foreach (var quote in stock.Stock.Stock_Quote.Where(s => s.date_round < DateTime.Now.AddDays(-1) || user_type != "FREE").OrderBy(itm => itm.date_round))
                        {
                            Candel candel = new Candel()
                            {
                                Date = quote.date_round, Open = quote.opening, Close = quote.closing, Minimun = quote.minimun, Maximun = quote.maximun, Volume = (double)quote.volume
                            };
                            quotes.Add(candel);
                            today_candel = candel;
                        }
                        SymbolIntradiaryInfo symbolIntradiaryInfo = QuotesService.GetSymbolIntradiaryInfo(stock.stock_id);
                        if (today_candel != null)
                        {
                            symbolIntradiaryInfo.Volume  = today_candel.Volume;
                            symbolIntradiaryInfo.Maximun = today_candel.Maximun;
                            symbolIntradiaryInfo.Minimun = today_candel.Minimun;
                        }

                        ctaCOMMON.Charts.Symbol dashboard_item_symbol = new ctaCOMMON.Charts.Symbol()
                        {
                            Symbol_ID = stock.stock_id, Symbol_Name = stock.Stock.symbol, Symbol_Company_Name = stock.Stock.name, Symbol_Market_ID = stock.Stock.Market.Id, Symbol_Market = stock.Stock.Market.name, Quotes = quotes.OrderBy(q => q.Date).ToList(), Intradiary_Info = symbolIntradiaryInfo
                        };
                        dashboard_item.Symbols.Add(dashboard_item_symbol);
                    }

                    result.AddDashboardItem(dashboard_item);
                }

                entities.Database.Connection.Close();

                DashBoardCache = result;
                return(result);
            }
        }
Exemplo n.º 7
0
 protected void DashboardRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
     {
         UserDashboard obj = (UserDashboard)e.Item.DataItem;
         if (obj == null)
         {
             return;
         }
         if (IsAddedInMainDashboard.Value != "true" && obj.DashboardId == 0)
         {
             IsAddedInMainDashboard.Value = "true";
         }
     }
 }
Exemplo n.º 8
0
        public UserDashboard GetDashboardData(int UserID)
        {
            UserDashboard dash = new UserDashboard();
            DataSet       ds   = Db.ExecuteDataSet("prcGetUserDashboardData", CommandType.StoredProcedure,
                                                   Db.CreateParameter("@UserID", UserID)
                                                   );

            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                dash.TotalAssignedCount = Convert.ToInt32(ds.Tables[0].Rows[0]["TotalAssignedCount"]);
                dash.TotalUploadedCount = Convert.ToInt32(ds.Tables[0].Rows[0]["TotalUploadedCount"]);
                dash.TotalDocsCount     = Convert.ToInt32(ds.Tables[0].Rows[0]["TotalDocsCount"]);
            }
            return(dash);
        }
Exemplo n.º 9
0
        private void buttonLogin_Click(object sender, EventArgs e)
        {
            login.username  = textBoxUserName.Text.Trim();
            login.password  = textBoxPassword.Text.Trim();
            login.user_type = comboBoxUserType.Text.Trim();

            //Checking the login credentials
            bool success = loginDAL.LoginCheck(login);

            if (success == true)
            {
                //Login successful
                MessageBox.Show("Login Successful");
                //Open respective forms based on user type
                switch (login.user_type)
                {
                case "Admin":
                {
                    //Display admin dashboard
                    MainAdminDashboard admin = new MainAdminDashboard();
                    admin.Show();
                    this.Hide();
                }
                break;

                case "User":
                {
                    //Display user dashboard
                    UserDashboard user = new UserDashboard();
                    user.Show();
                    this.Hide();
                }
                break;

                default:
                {
                    //Display error message
                    MessageBox.Show("Invalid user type");
                }
                break;
                }
            }
            else
            {
                //Login failed
                MessageBox.Show("Login failed. Try again");
            }
        }
Exemplo n.º 10
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            l.username  = txtUsername.Text.Trim();
            l.password  = txtPassword.Text.Trim();
            l.user_type = cmbUserType.Text.Trim();

            //Checking the login credentials
            bool success = dal.loginCheck(l);

            if (success == true)
            {
                MessageBox.Show("Login Successfull");
                loggedIn = l.username;

                //Need to open forms based on usertype
                switch (l.user_type)
                {
                case "Admin":
                {
                    AdminDashboard admin = new AdminDashboard();
                    admin.Show();
                    this.Hide();
                }
                break;

                case "User":
                {
                    UserDashboard user = new UserDashboard();
                    user.Show();
                    this.Hide();
                }
                break;

                default:
                {
                    MessageBox.Show("Invalid User Type");
                }
                break;
                }
            }
            else
            {
                MessageBox.Show("Login Failed.Try again");
            }
        }
Exemplo n.º 11
0
        public async Task <IActionResult> Index()
        {
            var key = $"dashboard::{this.CurrentUser.Id}";

            var strResult = await this.m_cache.GetAsync(key).AwaitBackground();

            if (strResult != null)
            {
                return(this.Content(strResult, MediaTypeHeaderValue.Parse("application/json")));
            }

            UserDashboard board;
            var           raw = await this.GetStatsFor(this.CurrentUser, DateTime.UtcNow.AddMonths(-1)).AwaitBackground();

            List <SensorStatisticsEntry> stats;

            stats = raw?.ToList();

            board = new UserDashboard {
                SensorCount            = await this._sensors.CountAsync(this.CurrentUser).AwaitBackground(),
                ApiCallCount           = await this.GetApiCallCountAsync().AwaitBackground(),
                MeasurementsTodayCount = await this.CountMeasurementsAsync().AwaitBackground(),
                SecurityTokenCount     = await this.CountSecurityTokensAsync(),

                MeasurementsToday = await this.GetMeasurementStatsToday().AwaitBackground(),
                ApiCallsLastWeek  = await this.GetApiCallsPerDayAsync().AwaitBackground()
            };

            if (stats != null)
            {
                board.MeasurementsCumulative       = GetMeasurementStatsCumulative(stats);
                board.MeasurementsPerDayCumulative = GetMeasurementStatsCumulativePerDay(stats);
            }
            else
            {
                board.MeasurementsCumulative       = new Graph <DateTime, long>();
                board.MeasurementsPerDayCumulative = new Graph <int, long>();
            }

            var result = board.ToJson();

            await this.m_cache.SetAsync(key, result.ToString(), CacheTimeout.TimeoutShort.ToInt()).AwaitBackground();

            return(this.Ok(result));
        }
        public ActionResult Index()
        {
            // HandleRedirection

            if (_workContext.CurrentUser.UserType == (int)UserType.Tenant)
            {
                return(RedirectToAction("Portal", "Tenant"));
            }

            /////

            var userDashboard = _userDashboardRepository.GetAll()
                                .Where(d => d.UserId == this._workContext.CurrentUser.Id)
                                .FirstOrDefault();

            if (userDashboard == null)
            {
                //create a default dashboard for user if not have one
                userDashboard = new UserDashboard
                {
                    UserId = this._workContext.CurrentUser.Id,
                    DashboardLayoutType = (int?)DashboardLayoutType.ThirdsGrid,
                    RegionCount         = 1
                };
                _userDashboardRepository.InsertAndCommit(userDashboard);
            }

            var model = userDashboard.ToModel();

            // My assignments
            //
            var myAssignmentSearchModel = _httpContext.Session[SessionKey.MyAssignmentSearchModel] as SearchModel;

            //If not exist, build search model
            if (myAssignmentSearchModel == null)
            {
                myAssignmentSearchModel = BuildMyAssignmentSearchModel();
                //session save
                _httpContext.Session[SessionKey.MyAssignmentSearchModel] = myAssignmentSearchModel;
            }
            ViewBag.MyAssignmentSearchModel = myAssignmentSearchModel;

            return(View(model));
        }
Exemplo n.º 13
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            l.username  = txtUsername.Text.Trim();
            l.password  = txtPassword.Text.Trim();
            l.user_type = cmbUserType.Text.Trim();

            bool success = dal.loginCheck(l);

            if (success == true)
            {
                MessageBox.Show("Login Successfull.");
                loggedIn = l.username;

                switch (l.user_type)
                {
                case "Admin":
                {
                    AdminDashboard admin = new AdminDashboard();
                    admin.Show();
                    this.Hide();
                }
                break;

                case "User":
                {
                    UserDashboard user = new UserDashboard();
                    user.Show();
                    this.Hide();
                }
                break;

                default:
                {
                    MessageBox.Show("Invalid user type!");
                }
                break;
                }
            }
            else
            {
                MessageBox.Show("Login failed. Try again!!");
            }
        }
Exemplo n.º 14
0
        public static UserDashboard GetUserDashboardById(int dashboardId)
        {
            if (dashboardId <= 0)
            {
                throw new ArgumentException("dashboardId cannot be equals or less than zero");
            }

            DashboardDSTableAdapters.UserDashboardsTableAdapter adapter = new DashboardDSTableAdapters.UserDashboardsTableAdapter();
            DashboardDS.UserDashboardsDataTable table = adapter.GetUserDashboardById(dashboardId);
            DashboardDS.UserDashboardsRow       row   = table[0];

            UserDashboard obj = new UserDashboard()
            {
                DashboardId = row.dashboardId,
                Name        = row.name,
                OwnerUserId = row.ownerUserId
            };

            return(obj);
        }
Exemplo n.º 15
0
        // GET: UsersDash
        public async Task <ActionResult> Index()
        {
            userDash = new UserDashboard();


            await GetBuilding();
            await GetBills();
            await GetMyAppart();

            User currUser = new Models.User();

            currUser.firstName   = ParseUser.CurrentUser.Get <string>("firstName");
            currUser.lastName    = ParseUser.CurrentUser.Get <string>("lastName");
            currUser.email       = ParseUser.CurrentUser.Username;
            currUser.phoneNumber = ParseUser.CurrentUser.Get <string>("phoneNumber");

            userDash.mUser = currUser;

            TempData["myUser"] = userDash.mUser;


            return(View(userDash));
        }
Exemplo n.º 16
0
        private void loginButton_Click(object sender, EventArgs e)
        {
            if (!DBConnectionManager.hasConnection())
            {
                //MessageBox.Show(this, "No database connection! Unable to login.", "Login");
                MessageBox.Show(this, "No database connection! Unable to login.", "Login", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            String userName = userNameTextBox.Text;
            String password = passwordTextBox.Text;


            MySqlCommand authenticationDataCommand = new MySqlCommand(sqlStatementGetAuthenticationData);

            authenticationDataCommand.Parameters.AddWithValue("@paramUserName", userName);

            //Aducere informatii din baza de date
            DataTable authenticationData = DBConnectionManager.getData(authenticationDataCommand);

            //Verificarea existentei utilizatorului si a corectitudinii datelor introduse
            if (userExists(authenticationData) && hasValidCredentials(authenticationData, password))
            {
                //Se extrage id-ul de utilizator
                int userID = getUserID(authenticationData);
                this.Visible = false;

                //Se trimite id-ul ca argument constructorului clasei UserDashboard pt a putea fi utilizat ulterior la interogarea bazei de date
                UserDashboard userDashboard = new UserDashboard(userID, userName);

                userDashboard.Visible = true;
            }
            else
            {
                //MessageBox.Show("Invalid username and/or password! Please try again", "Login");
                MessageBox.Show("Invalid username and/or password! Please try again", "Login", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 17
0
        public async Task <ActionResult> CreateBuilding(Building building)
        {
            String bName       = building.buildingName;
            String bLoc        = building.location;
            int    bNumApparts = building.numApparts;
            int    bNumShares  = building.totalShares;
            float  bTreasury   = building.treasuryBalance;

            String optionResult = Request.Form["exampleRadioz"];
            String bCurrency;

            if (optionResult.Equals("option1"))
            {
                bCurrency = "$";
            }
            else
            {
                bCurrency = "LBP";
            }

            ParseObject buildingParse = new ParseObject("Building");
            ParseObject appartParse   = new ParseObject("Appartment");

            buildingParse["Name"]        = bName;
            buildingParse["location"]    = bLoc;
            buildingParse["NumApparts"]  = bNumApparts;
            buildingParse["totalShares"] = bNumShares;
            buildingParse["Manager"]     = ParseUser.CurrentUser;
            buildingParse["Treasury"]    = bTreasury;
            buildingParse["Currency"]    = bCurrency;
            buildingParse["BillsList"]   = new List <String>();


            List <ParseObject> apparts = new List <ParseObject>();

            for (int i = 1; i <= bNumApparts; i++)
            {
                appartParse         = new ParseObject("Appartment");
                appartParse["Name"] = "Appt " + i;
                String appShareConfig = "appShare" + i;

                double appShare = double.Parse(Request.Form[appShareConfig], System.Globalization.CultureInfo.InvariantCulture);
                appartParse["Building"]   = buildingParse;
                appartParse["AppShare"]   = appShare;
                appartParse["owners"]     = new List <String>();
                appartParse["Settlement"] = 0;
                apparts.Add(appartParse);
            }


            try
            {
                await buildingParse.SaveAsync();

                await buildingParse.FetchAsync();

                //Storing building info
                Building mBuilding = new Building();
                mBuilding.id              = buildingParse.ObjectId;
                mBuilding.buildingName    = buildingParse.Get <string>("Name");
                mBuilding.location        = buildingParse.Get <string>("location");
                mBuilding.treasuryBalance = buildingParse.Get <float>("Treasury");
                mBuilding.totalShares     = buildingParse.Get <int>("totalShares");
                mBuilding.currency        = buildingParse.Get <string>("Currency");
                List <Object> tempList = buildingParse.Get <List <Object> >("BillsList");
                String        billId;
                List <String> billsListStr = new List <string>();
                foreach (Object obj in tempList)
                {
                    billId = obj.ToString();
                    billsListStr.Add(billId);
                }
                mBuilding.billsList = billsListStr;
                UserDashboard userDash = new UserDashboard();
                userDash.mBuilding = mBuilding;


                TempData["myBuilding"] = userDash.mBuilding;


                ParseUser.CurrentUser["Building"] = buildingParse;
                await ParseUser.CurrentUser.SaveAsync();

                await ParseObject.SaveAllAsync(apparts);

                return(RedirectToAction("Index", "AdminNavigation"));
            }
            catch (ParseException e) {
                return(new EmptyResult());
            }
        }
Exemplo n.º 18
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            #region Throw Error Message

            if (txtUsername.Text == "" && txtPassword.Text == "" && cmbUserType.Text == "")
            {
                MessageBox.Show(" Please Fill All The Details..... !! ");
            }

            else if (txtPassword.Text == "" && cmbUserType.Text == "")
            {
                MessageBox.Show(" Please Enter Passsword & Select UserType ... !! ");
            }

            else if (txtUsername.Text == "")
            {
                MessageBox.Show(" Please Enter Username.... !! ");
            }

            else if (txtPassword.Text == "")
            {
                MessageBox.Show(" Please Enter Password ... !! ");
            }

            else if (cmbUserType.Text == "")
            {
                MessageBox.Show(" Please Select Usertype ... !! ");
            }

            #endregion

            else
            {
                l.username  = txtUsername.Text.Trim();
                l.password  = txtPassword.Text.Trim();
                l.user_type = cmbUserType.Text.Trim();

                //Checking the login credentials
                bool success = dal.loginCheck(l);
                if (success == true)
                {
                    MessageBox.Show("Login Successfull");
                    loggedIn = l.username;

                    //Need to open forms based on usertype
                    switch (l.user_type)
                    {
                    case "Admin":
                    {
                        AdminDashboard admin = new AdminDashboard();
                        admin.Show();
                        this.Hide();
                    }
                    break;

                    case "User":
                    {
                        UserDashboard user = new UserDashboard();
                        user.Show();
                        this.Hide();
                    }
                    break;

                    default:
                    {
                        MessageBox.Show("Invalid User Type");
                    }
                    break;
                    }
                }
                else
                {
                    MessageBox.Show("Login Failed.Try again");
                }
            }
        }
Exemplo n.º 19
0
 public bool EditUserDashboard(UserDashboard userDashboard)
 {
     _unitOfWork.UserDashboardRepository.Edit(userDashboard);
     _unitOfWork.Save();
     return(true);
 }
Exemplo n.º 20
0
        private void btnLogin_Click(object sender, RoutedEventArgs e)
        {
            User   validatedUser        = new User();
            bool   login                = false;
            string currentUser          = txtUserName.Text;
            string currentPassword      = txtPasswordbox.Password;
            bool   credentialsValidated = ValidateUserInput(currentUser, currentPassword);

            try
            {
                if (credentialsValidated)
                {
                    validatedUser = GetUserRecord(currentUser, currentPassword);

                    if (validatedUser.UserId > 0)
                    {
                        login = true;
                    }

                    else
                    {
                        MessageBox.Show("The credentials you entered does not exist in database, Please check  and try again", "User login", MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                }

                else
                {
                    MessageBox.Show("Error with your UserName or Password. Please check  and try again", "User login", MessageBoxButton.OK, MessageBoxImage.Error);
                }

                if (login)
                {
                    CreateLogEntry("Login", "User logged in successfully", validatedUser.UserId, validatedUser.UserName);

                    if (validatedUser.LevelId == 3)
                    {
                        ManagerDashboard MD = new ManagerDashboard();
                        MD.user = validatedUser;
                        MD.ShowDialog();
                        this.Hide();
                    }

                    if (validatedUser.LevelId == 2)
                    {
                        StaffDashboard SD = new StaffDashboard();
                        SD.user = validatedUser;
                        SD.ShowDialog();
                        this.Hide();
                    }

                    if (validatedUser.LevelId == 1)
                    {
                        UserDashboard UD = new UserDashboard();
                        UD.user = validatedUser;
                        UD.ShowDialog();
                        this.Hide();
                    }
                }

                else
                {
                    CreateLogEntry("Login", "User did not Login", validatedUser.UserId, validatedUser.Username);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("exception", ex.Message);
                throw;
            }
        }
 /// <summary>
 /// Constructor for UserDashboardVM takes in a UserDashboard
 /// </summary>
 /// <param name="dash"></param>
 /// <param name="current"></param>
 public UserDashboardVM(UserDashboard dash, User current)
 {
     dashboard   = dash;
     currentUser = current;
 }
Exemplo n.º 22
0
 public MembersDashboard(UserDashboard userDash)
 {
     InitializeComponent();
     _userDash = userDash;
     db        = new masterEntities();
 }
Exemplo n.º 23
0
 public LendingDashboard(UserDashboard userdash)
 {
     InitializeComponent();
     _userDash = userdash;
     db        = new masterEntities();
 }
Exemplo n.º 24
0
        public async Task <DatabaseResponse> UserDashboardData(int UserId)
        {
            try
            {
                SqlParameter[] parameters =
                {
                    new SqlParameter("@UserId", SqlDbType.Int)
                };

                parameters[0].Value = UserId;
                _DataHelper         = new DataAccessHelper("sps_DashboardReportByUserId", parameters, _configuration);

                DataSet ds = new DataSet();

                int result = await _DataHelper.RunAsync(ds);


                UserDashboard       reports       = new UserDashboard();
                List <LatestCourse> latestContent = new List <LatestCourse>();
                if (ds != null && ds.Tables[0].Rows.Count > 0)
                {
                    reports = (from model in ds.Tables[0].AsEnumerable()
                               select new UserDashboard()
                    {
                        DraftCourses = model.Field <int>("DraftCourses"),
                        DraftResources = model.Field <int>("DraftResources"),
                        PublishedCourses = model.Field <int>("PublishedCourses"),
                        PubishedResources = model.Field <int>("PubishedResources"),
                        CourseToApprove = model.Field <int>("CourseToApprove"),
                        ResourceToApprove = model.Field <int>("ResourceToApprove"),
                        DownloadedResources = model.Field <int>("DownloadedResources"),
                        DownloadedCourses = model.Field <int>("DownloadedCourses"),
                        SharedCourses = model.Field <int>("SharedCourses"),
                        SharedResources = model.Field <int>("SharedResources"),
                        FirstName = model.Field <string>("FirstName"),
                        MiddleName = model.Field <string>("MiddleName"),
                        LastName = model.Field <string>("LastName"),
                        Photo = model.Field <string>("Photo"),
                        ProfileDescription = model.Field <string>("ProfileDescription"),
                    }).FirstOrDefault();
                }
                if (ds != null && ds.Tables[1].Rows.Count > 0)
                {
                    latestContent = (from model in ds.Tables[1].AsEnumerable()
                                     select new LatestCourse()
                    {
                        Id = model.Field <int>("Id"),
                        Title = model.Field <string>("Title"),
                        Description = model.Field <string>("Description"),
                        ContentType = model.Field <int>("ContentType"),
                        Thumbnail = model.Field <string>("Thumbnail"),
                    }).ToList();
                }
                reports.LatestCourse = latestContent;
                return(new DatabaseResponse {
                    ResponseCode = result, Results = reports
                });
            }

            catch (Exception ex)
            {
                Log.Error(new ExceptionHelper().GetLogString(ex, ErrorLevel.Critical));
                throw;
            }
            finally
            {
                _DataHelper.Dispose();
            }
        }