/// <summary>
        /// Action for get detail of a Problem
        /// </summary>
        /// <param name="id">id of a problem for which detail needs to be get</param>
        /// <returns></returns>
        public ActionResult ProblemDetail(int id)
        {
            ViewBag.ActiveMenu = "LiMyProblems";
            ResponseObjectForAnything responseObject = new ResponseObjectForAnything();
            ProblemEngine probEngine = new ProblemEngine();
            ProblemObject problemobj = new ProblemObject();

            string response = probEngine.GetProblemDetailsByIdJSON(Request.Cookies["sessionkey"].Value, id.ToString(), false);
            responseObject = (ResponseObjectForAnything)Serializer.JSONStringToObject<ResponseObjectForAnything>(response);
            if (responseObject.ResultCode == "SUCCESS" && !string.IsNullOrEmpty(responseObject.ResultObjectJSON))
                problemobj = (ProblemObject)Serializer.JSONStringToObject<ProblemObject>(responseObject.ResultObjectJSON);
            else
            {
                Common.DTO.Alert alert = new Common.DTO.Alert();
                alert.AlertType = Common.DTO.Alert.ALERTTYPE.Info;
                alert.Message = responseObject.ResultMessage;
                alert.MessageType = Common.DTO.Alert.ALERTMESSAGETYPE.OnlyText;
            }
            ViewBag.QuotesNextPageIndex = 2;
            ViewBag.QuotesPageSize = QuotesPageSize;
            return View(problemobj);
            //UserProblemDetailComplexViewModel model = new UserProblemDetailComplexViewModel();

            //model.ProblemViewModel.ID = 1;
            //model.ProblemViewModel.UserID = 1;
            //model.ProblemViewModel.ProblemHeading = "Washing maching balancing Problem";
            //model.ProblemViewModel.Description = "Washing machine won’t spin or agitate? Not draining, filling or leaks water? This video provides information on how a washing cloths. Washer not spinning or draining? This demonstrates how to test a three terminal switch on a washing machine. The lid switch not works.";
            //model.ProblemViewModel.CompanyRelated = true;
            //model.ProblemViewModel.CompanyID = 1;
            //model.ProblemViewModel.CompanyName = "ProbFox pvt Ltd.";
            //model.ProblemViewModel.CategoryID = 1;
            //model.ProblemViewModel.SubCategoryID = 3;
            //model.ProblemViewModel.CategoryName = "Electronics";
            //model.ProblemViewModel.SubCategoryName = "Motor";
            //model.ProblemViewModel.ProductID = 1;
            //model.ProblemViewModel.ProductName = "Washing Machine";
            //model.ProblemViewModel.ModelNo = "Prob-Ind-2106";
            //model.ProblemViewModel.ProductStatusID = 2;
            //model.ProblemViewModel.ProductStatusName = "In Warranty";
            //model.ProblemViewModel.PurchaseMonth = "November";
            //model.ProblemViewModel.PurchaseYear = "2015";
            //model.ProblemViewModel.ResolutionNeededBy = DateTime.Now;
            //model.ProblemViewModel.CreatedDate = DateTime.Now;
            //model.ProblemViewModel.UpdatedDate = DateTime.Now;

            //model.ProblemLocationViewModel.ID = 1;
            //model.ProblemLocationViewModel.ProblemID = 1;
            //model.ProblemLocationViewModel.Address1 = "Shiv Shakti Nager";
            //model.ProblemLocationViewModel.Address2 = "Adajan";
            //model.ProblemLocationViewModel.Address3 = "";
            //model.ProblemLocationViewModel.City = "Ahmedabad";
            //model.ProblemLocationViewModel.StateID = 1;
            //model.ProblemLocationViewModel.StateName = "Gujarat";
            //model.ProblemLocationViewModel.CountryID = 1;
            //model.ProblemLocationViewModel.CountryName = "India";
            //model.ProblemLocationViewModel.Pincode = "395006";
            //model.ProblemLocationViewModel.Latitude = 21.192786M;
            //model.ProblemLocationViewModel.Longitude = 72.799809M;

            //ProblemMediaViewModel problemMediaViewModel = null;
            //for (int i = 1; i < 5; i++)
            //{
            //    problemMediaViewModel = new ProblemMediaViewModel();
            //    problemMediaViewModel.ID = i;
            //    problemMediaViewModel.ProblemID = 1;
            //    problemMediaViewModel.IsImage = true;
            //    problemMediaViewModel.MediaPath = ServerSettings.WebApplicationURL + "/upload/problem-image/" + i.ToString() + ".JPG";
            //    model.ProblemMediaViewModelList.Add(problemMediaViewModel);
            //}

            //for (int i = 5; i < 7; i++)
            //{
            //    problemMediaViewModel = new ProblemMediaViewModel();
            //    problemMediaViewModel.ID = i;
            //    problemMediaViewModel.ProblemID = 1;
            //    problemMediaViewModel.IsImage = false;
            //    problemMediaViewModel.MediaPath = ServerSettings.WebApplicationURL + "/upload/video/robotic.mp4";
            //    model.ProblemMediaViewModelList.Add(problemMediaViewModel);
            //}

            //ProblemHashTagsViewModel problemHashTagsViewModel = null;

            //problemHashTagsViewModel = new ProblemHashTagsViewModel();
            //problemHashTagsViewModel.ID = 1;
            //problemHashTagsViewModel.ProblemID = 1;
            //problemHashTagsViewModel.Name = "Washing machine";
            //model.ProblemHashTagsViewModelList.Add(problemHashTagsViewModel);

            //problemHashTagsViewModel = new ProblemHashTagsViewModel();
            //problemHashTagsViewModel.ID = 2;
            //problemHashTagsViewModel.ProblemID = 1;
            //problemHashTagsViewModel.Name = "Electronic Items";
            //model.ProblemHashTagsViewModelList.Add(problemHashTagsViewModel);

            //problemHashTagsViewModel = new ProblemHashTagsViewModel();
            //problemHashTagsViewModel.ID = 3;
            //problemHashTagsViewModel.ProblemID = 1;
            //problemHashTagsViewModel.Name = "elctronic";
            //model.ProblemHashTagsViewModelList.Add(problemHashTagsViewModel);

            //problemHashTagsViewModel = new ProblemHashTagsViewModel();
            //problemHashTagsViewModel.ID = 4;
            //problemHashTagsViewModel.ProblemID = 1;
            //problemHashTagsViewModel.Name = "Motor Problem";
            //model.ProblemHashTagsViewModelList.Add(problemHashTagsViewModel);

            //problemHashTagsViewModel = new ProblemHashTagsViewModel();
            //problemHashTagsViewModel.ID = 5;
            //problemHashTagsViewModel.ProblemID = 1;
            //problemHashTagsViewModel.Name = "Expert needed";
            //model.ProblemHashTagsViewModelList.Add(problemHashTagsViewModel);

            //problemHashTagsViewModel = new ProblemHashTagsViewModel();
            //problemHashTagsViewModel.ID = 6;
            //problemHashTagsViewModel.ProblemID = 1;
            //problemHashTagsViewModel.Name = "videocon";
            //model.ProblemHashTagsViewModelList.Add(problemHashTagsViewModel);

            //problemHashTagsViewModel = new ProblemHashTagsViewModel();
            //problemHashTagsViewModel.ID = 7;
            //problemHashTagsViewModel.ProblemID = 1;
            //problemHashTagsViewModel.Name = "videocon machine";
            //model.ProblemHashTagsViewModelList.Add(problemHashTagsViewModel);

            //BidSummaryListViewModel bidSummaryListViewModel = null;
            //bidSummaryListViewModel = new BidSummaryListViewModel();
            //bidSummaryListViewModel.ID = 1;
            //bidSummaryListViewModel.ProblemID = 1;
            //bidSummaryListViewModel.UserID = 1;
            //bidSummaryListViewModel.ProfileImagePath = ServerSettings.WebApplicationURL + "/upload/profilepic/CharlesProfilePicture1.jpg";
            //bidSummaryListViewModel.FirstName = "Charles";
            //bidSummaryListViewModel.LastName = "Brown";
            //bidSummaryListViewModel.ResolutionDescription = "Having good experice of working with electronics";
            //bidSummaryListViewModel.IsSelected = true;
            //bidSummaryListViewModel.IsRated = true;
            //bidSummaryListViewModel.UserRating = 4;
            //bidSummaryListViewModel.IsInvited = true;
            //bidSummaryListViewModel.CurrencyDisplayText = "Rs";
            //bidSummaryListViewModel.Amount = 300M;
            //bidSummaryListViewModel.CreatedDate = DateTime.Now;
            //bidSummaryListViewModel.Distance = 33.36M;
            //bidSummaryListViewModel.QuickBloxUserID = "5815727";
            //bidSummaryListViewModel.Latitude = 21.213443M;
            //bidSummaryListViewModel.Longitude = 72.796905M;
            //bidSummaryListViewModel.BidID = 6542;
            //model.AllBidSummaryListViewModel.Add(bidSummaryListViewModel);
            //model.InvitedBidSummaryListViewModel.Add(bidSummaryListViewModel);
            //model.SelectedBidSummaryListViewModel.Add(bidSummaryListViewModel);

            //bidSummaryListViewModel = new BidSummaryListViewModel();
            //bidSummaryListViewModel.ID = 2;
            //bidSummaryListViewModel.ProblemID = 1;
            //bidSummaryListViewModel.UserID = 2;
            //bidSummaryListViewModel.ProfileImagePath = ServerSettings.WebApplicationURL + "/upload/profilepic/images.jpg";
            //bidSummaryListViewModel.FirstName = "Brendon";
            //bidSummaryListViewModel.LastName = "Taylor";
            //bidSummaryListViewModel.ResolutionDescription = "Gradute from IIT Kanpur and passion is about electronic";
            //bidSummaryListViewModel.IsSelected = true;
            //bidSummaryListViewModel.IsRated = true;
            //bidSummaryListViewModel.UserRating = 3;
            //bidSummaryListViewModel.IsInvited = false;
            //bidSummaryListViewModel.CurrencyDisplayText = "Rs";
            //bidSummaryListViewModel.Amount = 500M;
            //bidSummaryListViewModel.CreatedDate = DateTime.Now;
            //bidSummaryListViewModel.Distance = 89.13M;
            //bidSummaryListViewModel.QuickBloxUserID = "5815727";
            //bidSummaryListViewModel.Latitude = 12.971599M;
            //bidSummaryListViewModel.Longitude = 77.594563M;
            //bidSummaryListViewModel.BidID = 4850;
            //model.AllBidSummaryListViewModel.Add(bidSummaryListViewModel);
            //model.SelectedBidSummaryListViewModel.Add(bidSummaryListViewModel);

            //bidSummaryListViewModel = new BidSummaryListViewModel();
            //bidSummaryListViewModel.ID = 3;
            //bidSummaryListViewModel.ProblemID = 1;
            //bidSummaryListViewModel.UserID = 3;
            //bidSummaryListViewModel.ProfileImagePath = ServerSettings.WebApplicationURL + "/upload/profilepic/enlarged-facebook-profile-picture.jpg";
            //bidSummaryListViewModel.FirstName = "Jesica";
            //bidSummaryListViewModel.LastName = "Martin";
            //bidSummaryListViewModel.ResolutionDescription = "Having experience of working with Sharp Technology for 2 years";
            //bidSummaryListViewModel.IsSelected = false;
            //bidSummaryListViewModel.IsRated = false;
            //bidSummaryListViewModel.UserRating = 0;
            //bidSummaryListViewModel.IsInvited = true;
            //bidSummaryListViewModel.CurrencyDisplayText = "Rs";
            //bidSummaryListViewModel.Amount = 350M;
            //bidSummaryListViewModel.CreatedDate = DateTime.Now;
            //bidSummaryListViewModel.Distance = 63.36M;
            //bidSummaryListViewModel.QuickBloxUserID = "5815727";
            //bidSummaryListViewModel.Latitude = 18.52043M;
            //bidSummaryListViewModel.Longitude = 73.856744M;
            //bidSummaryListViewModel.BidID = 7845;
            //model.AllBidSummaryListViewModel.Add(bidSummaryListViewModel);
            //model.InvitedBidSummaryListViewModel.Add(bidSummaryListViewModel);

            //bidSummaryListViewModel = new BidSummaryListViewModel();
            //bidSummaryListViewModel.ID = 4;
            //bidSummaryListViewModel.ProblemID = 1;
            //bidSummaryListViewModel.UserID = 4;
            //bidSummaryListViewModel.ProfileImagePath = ServerSettings.WebApplicationURL + "/upload/profilepic/profile.jpg";
            //bidSummaryListViewModel.FirstName = "Nathen";
            //bidSummaryListViewModel.LastName = "Astle";
            //bidSummaryListViewModel.ResolutionDescription = "Solve more then 2500 Problems";
            //bidSummaryListViewModel.IsSelected = false;
            //bidSummaryListViewModel.IsRated = true;
            //bidSummaryListViewModel.UserRating = 4;
            //bidSummaryListViewModel.IsInvited = false;
            //bidSummaryListViewModel.CurrencyDisplayText = "Rs";
            //bidSummaryListViewModel.Amount = 300M;
            //bidSummaryListViewModel.CreatedDate = DateTime.Now;
            //bidSummaryListViewModel.Distance = 33.36M;
            //bidSummaryListViewModel.QuickBloxUserID = "5815727";
            //bidSummaryListViewModel.Latitude = 23.022505M;
            //bidSummaryListViewModel.Longitude = 72.571362M;
            //bidSummaryListViewModel.BidID = 2854;
            //model.AllBidSummaryListViewModel.Add(bidSummaryListViewModel);
            //ViewBag.QuotesNextPageIndex = 2;
            //ViewBag.QuotesPageSize = QuotesPageSize;
            //return View(model);
        }
 public ActionResult GetProblemMarker(int pProblemID)
 {
     ProblemObject problemobj = new ProblemObject();
     ResponseObjectForAnything responseObject = new ResponseObjectForAnything();
     ProblemEngine probEngine = new ProblemEngine();
     string response = probEngine.GetProblemDetailsByIdJSON(Request.Cookies["sessionkey"].Value, pProblemID.ToString(), false);
     responseObject = (ResponseObjectForAnything)Serializer.JSONStringToObject<ResponseObjectForAnything>(response);
     problemobj = (ProblemObject)Serializer.JSONStringToObject<ProblemObject>(responseObject.ResultObjectJSON);
     return PartialView("_ProblemMarkerDetail", problemobj.individualproblem);
     //ProblemListViewModel model = new ProblemListViewModel();
     //model.ProblemID = 1;
     //model.Address1 = "15-c/shubham flats";
     //model.Address2 = "citylight";
     //model.City = "Ahmedabad";
     //model.State = "Gujarat";
     //model.Country = "India";
     //model.Pincode = "666-0444-02";
     //model.ProblemImageCount = 4;
     //model.ProblemVideoCount = 2;
     //model.ProblemTitle = "Washing Machine";
     //model.ProblemImageName = "~/upload/problem-image/1.JPG";
     //model.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.";
     //return PartialView("_ProblemMarkerDetail",model);
 }
        /// <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);
        }
        public ActionResult GetMediaByProblemId(int pProblemId)
        {
            List<ProblemMedia> lstproblemmedia = new List<ProblemMedia>();
            ResponseObjectForAnything responseObject = new ResponseObjectForAnything();
            ProblemEngine probEngine = new ProblemEngine();
            string response = probEngine.GetProblemMediaForProblemIDJSON(Request.Cookies["sessionkey"].Value, pProblemId.ToString());
            responseObject = (ResponseObjectForAnything)Serializer.JSONStringToObject<ResponseObjectForAnything>(response);
            lstproblemmedia = (List<ProblemMedia>)Serializer.JSONStringToObject<List<ProblemMedia>>(responseObject.ResultObjectJSON);
            return PartialView("_ProblemMediaList", lstproblemmedia);
            //List<ProblemMediaViewModel> modelList = new List<ProblemMediaViewModel>();

            //ProblemMediaViewModel problemMediaViewModel = null;
            //for (int i = 1; i < 5; i++)
            //{
            //    problemMediaViewModel = new ProblemMediaViewModel();
            //    problemMediaViewModel.ID = i;
            //    problemMediaViewModel.ProblemID = 1;
            //    problemMediaViewModel.IsImage = true;
            //    problemMediaViewModel.MediaPath = ServerSettings.WebApplicationURL + "/upload/problem-image/" + i.ToString() + ".JPG";
            //    modelList.Add(problemMediaViewModel);
            //}

            //for (int i = 5; i < 7; i++)
            //{
            //    problemMediaViewModel = new ProblemMediaViewModel();
            //    problemMediaViewModel.ID = i;
            //    problemMediaViewModel.ProblemID = 1;
            //    problemMediaViewModel.IsImage = false;
            //    problemMediaViewModel.MediaPath = ServerSettings.WebApplicationURL + "/upload/video/robotic.mp4";
            //    modelList.Add(problemMediaViewModel);
            //}

            //return PartialView("_ProblemMediaList", modelList);
        }
        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);
        }
        public ActionResult CreateProblem(Problem model, FormCollection form)
        {
            var experts = Request.Form["UserSuggestedExperts"];
            var tags = Request.Form["Tag"];
            HttpFileCollectionBase files = Request.Files;
            ProblemEngine probEngine = new ProblemEngine();
            ResponseObjectForAnything responseObject = new ResponseObjectForAnything();
            CreateProblemObject complexmodel = new CreateProblemObject();
            GetInitialDropDowns(complexmodel);
            int count = 0;
            int actualcount = 0;
            int problemid = 0;
            string[] filePaths = new string[Request.Files.Count];
            string[] fileExtns = new string[Request.Files.Count];
            if (form["ResolutionMethod"] == "Yes")
                form["ResolutionMethod"] = "true";
            else
                form["ResolutionMethod"] = "false";
            if (form["RegisteredAddress"] == "Yes")
                form["RegisteredAddress"] = "true";
            else
                form["RegisteredAddress"] = "false";
            string resultmessage = "";
            if (files.Count > 0)
            {
                foreach (string file in Request.Files)
                {
                    HttpPostedFileBase hpf = Request.Files[count] as HttpPostedFileBase;

                    if (hpf.ContentLength > 0)
                    {
                        string newFileName = Guid.NewGuid().ToString() + "_" + hpf.FileName.Replace(" ", "_");
                        string relativePath = @"~\upload\problem-image\" + newFileName;
                        hpf.SaveAs(Server.MapPath(relativePath));
                        filePaths[actualcount] = ConfigurationManager.AppSettings["ApplicationURL"] + ConfigurationManager.AppSettings["problemimage"] + newFileName;
                        if (newFileName.ToLower().Contains("gif") || newFileName.ToLower().Contains("png") || newFileName.ToLower().Contains("jpg") || newFileName.ToLower().Contains("jpeg"))
                            fileExtns[actualcount] = "image";
                        else
                            fileExtns[actualcount] = "video";
                        actualcount++;
                    }
                    count++;
                }
            }
            string response = probEngine.SaveProblemJSON(Request.Cookies["sessionkey"].Value, null, form["CompanyRelated"], form["CompanyID"], form["ProblemHeading"],
                            form["CategoryID"], form["SubCategory"], form["Product"], form["ModelNo"], form["Description"], form["PurchaseMonth"], form["PurchaseYear"],
                            form["ProductStatusID"], form["ResolutionNeededBy"], form["Tag"], form["ResolutionMethod"], form["RegisteredAddress"], form["AddressLine1"],
                            form["AddressLine2"], form["AddressLine3"], form["City"], form["State"], form["Country"], form["Pincode"]);
            if (!string.IsNullOrEmpty(response)) { responseObject = (ResponseObjectForAnything)Serializer.JSONStringToObject<ResponseObjectForAnything>(response); }
            problemid = responseObject.ResultObjectID;
            bool isValid = false;
            if(responseObject.ResultCode == "SUCCESS")
            {
                isValid = true;
                resultmessage = responseObject.ResultMessage;
                for (int fileCt = 0; fileCt < actualcount; fileCt++)
                {
                    if(filePaths[fileCt] != string.Empty)
                    {
                        response = "";
                        if(fileCt == 0)
                            response = probEngine.SaveMedia(Request.Cookies["sessionkey"].Value, responseObject.ResultObjectID.ToString(), filePaths[fileCt], fileExtns[fileCt], true);
                        else
                            response = probEngine.SaveMedia(Request.Cookies["sessionkey"].Value, responseObject.ResultObjectID.ToString(), filePaths[fileCt], fileExtns[fileCt], false);
                    }
                }
                responseObject = (ResponseObjectForAnything)Serializer.JSONStringToObject<ResponseObjectForAnything>(response);

                if(responseObject.ResultCode == "SUCCESS")
                {
                    if(experts.Count() > 0)
                    {
                        response = probEngine.InviteExpertsJSON(Request.Cookies["sessionkey"].Value, problemid.ToString(), experts);
                        responseObject = (ResponseObjectForAnything)Serializer.JSONStringToObject<ResponseObjectForAnything>(response);
                        if(responseObject.ResultCode == "SUCCESS")
                        {
                            isValid = true;
                        }
                    }
                }
                else
                {
                    isValid = false;
                }
            }
            else
            {
                isValid = false;
            }
            if(!isValid)
            {
                Common.DTO.Alert alert = new Common.DTO.Alert();
                alert.AlertType = Common.DTO.Alert.ALERTTYPE.Error;
                alert.Message = responseObject.ResultMessage;
                alert.MessageType = Common.DTO.Alert.ALERTMESSAGETYPE.OnlyText;
                ViewBag.AlertMessageModel = alert;
            }
            else
            {
                Common.DTO.Alert alert = new Common.DTO.Alert();
                alert.AlertType = Common.DTO.Alert.ALERTTYPE.Success;
                alert.Message = responseObject.ResultMessage;
                alert.MessageType = Common.DTO.Alert.ALERTMESSAGETYPE.TextWithClose;
                ViewBag.AlertMessageModel = alert;
            }
            //if (!string.IsNullOrEmpty(model.VideoStremName1))
            //{
            //    string DirectoryName = ServerSettings.VideoStoragePhysicalFolderPath;

            //    int status = Mapping.ConvertToMp4(ServerSettings.MEDIASERVERURL, model.VideoStremName1 + ".flv", DirectoryName, model.VideoStremName1 + ".mp4");

            //}
            //if (!string.IsNullOrEmpty(model.VideoStremName2))
            //{
            //    string DirectoryName = ServerSettings.VideoStoragePhysicalFolderPath;

            //    int status = Mapping.ConvertToMp4(ServerSettings.MEDIASERVERURL, model.VideoStremName2 + ".flv", DirectoryName, model.VideoStremName2 + ".mp4");

            //}
            return View(complexmodel);
        }
        public ActionResult SearchProblem(int Category, int SubCategory, int CompanyID, int Area, int Pincode, string Location, string ModelNo,
                                         string ProblemHeading, string hastag, int posteddate)
        {
            ResponseObjectForAnything responseObject = new ResponseObjectForAnything();
            List<Problem> lstproblem = new List<Common.DTO.Problem>();
            ProblemEngine probEngine = new ProblemEngine();

            string response = probEngine.GetProblemsBySearchCriteriaJSON(Request.Cookies["sessionkey"].Value, "1", "5", UserSession.LoginLatitude, UserSession.LoginLongitude,
                                                                        Location, Area.ToString(), Category.ToString(), SubCategory.ToString(), CompanyID.ToString(), ModelNo, ProblemHeading, posteddate.ToString());
            responseObject = (ResponseObjectForAnything)Serializer.JSONStringToObject<ResponseObjectForAnything>(response);
            lstproblem = (List<Problem>)Serializer.JSONStringToObject<List<Problem>>(responseObject.ResultObjectJSON);
            ViewBag.NextPageIndex = 2;
            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 PartialView("_ProblemList", lstproblem);
        }
        public ActionResult RecentProblemResolutionList()
        {
            List<RecentProblemObject> recentprobobj = new List<RecentProblemObject>();
            ResponseObjectForAnything responseObject = new ResponseObjectForAnything();
            ProblemEngine probEngine = new ProblemEngine();
            string response = probEngine.GetRecentProblemsJSON(Request.Cookies["sessionkey"].Value);
            responseObject = (ResponseObjectForAnything)Serializer.JSONStringToObject<ResponseObjectForAnything>(response);
            recentprobobj = (List<RecentProblemObject>)Serializer.JSONStringToObject<List<RecentProblemObject>>(responseObject.ResultObjectJSON);
            return PartialView("_RecentProblems", recentprobobj);
            //List<RecentProblemResolutionViewModel> model = new List<RecentProblemResolutionViewModel>();
            //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.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.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.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.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.Add(recentProblemModel);
            //return PartialView("_RecentProblems", model);
        }
Beispiel #9
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            if (cmbService.SelectedValue == "CreateUser")
            {
                UserEngine user = new UserEngine();

                txtResult.Text = user.CreateUserJSON(txtFirstName.Text, txtLastName.Text, txtDisplayName.Text, txtEmail.Text, txtArea.Text, txtCity.Text, txtPinCode.Text, Convert.ToString(chkUser.Checked),
                    Convert.ToString(chkExpert.Checked), txtCatSubCat.Text, txtPassword.Text, txtDevice.Text);
            }
            if (cmbService.SelectedValue == "GetCountries")
            {
                string url = baseURL + "?fc=getcountries";
                using (WebClient client = new WebClient())
                {
                    //client.QueryString.Add("ID", "1040"); //add parameters
                    //client.Credentials = CredentialCache.DefaultCredentials;
                    //I tried to add credentials like this
                    //client.Credentials = new NetworkCredential("*****@*****.**", "Sparky@123#");

                    txtResult.Text = client.DownloadString(url);
                }

                //MasterlistEngine master = new MasterlistEngine();

            }
            if (cmbService.SelectedValue == "GetStates")
            {
                string url = baseURL + "?fc=getstates&countryid=3";
                using (WebClient client = new WebClient())
                {
                    //client.QueryString.Add("ID", "1040"); //add parameters
                    //client.Credentials = CredentialCache.DefaultCredentials;
                    //I tried to add credentials like this
                    //client.Credentials = new NetworkCredential("*****@*****.**", "Sparky@123#");

                    txtResult.Text = client.DownloadString(url);
                }

                //MasterlistEngine master = new MasterlistEngine();

            }
            if (cmbService.SelectedValue == "GetCompanies")
            {
                string url = baseURL + "?fc=getcompanies";
                using (WebClient client = new WebClient())
                {
                    //client.QueryString.Add("ID", "1040"); //add parameters
                    //client.Credentials = CredentialCache.DefaultCredentials;
                    //I tried to add credentials like this
                    //client.Credentials = new NetworkCredential("*****@*****.**", "Sparky@123#");

                    txtResult.Text = client.DownloadString(url);
                }

                //MasterlistEngine master = new MasterlistEngine();

            }
            if (cmbService.SelectedValue == "GetProblems")
            {
                string url = baseURL + "?fc=getproblems&sessionkey="+txtSessionKey.Text+"&startindex="+txtStartIndex.Text+"&pagesize="+txtPageSize.Text+"&latitude="+txtLatitude.Text+
                                    "&longitude=" + txtLongitude.Text + "&distance=" + txtDistance.Text + "&categoryid=" + txtCategory.Text + "&subcategoryid=" + txtSubCategory.Text +
                                    "&modelno=" +txtModel.Text+"&heading="+txtHeading.Text+"&startdate="+txtStartDate.Text +"&enddate="+txtEndDate.Text;
                using (WebClient client = new WebClient())
                {
                    //client.QueryString.Add("ID", "1040"); //add parameters
                    //client.Credentials = CredentialCache.DefaultCredentials;
                    //I tried to add credentials like this
                    //client.Credentials = new NetworkCredential("*****@*****.**", "Sparky@123#");

                    txtResult.Text = client.DownloadString(url);
                }

                //MasterlistEngine master = new MasterlistEngine();

            }
            if (cmbService.SelectedValue == "GetCategories")
            {
                string url = baseURL + "?fc=getcategories";
                using (WebClient client = new WebClient())
                {
                    txtResult.Text = client.DownloadString(url);
                }
            }
            if (cmbService.SelectedValue == "GetProblemStatus")
            {
                string url = baseURL + "?fc=getproblemstatus&sessionkey="+txtSessionKey.Text;
                using (WebClient client = new WebClient())
                {
                    txtResult.Text = client.DownloadString(url);
                }
            }
            if (cmbService.SelectedValue == "GetProductStatus")
            {
                string url = baseURL + "?fc=getproductstatus&sessionkey=" + txtSessionKey.Text;
                using (WebClient client = new WebClient())
                {
                    txtResult.Text = client.DownloadString(url);
                }
            }
            if (cmbService.SelectedValue == "GetResolutionMethods")
            {
                string url = baseURL + "?fc=getresolutionmethod&sessionkey=" + txtSessionKey.Text;
                using (WebClient client = new WebClient())
                {
                    txtResult.Text = client.DownloadString(url);
                }
            }
            if (cmbService.SelectedValue == "GetCurrencies")
            {
                string url = baseURL + "?fc=getcurrencies&sessionkey=" + txtSessionKey.Text;
                using (WebClient client = new WebClient())
                {
                    txtResult.Text = client.DownloadString(url);
                }
            }
            if (cmbService.SelectedValue == "GetSubCategories")
            {
                string url = baseURL + "?fc=getsubcategories&categoryid="+txtCategory.Text;
                using (WebClient client = new WebClient())
                {
                    txtResult.Text = client.DownloadString(url);
                }
            }
            if (cmbService.SelectedValue == "GetProducts")
            {
                string url = baseURL + "?fc=getproducts&sessionkey="+txtSessionKey.Text +"&categoryid=" + txtCategory.Text+"&subcategoryid="+txtSubCategory.Text;
                using (WebClient client = new WebClient())
                {
                    txtResult.Text = client.DownloadString(url);
                }
            }
            if (cmbService.SelectedValue == "CreateSession")
            {
                string url = baseURL + "?fc=createsession&emailid="+txtEmail.Text+"&password="******"&devicetoken="+txtDevice.Text;
                using (WebClient client = new WebClient())
                {
                    txtResult.Text = client.DownloadString(url);
                }
            }
            if(cmbService.SelectedValue =="Logout")
            {
                string url = baseURL + "?fc=logout&sessionkey=" + txtSessionKey.Text + "&devicetoken=" + txtDevice.Text;
                using (WebClient client = new WebClient())
                {
                    txtResult.Text = client.DownloadString(url);
                }
            }
            if (cmbService.SelectedValue == "GetUserFromSession")
            {
                string url = baseURL + "?fc=getuserfromsession&sessionkey=" + txtSessionKey.Text;
                using (WebClient client = new WebClient())
                {
                    txtResult.Text = client.DownloadString(url);
                }
            }
            if (cmbService.SelectedValue == "PostProblem")
            {
                ProblemEngine probEngine = new ProblemEngine();
                txtResult.Text = probEngine.SaveProblem(txtSessionKey.Text, txtProblemId.Text, "true", txtCompanyId.Text, txtHeading.Text, txtCategory.Text, txtSubCategory.Text, txtProduct.Text,
                                                        txtModel.Text, txtDescription.Text, txtPurchaseMonth.Text, txtPurchaseYear.Text, txtProductStatus.Text, txtResolutionNeeded.Text,
                                                        txtHashTags.Text, "false", "true", "","","","","","","");
                //string url = baseURL + "?fc=saveproblem&sessionkey=" + txtSessionKey.Text + "&problemid="+txtProblemId.Text+"&companyrelated=true&companyid="+txtCompanyId.Text+"&heading="+txtHeading.Text+
                  //           "&categoryid="+txtCategory.Text+"&subcategoryid="+txtSubCategory.Text+"&productid="+txtProduct.Text+"&modelno="+txtModel.Text+"&description="+txtDescription.Text+
                    //         "&purchasemonth="+txtPurchaseMonth.Text+"&purchaseyear="+txtPurchaseYear.Text+"&productstatus="+txtProductStatus.Text+"&resolutionneededby="+txtResolutionNeeded.Text+
                      //       "&hashtags=" + txtHashTags.Text + "&isvirtual=false&isregisteredaddr=true&address1=&address2=&address3=&city=&countryid=&stateid=&pincode=";
                //string url = "probfox.azurewebsites.net/webservices/probfox.ashx?fc=saveproblem&sessionkey=A1C95E9E-1FE1-4315-B5DB-CE5983A9DF09&problemid=null&companyrelated=true&companyid=1&problemheading=test&categoryid=1&subcategoryid=1&productid=1&modelno=abc123&description=test%20desc&purchasemonth=01&purchaseyear=2015&productstatus=1&resolutionneededby=null&hashtags=test,test1;&isvirtual=false&isregisteredaddress=true&address1=&address2&address3=&city=&stateid=&countryid=&pincode=";
                //using (WebClient client = new WebClient())
                //{
                //    txtResult.Text = client.DownloadString(url);
                //}
            }
            if (cmbService.SelectedValue == "UploadFiles")
            {
                string fileName = FileUpload1.FileName;
                string url = fileUploadBaseURL + "?fc=uploadfile&sessionkey=" + txtSessionKey.Text + "&filename=" + fileName + "&filetype=" + txtFileType.Text;
                WebClient client = new WebClient();
                txtResult.Text = client.DownloadString(url);
            }
            if (cmbService.SelectedValue == "EditBid")
            {
                BidEngine bid = new BidEngine();
                //txtResult.Text = bid.SaveBids(txtSessionKey.Text, txtProblemId.Text, null, txtDescription.Text, "1", txtLink1.Text, txtTitle1.Text, txtLink2.Text, txtTitle2.Text, "1", "500", null, "20/09/2015,10:00,11:00;21/09/2015,17:00,19:00", "false");
            }
        }
Beispiel #10
0
        /// <summary>
        /// This method is used to upload images and videos.
        /// </summary>
        /// <param name="sessionKey">string</param>
        /// <param name="filename">string</param>
        /// <param name="context">string</param>
        /// <param name="filetype">string</param>
        /// <param name="problemId">string</param>
        /// <returns>string</returns>
        public string UploadFiles(string sessionKey, HttpContext context, string fileType, 
                                  string problemId, string resolutionId)
        {
            string retValue = string.Empty;
            string fileUploadPath = "media";
            string newFileName = string.Empty;
            AuthenticationEngine authEngine = new AuthenticationEngine();
            ResponseObjectForAnything obj = new ResponseObjectForAnything();
            ProblemEngine probEngine = new ProblemEngine();
            BidEngine bidEngine = new BidEngine();
            UserEngine user = new UserEngine();
            try
            {
                bool isValid = true;
                if (!string.IsNullOrEmpty(sessionKey)) { authEngine.IsValidSession(sessionKey); }

                if (isValid)
                {
                    obj.ResultCode = "SUCCESS";

                    if (Directory.Exists(fileUploadPath) == false) { Directory.CreateDirectory(fileUploadPath); }

                    HttpFileCollection files = context.Request.Files;
                    string[] uplaodedfiles = new string[files.Count];
                    for (int filecount = 0; filecount < files.Count; filecount++)
                    {
                        HttpPostedFile file = files[filecount];
                        string fname;
                        if (HttpContext.Current.Request.Browser.Browser.ToUpper() == "IE" || HttpContext.Current.Request.Browser.Browser.ToUpper() == "INTERNETEXPLORER")
                        {
                            string[] testfiles = file.FileName.Split(new char[] { '\\' });
                            fname = testfiles[testfiles.Length - 1];
                        }
                        else
                        {
                            fname = file.FileName;
                        }
                        //fname = System.IO.Path.Combine(context.Server.MapPath("~/uploads/"), fname);
                        newFileName = Guid.NewGuid().ToString() + "_" + fname.Replace(" ", "_");
                        if (ConfigurationManager.AppSettings["FileUploadPath"] != null)
                        {
                            fileUploadPath = ConfigurationManager.AppSettings["FileUploadPath"].ToString();
                        }

                        fileUploadPath = context.Server.MapPath("~/" + fileUploadPath + "/");

                        string sPath = fileUploadPath + newFileName;
                        file.SaveAs(sPath);
                        obj.ResultMessage = newFileName;
                        //if (fileType.ToLower() == "profileimage") { user.SaveUserProfileImage(sessionKey, newFileName); }
                        //else if (fileType.ToLower() == "problemimage") { obj.ResultObjectJSON = probEngine.SaveMedia(sessionKey, problemId, sPath, "image"); }
                        //else if (fileType.ToLower() == "problemvideo") { obj.ResultObjectJSON = probEngine.SaveMedia(sessionKey, problemId, sPath, "video"); }
                        //else if (fileType.ToLower() == "resolutionimage") { obj.ResultObjectJSON = bidEngine.SaveMedia(sessionKey, resolutionId, sPath, "image"); }
                        //else if (fileType.ToLower() == "resolutionvideo") { obj.ResultObjectJSON = bidEngine.SaveMedia(sessionKey, resolutionId, sPath, "video"); }
                    }
                    //Stream objStream = context.Request.InputStream;
                    //StreamReader objStreamReader = new StreamReader(objStream);
                    //// instance a filestream pointing to the
                    //// storage folder, use the original file name
                    //// to name the resulting file
                    //FileStream fs = new FileStream(sPath, FileMode.Create);

                    //// write the memory stream containing the original
                    //// file as a byte array to the filestream
                    //ms.WriteTo(fs);
                    //// clean up
                    //ms.Close();
                    //fs.Close();
                    //fs.Dispose();
                }
            }
            catch (Exception ex)
            {
                obj.ResultCode = "ERROR";
                obj.ResultMessage = ex.Message.ToString();
                CustomException exc = new CustomException(ex.ToString(), this.ToString(), "UploadFiles", System.DateTime.Now);
                ExceptionManager.PublishException(exc);
            }
            retValue = Serializer.ObjectToJSON(obj);
            return retValue;
        }