public ActionResult GetProblemByPaging(int pPageIndex, string pFilterBy = "") { //ViewBag.ActiveMenu = pActiveMenu; int startindex = 0; if (pPageIndex == 1) startindex = 1; else startindex = pPageIndex + 9; DashboardObject dashboardObject = new DashboardObject(); ResponseObjectForAnything responseObject = new ResponseObjectForAnything(); ProblemEngine probEngine = new ProblemEngine(); string response = probEngine.GetProblemsByUserIDJSON(Request.Cookies["sessionkey"].Value, startindex.ToString(), pPageIndex.ToString(), true, pFilterBy); responseObject = (ResponseObjectForAnything)Serializer.JSONStringToObject<ResponseObjectForAnything>(response); dashboardObject = (DashboardObject)Serializer.JSONStringToObject<DashboardObject>(responseObject.ResultObjectJSON); if (Request.Url.AbsolutePath.ToLower().Contains("myresolution")) ViewBag.ActiveMenu = "LiMyResolution"; int totalPagesCount = (int)Math.Ceiling((float)responseObject.ResultObjectRecordCount / (float)_PageSize); ViewBag.TotalPagesCount = totalPagesCount; ViewBag.PageNumber = pPageIndex; ViewBag.ProblemStatusId = new SelectList(dashboardObject.ProblemStatus, "ProblemStatusID", "ProblemStatusName"); ViewBag.TotalRecordCount = responseObject.ResultObjectRecordCount; ViewBag.NextPageIndex = pPageIndex + 1; return PartialView("_ProblemList", dashboardObject.ProblemList); //int totalRecords = 0; //UserDashboardComlexViewModel model = new UserDashboardComlexViewModel(); //ViewBag.NextPageIndex = 2; //ViewBag.CategoryPageSize = CategoryPageSize; //ViewBag.NextPageIndex = 2; //ViewBag.CategoryPageSize = CategoryPageSize; //ProblemListViewModel problemModel = new ProblemListViewModel(); //model.ProblemListViewModel = new List<ProblemListViewModel>(); //problemModel.ProblemID = 1; //problemModel.Address1 = "15-c/shubham flats"; //problemModel.Address2 = "citylight"; //problemModel.Address3 = "Near JodhpurChar rasta"; //problemModel.City = "Ahmedabad"; //problemModel.State = "Gujarat"; //problemModel.Country = "India"; //problemModel.Pincode = "666-0444-02"; //problemModel.ProblemImageCount = 4; //problemModel.ProblemVideoCount = 2; //problemModel.ProblemTitle = "Washing Machine"; //problemModel.ProblemImageName = "~/assets/img/images%20(7).jpg"; //problemModel.Description = "To troubleshoot your product, enter the model number in the search box below. After entering your model number, we’ll list the most common symptoms for your product. Once you select a symptom, we’ll identify the model-specific parts and/or conditions that are associated with that symptom."; //model.ProblemListViewModel.Add(problemModel); //problemModel = new ProblemListViewModel(); //problemModel.ProblemID = 2; //problemModel.Address1 = "15-c/shubham flats"; //problemModel.Address2 = "citylight"; //problemModel.Address3 = "Near JodhpurChar rasta"; //problemModel.City = "Ahmedabad"; //problemModel.State = "Gujarat"; //problemModel.Country = "India"; //problemModel.Pincode = "666-0444-02"; //problemModel.ProblemImageCount = 5; //problemModel.ProblemVideoCount = 7; //problemModel.ProblemTitle = "Washing Machine"; //problemModel.ProblemImageName = "~/assets/img/images%20(7).jpg"; //problemModel.Description = "To troubleshoot your product, enter the model number in the search box below. After entering your model number, we’ll list the most common symptoms for your product. Once you select a symptom, we’ll identify the model-specific parts and/or conditions that are associated with that symptom."; //model.ProblemListViewModel.Add(problemModel); ////if (Request.Url.AbsolutePath.ToLower().Contains("myproblems")) ////{ //// ViewBag.ActiveMenu = "LiMyProblems"; ////} //if (model.ProblemListViewModel.Count > 0) //{ // totalRecords = 2; //} //int totalPagesCount = (int)Math.Ceiling((float)totalRecords / (float)_PageSize); //ViewBag.TotalPagesCount = totalPagesCount; //ViewBag.PageNumber = pPageIndex; //ViewBag.TotalRecordCount = 4; //return PartialView("_ProblemList", model.ProblemListViewModel); }
/// <summary> /// Initial Listing of a user problem /// </summary> /// <returns></returns> public ActionResult Problem() { ViewBag.ActiveMenu = "LiDashboard"; ResponseObjectForAnything responseObject = new ResponseObjectForAnything(); DashboardObject dashboardobj = new DashboardObject(); ProblemEngine probEngine = new ProblemEngine(); string response = probEngine.GetProblemsByUserIDJSON(Request.Cookies["sessionkey"].Value, "1", _PageSize.ToString(), false, "1"); responseObject = (ResponseObjectForAnything)Serializer.JSONStringToObject<ResponseObjectForAnything>(response); if(responseObject.ResultMessage == "ERROR") { } dashboardobj = (DashboardObject)Serializer.JSONStringToObject<DashboardObject>(responseObject.ResultObjectJSON); ViewBag.NextPageIndex = 2; ViewBag.ProblemStatusId = new SelectList(dashboardobj.ProblemStatus, "ProblemStatusID", "ProblemStatusName"); ViewBag.CompanyID = new SelectList(dashboardobj.Companies, "CompanyID", "CompanyName"); ViewBag.CategoryID = new SelectList(dashboardobj.Categories, "ID", "Name"); ViewBag.CategoryPageSize = CategoryPageSize; if (Request.Url.AbsolutePath.ToLower().Contains("myresolution")) ViewBag.ActiveMenu = "LiMyResolution"; int totalPagesCount = (int)Math.Ceiling((float)responseObject.ResultObjectRecordCount / (float)_PageSize); ViewBag.TotalPagesCount = totalPagesCount; ViewBag.PageNumber = 1; ViewBag.TotalRecordCount = responseObject.ResultObjectRecordCount; return View(dashboardobj); //int totalRecords = 0; //ViewBag.ActiveMenu = "LiDashboard"; //UserDashboardComlexViewModel model = new UserDashboardComlexViewModel(); //ProblemListViewModel problemModel = new ProblemListViewModel(); //model.ProblemListViewModel = new List<ProblemListViewModel>(); //problemModel.ProblemID = 1; //problemModel.Address1 = "15-c/shubham flats"; //problemModel.Address2 = "citylight"; //problemModel.Address3 = "Near JodhpurChar rasta"; //problemModel.City = "Ahmedabad"; //problemModel.State = "Gujarat"; //problemModel.Country = "India"; //problemModel.Pincode = "666-0444-02"; //problemModel.ProblemImageCount = 4; //problemModel.ProblemVideoCount = 2; //problemModel.ProblemTitle = "Washing Machine"; //problemModel.ProblemImageName = "~/upload/problem-image/1.JPG"; //problemModel.Description = "To troubleshoot your product, enter the model number in the search box below. After entering your model number, we’ll list the most common symptoms for your product. Once you select a symptom, we’ll identify the model-specific parts and/or conditions that are associated with that symptom."; //problemModel.Latitude = "27.140717"; //problemModel.Logitude = "78.030954"; //model.ProblemListViewModel.Add(problemModel); //problemModel = new ProblemListViewModel(); //problemModel.ProblemID = 2; //problemModel.Address1 = "15-c/shubham flats"; //problemModel.Address2 = "citylight"; //problemModel.Address3 = "Near JodhpurChar rasta"; //problemModel.City = "Ahmedabad"; //problemModel.State = "Gujarat"; //problemModel.Country = "India"; //problemModel.Pincode = "666-0444-02"; //problemModel.ProblemImageCount = 5; //problemModel.ProblemVideoCount = 7; //problemModel.ProblemTitle = "Washing Machine"; //problemModel.ProblemImageName = "~/assets/img/images%20(7).jpg"; //problemModel.Description = "To troubleshoot your product, enter the model number in the search box below. After entering your model number, we’ll list the most common symptoms for your product. Once you select a symptom, we’ll identify the model-specific parts and/or conditions that are associated with that symptom."; //problemModel.Latitude = "26.604125"; //problemModel.Logitude = "76.108800"; //model.ProblemListViewModel.Add(problemModel); //problemModel = new ProblemListViewModel(); //problemModel.ProblemID = 3; //problemModel.Address1 = "15-c/shubham flats"; //problemModel.Address2 = "citylight"; //problemModel.Address3 = "Near JodhpurChar rasta"; //problemModel.City = "Ahmedabad"; //problemModel.State = "Gujarat"; //problemModel.Country = "India"; //problemModel.Pincode = "666-0444-02"; //problemModel.ProblemImageCount = 5; //problemModel.ProblemVideoCount = 7; //problemModel.ProblemTitle = "Washing Machine"; //problemModel.ProblemImageName = "~/upload/problem-image/5.JPG"; //problemModel.Description = "To troubleshoot your product, enter the model number in the search box below. After entering your model number, we’ll list the most common symptoms for your product. Once you select a symptom, we’ll identify the model-specific parts and/or conditions that are associated with that symptom."; //problemModel.Latitude = "23.383021"; //problemModel.Logitude = "69.621456"; //model.ProblemListViewModel.Add(problemModel); //problemModel = new ProblemListViewModel(); //problemModel.ProblemID = 4; //problemModel.Address1 = "15-c/shubham flats"; //problemModel.Address2 = "citylight"; //problemModel.Address3 = "Near JodhpurChar rasta"; //problemModel.City = "Ahmedabad"; //problemModel.State = "Gujarat"; //problemModel.Country = "India"; //problemModel.Pincode = "666-0444-02"; //problemModel.ProblemImageCount = 5; //problemModel.ProblemVideoCount = 7; //problemModel.ProblemTitle = "Washing Machine"; //problemModel.ProblemImageName = "~/upload/problem-image/8.JPG"; //problemModel.Description = "To troubleshoot your product, enter the model number in the search box below. After entering your model number, we’ll list the most common symptoms for your product. Once you select a symptom, we’ll identify the model-specific parts and/or conditions that are associated with that symptom."; //problemModel.Latitude = "24.359854"; //problemModel.Logitude = "87.420752"; //model.ProblemListViewModel.Add(problemModel); //if (Request.Url.AbsolutePath.ToLower().Contains("myproblems")) //{ // ViewBag.ActiveMenu = "LiMyProblems"; //} //if (model.ProblemListViewModel.Count > 0) //{ // totalRecords = 2; //} //int totalPagesCount = (int)Math.Ceiling((float)totalRecords / (float)_PageSize); //ViewBag.TotalPagesCount = totalPagesCount; //ViewBag.PageNumber = 1; //ViewBag.TotalRecordCount = 4; //RecentProblemResolutionViewModel recentProblemModel = null; //recentProblemModel = new RecentProblemResolutionViewModel(); //recentProblemModel.ProblemID = 1; //recentProblemModel.ProblemImagePath = ServerSettings.WebApplicationURL + "/upload/problem-image/1.jpg"; //recentProblemModel.ProblemTitle = "Washing Machine"; //recentProblemModel.Description = "To troubleshoot your product, enter the model number in the search box below. After entering your model number, we’ll list the most common symptoms for your product. Once you select a symptom, we’ll identify the model-specific parts and/or conditions that are associated with that symptom."; //model.RecentProblemResolutionList.Add(recentProblemModel); //recentProblemModel = new RecentProblemResolutionViewModel(); //recentProblemModel.ProblemID = 2; //recentProblemModel.ProblemImagePath = ServerSettings.WebApplicationURL + "/upload/problem-image/2.jpg"; //recentProblemModel.ProblemTitle = "Freezer Cooling"; //recentProblemModel.Description = "To troubleshoot your product, enter the model number in the search box below. After entering your model number, we’ll list the most common symptoms for your product. Once you select a symptom, we’ll identify the model-specific parts and/or conditions that are associated with that symptom."; //model.RecentProblemResolutionList.Add(recentProblemModel); //recentProblemModel = new RecentProblemResolutionViewModel(); //recentProblemModel.ProblemID = 3; //recentProblemModel.ProblemImagePath = ServerSettings.WebApplicationURL + "/upload/problem-image/3.jpg"; //recentProblemModel.ProblemTitle = "Ac power supply"; //recentProblemModel.Description = "To troubleshoot your product, enter the model number in the search box below. After entering your model number, we’ll list the most common symptoms for your product. Once you select a symptom, we’ll identify the model-specific parts and/or conditions that are associated with that symptom."; //model.RecentProblemResolutionList.Add(recentProblemModel); //recentProblemModel = new RecentProblemResolutionViewModel(); //recentProblemModel.ProblemID = 4; //recentProblemModel.ProblemImagePath = ServerSettings.WebApplicationURL + "/upload/problem-image/4.jpg"; //recentProblemModel.ProblemTitle = "Washing Machine"; //recentProblemModel.Description = "To troubleshoot your product, enter the model number in the search box below. After entering your model number, we’ll list the most common symptoms for your product. Once you select a symptom, we’ll identify the model-specific parts and/or conditions that are associated with that symptom."; //model.RecentProblemResolutionList.Add(recentProblemModel); //recentProblemModel = new RecentProblemResolutionViewModel(); //recentProblemModel.ProblemID = 5; //recentProblemModel.ProblemImagePath = ServerSettings.WebApplicationURL + "/upload/problem-image/5.jpg"; //recentProblemModel.ProblemTitle = "Acc Cooling"; //recentProblemModel.Description = "To troubleshoot your product, enter the model number in the search box below. After entering your model number, we’ll list the most common symptoms for your product. Once you select a symptom, we’ll identify the model-specific parts and/or conditions that are associated with that symptom."; //model.RecentProblemResolutionList.Add(recentProblemModel); //List<DropDownViewModel> categoryList = new List<DropDownViewModel>(); //categoryList.Add(new DropDownViewModel { Name = "Television", ID = 1 }); //categoryList.Add(new DropDownViewModel { Name = "Refrigerator", ID = 2 }); //categoryList.Add(new DropDownViewModel { Name = "Air Conditioner", ID = 3 }); //categoryList.Add(new DropDownViewModel { Name = "Microwave oven", ID = 4 }); //model.CategoryList = categoryList; //ViewBag.CategoryPageSize = CategoryPageSize; //ViewBag.NextPageIndex = 2; //return View(model); }
/// <summary> /// Get Problems by user ID. /// </summary> /// <param name="sessionKey">string</param> /// <returns>string</returns> public ResponseObjectForAnything GetProblemsByUserID(string sessionKey, string startindex, string pageindex, bool paging, string problemstatusid) { DashboardObject dashboardobject = new DashboardObject(); List<RecentProblemObject> recentproblemlist = new List<RecentProblemObject>(); List<Problem> problemlist = new List<Problem>(); ResponseObjectForAnything responseObject = new ResponseObjectForAnything(); AuthenticationEngine authEngine = new AuthenticationEngine(); bool isValid = true; int count = 0; if (!string.IsNullOrEmpty(sessionKey)) { isValid = authEngine.IsValidSession(sessionKey); } List<ProblemStatus> lstproblemstatus = new List<ProblemStatus>(); List<Category> lstcategory = new List<Category>(); List<Company> lstcompany = new List<Company>(); if (isValid) { try { Database db = DatabaseFactory.CreateDatabase(); DbCommand dbCommand = db.GetStoredProcCommand("usp_GetProblemsByUserID"); db.AddInParameter(dbCommand, "@SessionKey", DbType.String, sessionKey); db.AddInParameter(dbCommand, "@StartCount", DbType.Int32, Int32.Parse(startindex)); db.AddInParameter(dbCommand, "@PageSize", DbType.Int32, Int32.Parse(pageindex)); db.AddInParameter(dbCommand, "@IsPaging", DbType.Boolean, Convert.ToBoolean(paging)); db.AddInParameter(dbCommand, "@ProblemStatusID", DbType.Boolean, Int32.Parse(problemstatusid)); DataSet dsProblem = db.ExecuteDataSet(dbCommand); if (dsProblem.Tables.Count > 0) { DataTable tProblem = dsProblem.Tables[0]; foreach (DataRow dRow in tProblem.Rows) { Problem problem = new Problem(); User user = new User(); if (dRow["ID"] != DBNull.Value) { problem.ID = Int32.Parse(dRow["ID"].ToString()); } if (dRow["UserID"] != DBNull.Value) { problem.UserID = Int32.Parse(dRow["UserID"].ToString()); } if (dRow["FirstName"] != DBNull.Value) { problem.FirstName = dRow["FirstName"].ToString(); } if (dRow["LastName"] != DBNull.Value) { problem.LastName = dRow["LastName"].ToString(); } if (dRow["DisplayName"] != DBNull.Value) { problem.DisplayName = dRow["DisplayName"].ToString(); } if (dRow["EmailID"] != DBNull.Value) { problem.EmailID = dRow["EmailID"].ToString(); } if (dRow["CompanyRelated"] != DBNull.Value) { problem.IsCompanyRelated = Convert.ToBoolean(dRow["CompanyRelated"].ToString()); } if (dRow["CompanyID"] != DBNull.Value) { problem.CompanyID = Int32.Parse(dRow["CompanyID"].ToString()); } if (dRow["CompanyName"] != DBNull.Value) { problem.CompanyName = dRow["CompanyName"].ToString(); } if (dRow["ProblemHeading"] != DBNull.Value) { problem.ProblemHeading = dRow["ProblemHeading"].ToString(); } if (dRow["CategoryID"] != DBNull.Value) { problem.CategoryID = Int32.Parse(dRow["CategoryID"].ToString()); } if (dRow["SubCategoryID"] != DBNull.Value) { problem.SubCategoryID = Int32.Parse(dRow["SubCategoryID"].ToString()); } if (dRow["ProductID"] != DBNull.Value) { problem.ProductID = Int32.Parse(dRow["ProductID"].ToString()); } if (dRow["ModelNo"] != DBNull.Value) { problem.ModelNo = dRow["ModelNo"].ToString(); } if (dRow["Description"] != DBNull.Value) { problem.Description = dRow["Description"].ToString(); } if (dRow["PurchaseMonth"] != DBNull.Value) { problem.PurchaseMonth = Int32.Parse(dRow["PurchaseMonth"].ToString()); } if (dRow["PurchaseYear"] != DBNull.Value) { problem.PurchaseYear = Int32.Parse(dRow["PurchaseYear"].ToString()); } if (dRow["ProductStatusID"] != DBNull.Value) { problem.ProductStatusID = Int32.Parse(dRow["ProductStatusID"].ToString()); } if (dRow["ProductStatusName"] != DBNull.Value) { problem.ProductStatusName = dRow["ProductStatusName"].ToString(); } if (dRow["ProblemStatusID"] != DBNull.Value) { problem.ProblemStatusID = Int32.Parse(dRow["ProblemStatusID"].ToString()); } if (dRow["ProblemStatusName"] != DBNull.Value) { problem.ProblemStatusName = dRow["ProblemStatusName"].ToString(); } if (dRow["ResolutionNeededBy"] != DBNull.Value) { problem.ResolutionNeededBy = Convert.ToDateTime(dRow["ResolutionNeededBy"].ToString()); } if (dRow["IsVirtual"] != DBNull.Value) { problem.IsVirtual = Convert.ToBoolean(dRow["IsVirtual"].ToString()); } if (dRow["IsRegisteredAddress"] != DBNull.Value) { problem.IsRegisteredAddress = Convert.ToBoolean(dRow["IsRegisteredAddress"].ToString()); } if (dRow["Address1"] != DBNull.Value) { problem.Address1 = dRow["Address1"].ToString(); } if (dRow["Address2"] != DBNull.Value) { problem.Address2 = dRow["Address2"].ToString(); } if (dRow["Address3"] != DBNull.Value) { problem.Address3 = dRow["Address3"].ToString(); } if (dRow["City"] != DBNull.Value) { problem.City = dRow["City"].ToString(); } if (dRow["StateID"] != DBNull.Value) { problem.StateID = Int32.Parse(dRow["StateID"].ToString()); } if (dRow["StateName"] != DBNull.Value) { problem.StateName = dRow["StateName"].ToString(); } if (dRow["CountryID"] != DBNull.Value) { problem.CountryID = Int32.Parse(dRow["CountryID"].ToString()); } if (dRow["CountryName"] != DBNull.Value) { problem.CountryName = dRow["CountryName"].ToString(); } if (dRow["PinCode"] != DBNull.Value) { problem.PinCode = dRow["PinCode"].ToString(); } if (dRow["Latitude"] != DBNull.Value) { problem.Latitude = Convert.ToDecimal(dRow["Latitude"].ToString()); } if (dRow["Longitude"] != DBNull.Value) { problem.Longitude = Convert.ToDecimal(dRow["Longitude"].ToString()); } if (dRow["Distance"] != DBNull.Value) { problem.Distance = Convert.ToDecimal(dRow["Distance"].ToString()); } if (dRow["ThumbnailMedia"] != DBNull.Value) { problem.ThumbnailMedia = dRow["ThumbnailMedia"].ToString(); } problemlist.Add(problem); count++; } dashboardobject.ProblemList = problemlist; } if (dsProblem.Tables.Count > 1) { DataTable tProblemStatus = dsProblem.Tables[1]; foreach (DataRow dRow in tProblemStatus.Rows) { ProblemStatus probstatus = new ProblemStatus(); if (dRow["ProblemStatusID"] != DBNull.Value) { probstatus.ProblemStatusID = Int32.Parse(dRow["ProblemStatusID"].ToString()); } if (dRow["ProblemStatusName"] != DBNull.Value) { probstatus.ProblemStatusName = dRow["ProblemStatusName"].ToString(); } lstproblemstatus.Add(probstatus); } dashboardobject.ProblemStatus = lstproblemstatus; } if (!paging) { if (dsProblem.Tables.Count > 2) { DataTable tCategories = dsProblem.Tables[2]; foreach (DataRow dRow in tCategories.Rows) { Category category = new Category(); if (dRow["ID"] != DBNull.Value) { category.ID = Int32.Parse(dRow["ID"].ToString()); } if (dRow["Name"] != DBNull.Value) { category.Name = dRow["Name"].ToString(); } lstcategory.Add(category); } dashboardobject.Categories = lstcategory; } if (dsProblem.Tables.Count > 3) { DataTable tCountries = dsProblem.Tables[3]; foreach (DataRow dRow in tCountries.Rows) { Company company = new Company(); if (dRow["CompanyID"] != DBNull.Value) { company.CompanyID = Int32.Parse(dRow["CompanyID"].ToString()); } if (dRow["CompanyName"] != DBNull.Value) { company.CompanyName = dRow["CompanyName"].ToString(); } lstcompany.Add(company); } dashboardobject.Companies = lstcompany; } if (dsProblem.Tables.Count > 4) { DataTable tProblem = dsProblem.Tables[4]; foreach (DataRow dRow in tProblem.Rows) { RecentProblemObject problem = new RecentProblemObject(); if (dRow["ProblemID"] != DBNull.Value) { problem.ProblemID = Int32.Parse(dRow["ProblemID"].ToString()); } if (dRow["ProblemTitle"] != DBNull.Value) { problem.ProblemTitle = dRow["ProblemTitle"].ToString(); } if (dRow["Description"] != DBNull.Value) { problem.Description = dRow["Description"].ToString(); } if (dRow["ProblemImagePath"] != DBNull.Value) { problem.ProblemImagePath = dRow["ProblemImagePath"].ToString(); } recentproblemlist.Add(problem); } dashboardobject.RecentProblems = recentproblemlist; } } responseObject.ResultCode = "SUCCESS"; responseObject.ResultObjectRecordCount = count; responseObject.ResultObjectJSON = Serializer.ObjectToJSON(dashboardobject); if (responseObject.ResultObjectRecordCount <= 0) { responseObject.ResultMessage = "No records found."; } } catch (Exception ex) { responseObject.ResultCode = "ERROR"; responseObject.ResultMessage = ex.Message; CustomException exc = new CustomException(ex.ToString(), this.ToString(), "GetProblemsByUserID", System.DateTime.Now); ExceptionManager.PublishException(exc); } } return responseObject; }