/// <summary> /// This method is used to retrieve Problem media details from database. /// </summary> /// <param name="sessionKey">string</param> /// <param name="probImageId">string</param> /// <returns>string</returns> public ProblemMedia GetProblemMediaDetail(string sessionKey, Int32 probImageId) { ProblemMedia probMedia = new ProblemMedia(); try { Database db = DatabaseFactory.CreateDatabase(); DbCommand dbCommand = db.GetStoredProcCommand("usp_GetImageDetail"); db.AddInParameter(dbCommand, "@ProblemMediaId", DbType.Int32, probImageId); db.AddInParameter(dbCommand, "@SessionKey", DbType.String, sessionKey); using (IDataReader dr = db.ExecuteReader(dbCommand)) { while (dr.Read()) { if (dr["ProblemMediaID"] != DBNull.Value) { probMedia.ProblemMediaID = Int32.Parse(dr["ProblemMediaID"].ToString()); } if (dr["ProblemID"] != DBNull.Value) { probMedia.ProblemID = Int32.Parse(dr["ProblemID"].ToString()); } if (dr["MediaPath"] != DBNull.Value) { probMedia.MediaPath = dr["MediaPath"].ToString(); } if (dr["IsImage"] != DBNull.Value) { probMedia.IsImage = Convert.ToBoolean(dr["IsImage"].ToString()); } } } } catch (Exception ex) { CustomException exc = new CustomException(ex.ToString(), this.ToString(), "GetAssetImageDetail", System.DateTime.Now); ExceptionManager.PublishException(exc); } return probMedia; }
/// <summary> /// Get media content for specified problem /// </summary> /// <param name="sessionkey">string</param> /// <param name="problemid">string</param> /// <returns>string</returns> public ResponseObjectForAnything GetProblemMediaForProblemID(string sessionkey, string problemid) { ResponseObjectForAnything responseObject = new ResponseObjectForAnything(); List<ProblemMedia> lstproblemmedia = new List<ProblemMedia>(); 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_GetMediaByProblemID"); db.AddInParameter(dbCommand, "@ProblemID", DbType.Int32, Int32.Parse(problemid)); DataSet dsMedia = db.ExecuteDataSet(dbCommand); if (dsMedia.Tables.Count > 0) { DataTable tMedia = dsMedia.Tables[0]; foreach (DataRow dRow in tMedia.Rows) { ProblemMedia media = new ProblemMedia(); if (dRow["ProblemMediaID"] != DBNull.Value) { media.ProblemMediaID = Int32.Parse(dRow["ProblemMediaID"].ToString()); } if (dRow["ProblemID"] != DBNull.Value) { media.ProblemID = Int32.Parse(dRow["ProblemID"].ToString()); } if (dRow["IsImage"] != DBNull.Value) { media.IsImage = Convert.ToBoolean(dRow["IsImage"].ToString()); } if (dRow["MediaPath"] != DBNull.Value) { media.MediaPath = dRow["MediaPath"].ToString(); } lstproblemmedia.Add(media); count++; } } else { responseObject.ResultCode = "SUCCESS"; responseObject.ResultMessage = "No media details found for this problem."; } responseObject.ResultCode = "SUCCESS"; responseObject.ResultObjectRecordCount = count; responseObject.ResultObjectJSON = Serializer.ObjectToJSON(lstproblemmedia); if (responseObject.ResultObjectRecordCount <= 0) { responseObject.ResultMessage = "No media details found for this problem."; } } 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; }