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 ResponseObjectForAnything GetRecentProblems(string sessionkey) { ResponseObjectForAnything responseObject = new ResponseObjectForAnything(); List<Problem> recentproblst = new List<Problem>(); AuthenticationEngine authEngine = new AuthenticationEngine(); int count = 0; bool isValid = true; if (!string.IsNullOrEmpty(sessionkey)) { isValid = authEngine.IsValidSession(sessionkey); } if(isValid) { try { Database db = DatabaseFactory.CreateDatabase(); DbCommand dbCommand = db.GetStoredProcCommand("usp_GetRecentProblems"); DataSet dsRecentProbs = db.ExecuteDataSet(dbCommand); if(dsRecentProbs.Tables.Count > 0) { DataTable tRecentProbs = dsRecentProbs.Tables[0]; foreach(DataRow dRow in tRecentProbs.Rows) { Problem problem = new Problem(); if (dRow["ID"] != DBNull.Value) { problem.ID = Int32.Parse(dRow["ID"].ToString()); } if (dRow["Thumbnailmedia"] != DBNull.Value) { problem.ThumbnailMedia = dRow["Thumbnailmedia"].ToString(); } if (dRow["ProblemHeading"] != DBNull.Value) { problem.ProblemHeading = dRow["ProblemHeading"].ToString(); } if (dRow["Description"] != DBNull.Value) { problem.Description = dRow["Description"].ToString(); } recentproblst.Add(problem); count++; } } else { responseObject.ResultCode = "SUCCESS"; responseObject.ResultMessage = "No recently resolved videos found."; } responseObject.ResultCode = "SUCCESS"; responseObject.ResultObjectRecordCount = count; responseObject.ResultObjectJSON = Serializer.ObjectToJSON(recentproblst); if (count <= 0) { responseObject.ResultMessage = "No recently resolved videos found."; } } catch (Exception ex) { responseObject.ResultCode = "ERROR"; responseObject.ResultMessage = ex.Message; CustomException exc = new CustomException(ex.ToString(), this.ToString(), "GetProblemDetailById", System.DateTime.Now); ExceptionManager.PublishException(exc); } } return responseObject; }
/// <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; }
/// <summary> /// This method gets the problems based on search criteria. /// </summary> /// <param name="sessionKey">string</param> /// <param name="startIndex">string</param> /// <param name="pageSize">string</param> /// <param name="latitude">string</param> /// <param name="longitude">string</param> /// <param name="distance">string</param> /// <param name="categoryid">string</param> /// <param name="subcategoryid">string</param> /// <param name="companyname">string</param> /// <param name="isLandingPage">string</param> /// <returns>List<Problem></returns> public List<Problem> GetProblemsBySearchCriteria(string sessionKey, string startIndex, string pageSize, string latitude, string longitude, string location, string distance, string categoryid, string subcategoryid, string companyname, string modelno, string problemheading, string posteddate) { List<Problem> problemlist = new List<Problem>(); AuthenticationEngine authEngine = new AuthenticationEngine(); bool isValid = true; if (!string.IsNullOrEmpty(sessionKey)) { isValid = authEngine.IsValidSession(sessionKey); } List<Problem> lstproblem = new List<Problem>(); Int32 sIndex = 1; Int32 pSize = 10; if (isValid) { try { if (!string.IsNullOrEmpty(startIndex)) { sIndex = Int32.Parse(startIndex); } if (!string.IsNullOrEmpty(pageSize)) { pSize = Int32.Parse(pageSize); } Database db = DatabaseFactory.CreateDatabase(); DbCommand dbCommand = db.GetStoredProcCommand("usp_GetProblemsAll"); db.AddInParameter(dbCommand, "@StartIndex", DbType.Int32, sIndex); db.AddInParameter(dbCommand, "@PageSize", DbType.Int32, pSize); db.AddInParameter(dbCommand, "@Latitude", DbType.Decimal, Convert.ToDecimal(latitude)); db.AddInParameter(dbCommand, "@Longitude", DbType.Decimal, Convert.ToDecimal(longitude)); db.AddInParameter(dbCommand, "@Location", DbType.String, location); db.AddInParameter(dbCommand, "@Distance", DbType.Int32, Int32.Parse(distance)); db.AddInParameter(dbCommand, "@CategoryID", DbType.Int32, Int32.Parse(categoryid)); db.AddInParameter(dbCommand, "@SubCategoryID", DbType.Int32, Int32.Parse(subcategoryid)); db.AddInParameter(dbCommand, "@CompanyName", DbType.String, companyname); db.AddInParameter(dbCommand, "@ProblemHeading", DbType.String, problemheading); db.AddInParameter(dbCommand, "@ModelNo", DbType.String, modelno); db.AddInParameter(dbCommand, "@PostedDate", DbType.DateTime, Int32.Parse(posteddate)); 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(); if (dRow["ID"] != DBNull.Value) { problem.ID = Int32.Parse(dRow["ID"].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["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["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["CountryID"] != DBNull.Value) { problem.CountryID = Int32.Parse(dRow["CountryID"].ToString()); } if (dRow["PinCode"] != DBNull.Value) { problem.PinCode = dRow["PinCode"].ToString(); } if (dRow["ThumbnailMedia"] != DBNull.Value) { problem.PinCode = dRow["ThumbnailMedia"].ToString(); } lstproblem.Add(problem); } } } catch (Exception ex) { CustomException exc = new CustomException(ex.ToString(), this.ToString(), "GetProblemsBySearchCriteria", System.DateTime.Now); ExceptionManager.PublishException(exc); } } if (lstproblem.Count > 0) return (lstproblem); else return null; }
/// <summary> /// Get problem details for markup on maps /// </summary> /// <param name="sessionkey">string</param> /// <param name="problemid">string</param> /// <returns>string</returns> public ResponseObjectForAnything GetProblemDetailsForMarkup(string sessionkey, string problemid) { Problem problem = new Problem(); ResponseObjectForAnything responseObject = new ResponseObjectForAnything(); AuthenticationEngine authEngine = new AuthenticationEngine(); bool isValid = true; int count = 0; if (!string.IsNullOrEmpty(sessionkey)) { isValid = authEngine.IsValidSession(sessionkey); } if (isValid) { try { Database db = DatabaseFactory.CreateDatabase(); DbCommand dbCommand = db.GetStoredProcCommand("usp_GetProblemDetailsForMarkup"); db.AddInParameter(dbCommand, "@ProblemID", DbType.Int32, Int32.Parse(problemid)); DataSet dsProblem = db.ExecuteDataSet(dbCommand); if (dsProblem.Tables.Count > 0) { DataTable tProblem = dsProblem.Tables[0]; foreach (DataRow dRow in tProblem.Rows) { if (dRow["ID"] != DBNull.Value) { problem.ID = Int32.Parse(dRow["ID"].ToString()); } if (dRow["Address1"] != DBNull.Value) { problem.Address1 = dRow["Address1"].ToString(); } if (dRow["Address2"] != DBNull.Value) { problem.Address2 = dRow["Address2"].ToString(); } if (dRow["City"] != DBNull.Value) { problem.City = dRow["City"].ToString(); } if (dRow["StateName"] != DBNull.Value) { problem.StateName = dRow["StateName"].ToString(); } if (dRow["CountryName"] != DBNull.Value) { problem.CountryName = dRow["CountryName"].ToString(); } if (dRow["PinCode"] != DBNull.Value) { problem.PinCode = dRow["PinCode"].ToString(); } if (dRow["ProblemImageCount"] != DBNull.Value) { problem.ProblemImageCount = Int32.Parse(dRow["ProblemImageCount"].ToString()); } if (dRow["ProblemVideoCount"] != DBNull.Value) { problem.ProblemVideoCount = Int32.Parse(dRow["ProblemVideoCount"].ToString()); } count++; } } else { responseObject.ResultCode = "SUCCESS"; responseObject.ResultMessage = "No information found for this problem."; } responseObject.ResultCode = "SUCCESS"; responseObject.ResultObjectRecordCount = count; responseObject.ResultObjectJSON = Serializer.ObjectToJSON(problem); 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(), "GetProblemDetailsForMarkup", System.DateTime.Now); ExceptionManager.PublishException(exc); } } return (responseObject); }
/// <summary> /// This method gets the details for a particular /// problem. It contains all bid details and details /// of all users who bidded on that problem. /// </summary> /// <param name="sessionKey">string</param> /// <param name="problemId">int</param> /// <returns>ProblemObject</returns> public ResponseObjectForAnything GetProblemDetailById(string sessionKey, string problemId, bool ispaging) { ResponseObjectForAnything responseObject = new ResponseObjectForAnything(); ProblemObject problemdetailobject = new ProblemObject(); List<Problem> lstproblem = new List<Problem>(); AuthenticationEngine authEngine = new AuthenticationEngine(); List<User> lstuser = new List<User>(); List<ProblemHashTag> lstproblemhashtag = new List<ProblemHashTag>(); List<ProblemMedia> lstproblemmedia = new List<ProblemMedia>(); int count = 0; bool isValid = true; if (!string.IsNullOrEmpty(sessionKey)) { isValid = authEngine.IsValidSession(sessionKey); } if (isValid) { try { Database db = DatabaseFactory.CreateDatabase(); DbCommand dbCommand = db.GetStoredProcCommand("usp_GetProblemDetailByID"); db.AddInParameter(dbCommand, "@Sessionkey", DbType.String, sessionKey); if (!string.IsNullOrEmpty(problemId)) { db.AddInParameter(dbCommand, "@ProblemID", DbType.Int32, Int32.Parse(problemId)); } else { db.AddInParameter(dbCommand, "@ProblemID", DbType.Int32, null); } db.AddInParameter(dbCommand, "@IsPaging", DbType.Boolean, ispaging); DataSet dsProblemDetail = db.ExecuteDataSet(dbCommand); if (!ispaging) { if (dsProblemDetail.Tables.Count > 0) { DataTable tUser = dsProblemDetail.Tables[0]; foreach (DataRow tRow in tUser.Rows) { User user = new User(); if (tRow["UserID"] != DBNull.Value) { user.UserID = Int32.Parse(tRow["UserID"].ToString()); } if (tRow["EmailId"] != DBNull.Value) { user.EmailID = tRow["EmailId"].ToString(); } if (tRow["FirstName"] != DBNull.Value) { user.FirstName = tRow["FirstName"].ToString(); } if (tRow["LastName"] != DBNull.Value) { user.LastName = tRow["LastName"].ToString(); } if (tRow["ProfilePicPath"] != DBNull.Value) { user.ProfilePicPath = tRow["ProfilePicPath"].ToString(); } if (tRow["DisplayName"] != DBNull.Value) { user.DisplayName = tRow["DisplayName"].ToString(); } if (tRow["CountryCode"] != DBNull.Value) { user.CountryCode = tRow["CountryCode"].ToString(); } if (tRow["PhoneNumber"] != DBNull.Value) { user.PhoneNumber = tRow["PhoneNumber"].ToString(); } if (tRow["Address1"] != DBNull.Value) { user.Address1 = tRow["Address1"].ToString(); } if (tRow["Address2"] != DBNull.Value) { user.Address2 = tRow["Address2"].ToString(); } if (tRow["Address3"] != DBNull.Value) { user.Address3 = tRow["Address3"].ToString(); } if (tRow["City"] != DBNull.Value) { user.City = tRow["City"].ToString(); } if (tRow["StateID"] != DBNull.Value) { user.StateID = Int32.Parse(tRow["StateID"].ToString()); } if (tRow["CountryID"] != DBNull.Value) { user.CountryID = Int32.Parse(tRow["CountryID"].ToString()); } if (tRow["BriefDescription"] != DBNull.Value) { user.BriefDescription = tRow["BriefDescription"].ToString(); } if (tRow["QuickBloxUserName"] != DBNull.Value) { user.QuickBloxUserName = tRow["QuickBloxUserName"].ToString(); } if (tRow["QuickBloxPassword"] != DBNull.Value) { user.QuickBloxPassword = tRow["QuickBloxPassword"].ToString(); } if (tRow["ProfileCompleteness"] != DBNull.Value) { user.ProfileCompleteness = Int32.Parse(tRow["ProfileCompleteness"].ToString()); } lstuser.Add(user); } problemdetailobject.user = lstuser; } if (dsProblemDetail.Tables.Count > 1) { DataTable tProblem = dsProblemDetail.Tables[1]; Problem problem = new Problem(); foreach (DataRow dRow in tProblem.Rows) { 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["CategoryName"] != DBNull.Value) { problem.CategoryName = dRow["CategoryName"].ToString(); } if (dRow["SubCategoryID"] != DBNull.Value) { problem.SubCategoryID = Int32.Parse(dRow["SubCategoryID"].ToString()); } if (dRow["SubCategoryName"] != DBNull.Value) { problem.SubCategoryName = dRow["SubCategoryName"].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(); } //lstproblem.Add(problem); } problemdetailobject.individualproblem = problem; } if (dsProblemDetail.Tables.Count > 2) { DataTable tProblemHashTag = dsProblemDetail.Tables[2]; List<ProblemHashTag> lstHashTag = new List<ProblemHashTag>(); foreach (DataRow dRow in tProblemHashTag.Rows) { ProblemHashTag problemhashtag = new ProblemHashTag(); if (dRow["ProblemID"] != DBNull.Value) { problemhashtag.ProblemID = Int32.Parse(dRow["ProblemID"].ToString()); } if (dRow["HashTagID"] != DBNull.Value) { problemhashtag.HashTagID = Int32.Parse(dRow["HashTagID"].ToString()); } if (dRow["Name"] != DBNull.Value) { problemhashtag.HashTag = dRow["Name"].ToString(); } lstHashTag.Add(problemhashtag); } problemdetailobject.problemhashtag = lstHashTag; } if (dsProblemDetail.Tables.Count > 3) { DataTable tProblemMedia = dsProblemDetail.Tables[3]; List<ProblemMedia> lstHashTag = new List<ProblemMedia>(); foreach (DataRow dRow in tProblemMedia.Rows) { ProblemMedia problemmedia = new ProblemMedia(); if (dRow["ProblemMediaID"] != DBNull.Value) { problemmedia.ProblemMediaID = Int32.Parse(dRow["ProblemMediaID"].ToString()); } if (dRow["ProblemID"] != DBNull.Value) { problemmedia.ProblemID = Int32.Parse(dRow["ProblemID"].ToString()); } if (dRow["IsImage"] != DBNull.Value) { problemmedia.IsImage = Convert.ToBoolean(dRow["IsImage"].ToString()); } if (dRow["MediaPath"] != DBNull.Value) { problemmedia.MediaPath = dRow["MediaPath"].ToString(); } lstHashTag.Add(problemmedia); } problemdetailobject.problemmedia = lstproblemmedia; } } if (!ispaging && dsProblemDetail.Tables.Count > 4 || ispaging && dsProblemDetail.Tables.Count > 0) { DataTable tProblemBids = dsProblemDetail.Tables[4]; List<ProblemBid> lstproblembid = new List<ProblemBid>(); foreach (DataRow dRow in tProblemBids.Rows) { ProblemBid bid = new ProblemBid(); if (dRow["BidId"] != DBNull.Value) { bid.BidID = Int32.Parse(dRow["BidId"].ToString()); } if (dRow["ProblemID"] != DBNull.Value) { bid.ProblemID = Int32.Parse(dRow["ProblemID"].ToString()); } if (dRow["UserID"] != DBNull.Value) { bid.UserID = Int32.Parse(dRow["UserID"].ToString()); } if (dRow["DisplayName"] != DBNull.Value) { bid.DisplayName = dRow["DisplayName"].ToString(); } if (dRow["ProfilePicPath"] != DBNull.Value) { bid.ProfileImagePath = dRow["ProfilePicPath"].ToString(); } if (dRow["BriefDescription"] != DBNull.Value) { bid.BriefDescription = dRow["BriefDescription"].ToString(); } if (dRow["QuickBloxUserName"] != DBNull.Value) { bid.QuickBloxUserID = dRow["QuickBloxUserName"].ToString(); } if (dRow["Longitude"] != DBNull.Value) { bid.Longitude = Convert.ToDecimal(dRow["Longitude"].ToString()); } if (dRow["Latitude"] != DBNull.Value) { bid.Latitude = Convert.ToDecimal(dRow["Latitude"].ToString()); } if (dRow["Distance"] != DBNull.Value) { bid.Distance = Convert.ToDecimal(dRow["Distance"].ToString()); } if (dRow["Description"] != DBNull.Value) { bid.ResolutionDescription = dRow["Description"].ToString(); } if (dRow["ResolutionMethodID"] != DBNull.Value) { bid.ResolutionMethodID = Int32.Parse(dRow["ResolutionMethodID"].ToString()); } if (dRow["ResolutionLink1"] != DBNull.Value) { bid.ResolutionLink1 = dRow["ResolutionLink1"].ToString(); } if (dRow["ResolutionLink2"] != DBNull.Value) { bid.ResolutionLink2 = dRow["ResolutionLink2"].ToString(); } if (dRow["CurrencyID"] != DBNull.Value) { bid.CurrencyID = Int32.Parse(dRow["CurrencyID"].ToString()); } if (dRow["CurrencyName"] != DBNull.Value) { bid.CurrencyName = dRow["CurrencyName"].ToString(); } if (dRow["CurrencyDisplayText"] != DBNull.Value) { bid.CurrencyDisplayText = dRow["CurrencyDisplayText"].ToString(); } if (dRow["Amount"] != DBNull.Value) { bid.Amount = Convert.ToDecimal(dRow["Amount"].ToString()); } if (dRow["CompanyID"] != DBNull.Value) { bid.CompanyID = Int32.Parse(dRow["CompanyID"].ToString()); } if (dRow["CompanyName"] != DBNull.Value) { bid.CompanyName = dRow["CompanyName"].ToString(); } if (dRow["UserID"] != DBNull.Value) { bid.UserID = Int32.Parse(dRow["UserID"].ToString()); } if (dRow["IsSelected"] != DBNull.Value) { bid.IsSelected = Convert.ToBoolean(dRow["IsSelected"].ToString()); } if (dRow["IsInvited"] != DBNull.Value) { bid.IsInvited = Convert.ToBoolean(dRow["IsInvited"].ToString()); } if (dRow["SubmittedDate"] != DBNull.Value) { bid.SubmittedDate = Convert.ToDateTime(dRow["SubmittedDate"].ToString()); } if (dRow["IsRated"] != DBNull.Value) { bid.IsRated = Convert.ToBoolean(dRow["IsRated"].ToString()); } if (dRow["UserRating"] != DBNull.Value) { bid.UserRating = Convert.ToDecimal(dRow["UserRating"].ToString()); } lstproblembid.Add(bid); count++; } problemdetailobject.problembid = lstproblembid; } if (!ispaging) { if (dsProblemDetail.Tables.Count > 5) { DataTable tResolutionMedia = dsProblemDetail.Tables[5]; List<ResolutionMedia> lstresolutionmedia = new List<ResolutionMedia>(); foreach (DataRow dRow in tResolutionMedia.Rows) { ResolutionMedia resmedia = new ResolutionMedia(); if (dRow["BidID"] != DBNull.Value) { resmedia.BidID = Int32.Parse(dRow["BidID"].ToString()); } if (dRow["IsImage"] != DBNull.Value) { resmedia.IsImage = Convert.ToBoolean(dRow["IsImage"].ToString()); } if (dRow["ResolutionMediaPath"] != DBNull.Value) { resmedia.MediaPath = dRow["ResolutionMediaPath"].ToString(); } lstresolutionmedia.Add(resmedia); } problemdetailobject.resolutionmedia = lstresolutionmedia; } if (dsProblemDetail.Tables.Count > 6) { DataTable tResolutionProposedTime = dsProblemDetail.Tables[6]; List<ResolutionProposedTime> lstresproposedtime = new List<ResolutionProposedTime>(); foreach (DataRow dRow in tResolutionProposedTime.Rows) { ResolutionProposedTime proposedtime = new ResolutionProposedTime(); if (dRow["ID"] != DBNull.Value) { proposedtime.ID = Int32.Parse(dRow["ID"].ToString()); } if (dRow["BidID"] != DBNull.Value) { proposedtime.BidID = Int32.Parse(dRow["BidID"].ToString()); } if (dRow["IsSelected"] != DBNull.Value) { proposedtime.IsSelected = Convert.ToBoolean(dRow["IsSelected"].ToString()); } if (dRow["ResolutionProposedTime"] != DBNull.Value) { proposedtime.ProposedTime = Convert.ToDateTime(dRow["ResolutionProposedTime"].ToString()); } lstresproposedtime.Add(proposedtime); } problemdetailobject.proposedtime = lstresproposedtime; } if (!ispaging && dsProblemDetail.Tables.Count > 7 || ispaging && dsProblemDetail.Tables.Count > 0) { DataTable tProblemBids = dsProblemDetail.Tables[7]; List<ProblemBid> lstproblembid = new List<ProblemBid>(); foreach (DataRow dRow in tProblemBids.Rows) { ProblemBid bid = new ProblemBid(); if (dRow["BidId"] != DBNull.Value) { bid.BidID = Int32.Parse(dRow["BidId"].ToString()); } if (dRow["ProblemID"] != DBNull.Value) { bid.ProblemID = Int32.Parse(dRow["ProblemID"].ToString()); } if (dRow["UserID"] != DBNull.Value) { bid.UserID = Int32.Parse(dRow["UserID"].ToString()); } if (dRow["DisplayName"] != DBNull.Value) { bid.DisplayName = dRow["DisplayName"].ToString(); } if (dRow["ProfilePicPath"] != DBNull.Value) { bid.ProfileImagePath = dRow["ProfilePicPath"].ToString(); } if (dRow["BriefDescription"] != DBNull.Value) { bid.BriefDescription = dRow["BriefDescription"].ToString(); } if (dRow["QuickBloxUserName"] != DBNull.Value) { bid.QuickBloxUserID = dRow["QuickBloxUserName"].ToString(); } if (dRow["Longitude"] != DBNull.Value) { bid.Longitude = Convert.ToDecimal(dRow["Longitude"].ToString()); } if (dRow["Latitude"] != DBNull.Value) { bid.Latitude = Convert.ToDecimal(dRow["Latitude"].ToString()); } if (dRow["Distance"] != DBNull.Value) { bid.Distance = Convert.ToDecimal(dRow["Distance"].ToString()); } if (dRow["Description"] != DBNull.Value) { bid.ResolutionDescription = dRow["Description"].ToString(); } if (dRow["ResolutionMethodID"] != DBNull.Value) { bid.ResolutionMethodID = Int32.Parse(dRow["ResolutionMethodID"].ToString()); } if (dRow["ResolutionLink1"] != DBNull.Value) { bid.ResolutionLink1 = dRow["ResolutionLink1"].ToString(); } if (dRow["ResolutionLink2"] != DBNull.Value) { bid.ResolutionLink2 = dRow["ResolutionLink2"].ToString(); } if (dRow["CurrencyID"] != DBNull.Value) { bid.CurrencyID = Int32.Parse(dRow["CurrencyID"].ToString()); } if (dRow["CurrencyName"] != DBNull.Value) { bid.CurrencyName = dRow["CurrencyName"].ToString(); } if (dRow["CurrencyDisplayText"] != DBNull.Value) { bid.CurrencyDisplayText = dRow["CurrencyDisplayText"].ToString(); } if (dRow["Amount"] != DBNull.Value) { bid.Amount = Convert.ToDecimal(dRow["Amount"].ToString()); } if (dRow["CompanyID"] != DBNull.Value) { bid.CompanyID = Int32.Parse(dRow["CompanyID"].ToString()); } if (dRow["CompanyName"] != DBNull.Value) { bid.CompanyName = dRow["CompanyName"].ToString(); } if (dRow["IsSelected"] != DBNull.Value) { bid.IsSelected = Convert.ToBoolean(dRow["IsSelected"].ToString()); } if (dRow["IsInvited"] != DBNull.Value) { bid.IsInvited = Convert.ToBoolean(dRow["IsInvited"].ToString()); } if (dRow["SubmittedDate"] != DBNull.Value) { bid.SubmittedDate = Convert.ToDateTime(dRow["SubmittedDate"].ToString()); } if (dRow["IsRated"] != DBNull.Value) { bid.IsRated = Convert.ToBoolean(dRow["IsRated"].ToString()); } if (dRow["UserRating"] != DBNull.Value) { bid.UserRating = Convert.ToDecimal(dRow["UserRating"].ToString()); } lstproblembid.Add(bid); count++; } problemdetailobject.invitedproblembid = lstproblembid; } if (!ispaging && dsProblemDetail.Tables.Count > 8 || ispaging && dsProblemDetail.Tables.Count > 0) { DataTable tProblemBids = dsProblemDetail.Tables[8]; List<ProblemBid> lstproblembid = new List<ProblemBid>(); foreach (DataRow dRow in tProblemBids.Rows) { ProblemBid bid = new ProblemBid(); if (dRow["BidId"] != DBNull.Value) { bid.BidID = Int32.Parse(dRow["BidId"].ToString()); } if (dRow["ProblemID"] != DBNull.Value) { bid.ProblemID = Int32.Parse(dRow["ProblemID"].ToString()); } if (dRow["UserID"] != DBNull.Value) { bid.UserID = Int32.Parse(dRow["UserID"].ToString()); } if (dRow["DisplayName"] != DBNull.Value) { bid.DisplayName = dRow["DisplayName"].ToString(); } if (dRow["ProfilePicPath"] != DBNull.Value) { bid.ProfileImagePath = dRow["ProfilePicPath"].ToString(); } if (dRow["BriefDescription"] != DBNull.Value) { bid.BriefDescription = dRow["BriefDescription"].ToString(); } if (dRow["QuickBloxUserName"] != DBNull.Value) { bid.QuickBloxUserID = dRow["QuickBloxUserName"].ToString(); } if (dRow["Longitude"] != DBNull.Value) { bid.Longitude = Convert.ToDecimal(dRow["Longitude"].ToString()); } if (dRow["Latitude"] != DBNull.Value) { bid.Latitude = Convert.ToDecimal(dRow["Latitude"].ToString()); } if (dRow["Distance"] != DBNull.Value) { bid.Distance = Convert.ToDecimal(dRow["Distance"].ToString()); } if (dRow["Description"] != DBNull.Value) { bid.ResolutionDescription = dRow["Description"].ToString(); } if (dRow["ResolutionMethodID"] != DBNull.Value) { bid.ResolutionMethodID = Int32.Parse(dRow["ResolutionMethodID"].ToString()); } if (dRow["ResolutionLink1"] != DBNull.Value) { bid.ResolutionLink1 = dRow["ResolutionLink1"].ToString(); } if (dRow["ResolutionLink2"] != DBNull.Value) { bid.ResolutionLink2 = dRow["ResolutionLink2"].ToString(); } if (dRow["CurrencyID"] != DBNull.Value) { bid.CurrencyID = Int32.Parse(dRow["CurrencyID"].ToString()); } if (dRow["CurrencyName"] != DBNull.Value) { bid.CurrencyName = dRow["CurrencyName"].ToString(); } if (dRow["CurrencyDisplayText"] != DBNull.Value) { bid.CurrencyDisplayText = dRow["CurrencyDisplayText"].ToString(); } if (dRow["Amount"] != DBNull.Value) { bid.Amount = Convert.ToDecimal(dRow["Amount"].ToString()); } if (dRow["CompanyID"] != DBNull.Value) { bid.CompanyID = Int32.Parse(dRow["CompanyID"].ToString()); } if (dRow["CompanyName"] != DBNull.Value) { bid.CompanyName = dRow["CompanyName"].ToString(); } if (dRow["UserID"] != DBNull.Value) { bid.UserID = Int32.Parse(dRow["UserID"].ToString()); } if (dRow["IsSelected"] != DBNull.Value) { bid.IsSelected = Convert.ToBoolean(dRow["IsSelected"].ToString()); } if (dRow["IsInvited"] != DBNull.Value) { bid.IsInvited = Convert.ToBoolean(dRow["IsInvited"].ToString()); } if (dRow["SubmittedDate"] != DBNull.Value) { bid.SubmittedDate = Convert.ToDateTime(dRow["SubmittedDate"].ToString()); } if (dRow["IsRated"] != DBNull.Value) { bid.IsRated = Convert.ToBoolean(dRow["IsRated"].ToString()); } if (dRow["UserRating"] != DBNull.Value) { bid.UserRating = Convert.ToDecimal(dRow["UserRating"].ToString()); } lstproblembid.Add(bid); count++; } problemdetailobject.selectedproblembid = lstproblembid; } } responseObject.ResultCode = "SUCCESS"; responseObject.ResultObjectRecordCount = count; responseObject.ResultObjectJSON = Serializer.ObjectToJSON(problemdetailobject); if (count <= 0) { responseObject.ResultMessage = "No bids currently available for this problem."; } } catch (Exception ex) { responseObject.ResultCode = "ERROR"; responseObject.ResultMessage = ex.Message; CustomException exc = new CustomException(ex.ToString(), this.ToString(), "GetProblemDetailById", System.DateTime.Now); ExceptionManager.PublishException(exc); } } return responseObject; }