public LearnModel GetSingleLearnDetails(Hashtable learnCriteria) { var _db = new DBUtility(); var token = new LearnModel(); var _dt = new DataTable(); _cmd = new SqlCommand(); _cmd.CommandType = CommandType.StoredProcedure; _cmd.CommandText = "GP_SP_GetSingleLearnDetails"; if (string.IsNullOrWhiteSpace(Convert.ToString(learnCriteria["UserID"]))) { _cmd.Parameters.AddWithValue("@UserId", DBNull.Value); } else { _cmd.Parameters.AddWithValue("@UserId", Convert.ToString(learnCriteria["UserID"]).Trim()); } if (Convert.ToInt32(learnCriteria["ID"]) <= 0) { _cmd.Parameters.AddWithValue("@Id", DBNull.Value); } else { _cmd.Parameters.AddWithValue("@Id", Convert.ToInt32(learnCriteria["ID"])); } _dt = _db.FillDataTable(_cmd, _dt); if (_dt.Rows.Count > 0) { foreach (DataRow dr in _dt.Rows) { var temp = new LearnModel(); temp.ID = Convert.ToInt64(dr["ID"]); temp.Name = Convert.ToString(dr["Name"]); temp.Description = Convert.ToString(dr["Description"]); temp.ResourcePath = Convert.ToString(dr["ResourcePath"]); temp.LearnTypeName = Convert.ToString(dr["LearnTypeName"]); temp.TopicName = Convert.ToString(dr["TopicName"]); temp.Url = Convert.ToString(dr["LearnUrl"]); temp.ArticleDate = Convert.ToString(dr["ArticleDate"]); temp.AuthorName = Convert.ToString(dr["AuthorName"]); temp.LearnTypeID = Convert.ToInt32(dr["LearnTypeID"]); temp.ImagePath = Convert.ToString(dr["ImagePath"]); temp.ExperienceLevelName = Convert.ToString(dr["ExperienceLevelName"]); temp.TopicID = Convert.ToInt32(dr["TopicID"]); token = temp; } } return(token); }
public LearnModel EditCurrentResource(Hashtable learnCriteria) { var _db = new DBUtility(); var temp = new LearnModel(); var _dt = new DataTable(); _cmd = new SqlCommand(); _cmd.CommandType = CommandType.StoredProcedure; _cmd.CommandText = "GP_SP_EditCurrentResource"; _cmd.Parameters.AddWithValue("@UserId", Convert.ToString(learnCriteria["UserID"])); _cmd.Parameters.AddWithValue("@LearnID", Convert.ToInt64(learnCriteria["ID"])); _dt = _db.FillDataTable(_cmd, _dt); if (_dt.Rows.Count > 0) { foreach (DataRow dr in _dt.Rows) { temp.ID = Convert.ToInt64(dr["ID"]); temp.Name = Convert.ToString(dr["Name"]); temp.Description = Convert.ToString(dr["Description"]); temp.ListingStatusID = Convert.ToInt32(dr["ListingStatusID"]); temp.Url = Convert.ToString(dr["LearnURL"]); temp.IsSponsored = Convert.ToBoolean(dr["IsSponsored"]); temp.TopicName = Convert.ToString(dr["TopicName"]); temp.TopicID = Convert.ToInt32(dr["TopicID"]); temp.LearnTypeName = Convert.ToString(dr["LearnTypeName"]); temp.AuthorName = Convert.ToString(dr["AuthorName"]); temp.LearnTypeID = Convert.ToInt32(dr["LearnTypeID"]); temp.ResourcePath = Convert.ToString(dr["ImagePath"]); temp.ExperienceLevelID = Convert.ToString(dr["ExperienceLevel"]); temp.ContentForID = Convert.ToInt32(dr["ContentFor"]); temp.ContentTypeID = Convert.ToInt32(dr["ContentType"]); } } return(temp); }
public ActionResult Learn(LearnInputModel inputModel) { Fail.IfNull(inputModel, nameof(inputModel)); var lesson = this.GetLesson(inputModel); if (string.IsNullOrWhiteSpace(inputModel.Word)) { inputModel.Word = lesson.NextWord().Polish; return(this.RedirectToAction(nameof(Learn), inputModel)); } lesson.NoticeAnswer(inputModel); var model = new LearnModel(lesson, inputModel.Word); if (lesson.LearnedAll()) { lesson.Finished(); return(this.View("Success", model)); } return(View(model)); }
public ActionResult Admin(int?page, string Tab = null, string sortingOrder = "RecentlyPosted", string searchText = "") { searchText = searchText.Replace("'", "''"); Serialization serialization = new Serialization(); DashboardWrapper dashboardWrapper = new DashboardWrapper(); Hashtable HashCriteria = new Hashtable(); Hashtable UsersHashCriteria = new Hashtable(); Hashtable ResourcesHashCriteria = new Hashtable(); Hashtable TestimonialsHashCriteria = new Hashtable(); string actualCriteria; actualCriteria = serialization.SerializeBinary((object)HashCriteria); int pageSize = 8; int pageIndex = 1; pageIndex = page.HasValue ? Convert.ToInt32(page) : 1; if (Tab == "Users") { UserRegistration userRecords = new UserRegistration(); UsersHashCriteria.Add("Name", searchText); UsersHashCriteria.Add("SortingOrder", sortingOrder); actualCriteria = serialization.SerializeBinary((object)UsersHashCriteria); var users = userRecords.GetUserSpecificDetails(actualCriteria); dashboardWrapper.Users = (List <UserProfileEditModel>)(serialization.DeSerializeBinary(Convert.ToString(users))); dashboardWrapper.PagedListUsers = dashboardWrapper.Users.ToPagedList(pageIndex, pageSize); return(PartialView("_AdminUsersTab", dashboardWrapper.PagedListUsers)); } else if (Tab == "Resources") { Learn learnBA = new Learn(); ResourcesHashCriteria.Add("SortingOrder", sortingOrder); ResourcesHashCriteria.Add("SearchText", searchText); ResourcesHashCriteria.Add("IsAdminDashboard", "1"); actualCriteria = serialization.SerializeBinary((object)ResourcesHashCriteria); var resourcesList = learnBA.GetLearnListingDetails(actualCriteria); dashboardWrapper.Resources = (List <LearnModel>)(serialization.DeSerializeBinary(Convert.ToString(resourcesList))); dashboardWrapper.PagedListResource = dashboardWrapper.Resources.ToPagedList(pageIndex, pageSize); return(PartialView("_AdminResourcesTab", dashboardWrapper.PagedListResource)); } else if (Tab == "Testimonials") { Testimonial testimonialBA = new Testimonial(); TestimonialsHashCriteria.Add("SortingOrder", sortingOrder); TestimonialsHashCriteria.Add("SearchText", searchText); actualCriteria = serialization.SerializeBinary((object)TestimonialsHashCriteria); dashboardWrapper.Testimonials = testimonialBA.GetAllTestimonial(actualCriteria); dashboardWrapper.PagedListTestimonial = dashboardWrapper.Testimonials.ToPagedList(pageIndex, pageSize); return(PartialView("_AdminTestimonialsTab", dashboardWrapper.PagedListTestimonial)); } else { InvestorListings investorListings = new InvestorListings(); InvestorListingWrapper investorListingWrapper = new InvestorListingWrapper(); investorListingWrapper.SortingOrder = sortingOrder; investorListingWrapper.ListingTypeIds = string.Empty; HashCriteria.Add("ID", investorListingWrapper.ListingTypeIds); HashCriteria.Add("LocationName", investorListingWrapper.LocationName); HashCriteria.Add("SortingOrder", investorListingWrapper.SortingOrder); HashCriteria.Add("Name", searchText); HashCriteria.Add("LoanID", investorListingWrapper.LoanID); HashCriteria.Add("LienPositionID", investorListingWrapper.LienPositionID); HashCriteria.Add("LoanStatusID", investorListingWrapper.LoanStatusID); HashCriteria.Add("State", investorListingWrapper.State); HashCriteria.Add("LoanTypeID", investorListingWrapper.LoanTypeID); HashCriteria.Add("Address", investorListingWrapper.Address); HashCriteria.Add("PropertyTypeID", investorListingWrapper.PropertyTypeID); HashCriteria.Add("MinPrincipalBalance", 0); HashCriteria.Add("MaxPrincipalBalance", 0); HashCriteria.Add("City", investorListingWrapper.City); HashCriteria.Add("MinInterestRate", 0); HashCriteria.Add("MaxInterestRate", 0); HashCriteria.Add("MinAskingPrice", 0); HashCriteria.Add("MaxAskingPrice", 0); HashCriteria.Add("UserID", userID); actualCriteria = serialization.SerializeBinary((object)HashCriteria); var listing = investorListings.GetDealDetails(actualCriteria); dashboardWrapper.InvestorAdminListing = (List <InvestorListingsModel>)(serialization.DeSerializeBinary(Convert.ToString(listing))); dashboardWrapper.PagedListAdminListings = dashboardWrapper.InvestorAdminListing.ToPagedList(pageIndex, pageSize); //Users default load actualCriteria = string.Empty; UserRegistration userRecords = new UserRegistration(); UsersHashCriteria.Add("SortingOrder", sortingOrder); actualCriteria = serialization.SerializeBinary((object)UsersHashCriteria); dashboardWrapper.Users = new List <UserProfileEditModel>(); var users = userRecords.GetUserSpecificDetails(actualCriteria); dashboardWrapper.Users = (List <UserProfileEditModel>)(serialization.DeSerializeBinary(Convert.ToString(users))); dashboardWrapper.PagedListUsers = dashboardWrapper.Users.ToPagedList(pageIndex, pageSize); //Resources default load actualCriteria = string.Empty; Learn learnBA = new Learn(); //For Learn LearnModel learn = new LearnModel(); ResourcesHashCriteria.Add("SortingOrder", sortingOrder); ResourcesHashCriteria.Add("IsAdminDashboard", "1"); actualCriteria = serialization.SerializeBinary((object)ResourcesHashCriteria); var resourcesList = learnBA.GetLearnListingDetails(actualCriteria); dashboardWrapper.Resources = (List <LearnModel>)(serialization.DeSerializeBinary(Convert.ToString(resourcesList))); dashboardWrapper.PagedListResource = dashboardWrapper.Resources.ToPagedList(pageIndex, pageSize); Testimonial testimonialBA = new Testimonial(); TestimonialsHashCriteria.Add("SortingOrder", sortingOrder); TestimonialsHashCriteria.Add("SearchText", searchText); actualCriteria = serialization.SerializeBinary((object)TestimonialsHashCriteria); dashboardWrapper.Testimonials = testimonialBA.GetAllTestimonial(actualCriteria); dashboardWrapper.PagedListTestimonial = dashboardWrapper.Testimonials.ToPagedList(pageIndex, pageSize); if (Tab != null) { return(PartialView("_AdminListingsTab", dashboardWrapper.PagedListAdminListings)); } return(View("AdminDashboard", dashboardWrapper)); } }
public List <LearnModel> GetLearnListingDetails(Hashtable learnListingCriteria) { var _db = new DBUtility(); var token = new List <LearnModel>(); var _dt = new DataTable(); _cmd = new SqlCommand(); _cmd.CommandType = CommandType.StoredProcedure; _cmd.CommandText = "GP_SP_GetLearnListings"; _cmd.Parameters.AddWithValue("@UserId", Convert.ToInt64(learnListingCriteria["UserID"])); if ((Convert.ToInt32(learnListingCriteria["ExperienceLevel"]) == 0)) { _cmd.Parameters.AddWithValue("@ExperienceLevel", ""); } else { _cmd.Parameters.AddWithValue("@ExperienceLevel", Convert.ToString(learnListingCriteria["ExperienceLevel"])); } if ((Convert.ToInt32(learnListingCriteria["Topic"]) == 0)) { _cmd.Parameters.AddWithValue("@Topic", ""); } else { _cmd.Parameters.AddWithValue("@Topic", Convert.ToString(learnListingCriteria["Topic"])); } if (string.IsNullOrWhiteSpace(Convert.ToString(learnListingCriteria["SearchText"]))) { _cmd.Parameters.AddWithValue("@SearchText", DBNull.Value); } else { _cmd.Parameters.AddWithValue("@SearchText", Convert.ToString(learnListingCriteria["SearchText"])); } if (string.IsNullOrWhiteSpace(Convert.ToString(learnListingCriteria["LearnType"]))) { _cmd.Parameters.AddWithValue("@LearnType", DBNull.Value); } else { _cmd.Parameters.AddWithValue("@LearnType", Convert.ToString(learnListingCriteria["LearnType"])); } if (string.IsNullOrWhiteSpace(Convert.ToString(learnListingCriteria["SortingOrder"]))) { _cmd.Parameters.AddWithValue("@SortingOrder", DBNull.Value); } else { _cmd.Parameters.AddWithValue("@SortingOrder", Convert.ToString(learnListingCriteria["SortingOrder"]).Trim()); } _dt = _db.FillDataTable(_cmd, _dt); if (_dt.Rows.Count > 0) { foreach (DataRow dr in _dt.Rows) { var temp = new LearnModel(); temp.ID = Convert.ToInt64(dr["ID"]); temp.Name = Convert.ToString(dr["Name"]); temp.Description = Convert.ToString(learnListingCriteria["IsAdminDashboard"]).Trim() == "1" ? "" : Convert.ToString(dr["Description"]).Length >= 50 ? Convert.ToString(dr["Description"]).Substring(0, 50) : Convert.ToString(dr["Description"]); temp.ListingStatusID = Convert.ToInt32(dr["ListingStatusID"]); temp.Status = Convert.ToString(dr["Status"]); temp.Url = Convert.ToString(dr["LearnURL"]); temp.IsSponsored = Convert.ToBoolean(dr["IsSponsored"]); temp.TopicName = Convert.ToString(dr["TopicName"]); temp.TopicID = Convert.ToInt32(dr["TopicID"]); temp.LearnTypeName = Convert.ToString(dr["LearnTypeName"]); temp.LearnTypeID = Convert.ToInt32(dr["LearnTypeID"]); temp.ResourcePath = Convert.ToString(dr["ImagePath"]); temp.CreatedDate = (dr["CreatedDate"] == DBNull.Value) ? Convert.ToDateTime(null) : Convert.ToDateTime(dr["CreatedDate"]); temp.ModifiedDate = (dr["ModifiedDate"] == DBNull.Value) ? Convert.ToDateTime(null) : Convert.ToDateTime(dr["ModifiedDate"]); temp.ContentTypeID = Convert.ToInt32(dr["ContentType"]); temp.ContentForID = Convert.ToInt32(dr["ContentFor"]); token.Add(temp); } } return(token); }