Пример #1
0
 public MyProfileObject()
 {
     UserObject = new User();
     UserCards = new List<UserCard>();
     Categories = new List<Category>();
     Countries = new List<Country>();
 }
Пример #2
0
        /// <summary>
        /// Update personal profile from app screens.
        /// </summary>
        /// <param name="sessionKey">string</param>
        /// <param name="firstName">string</param>
        /// <param name="lastName">string</param>
        /// <param name="displayName">string</param>
        /// <param name="isUser">string</param>
        /// <param name="isExpert">string</param>
        /// <param name="catsubcat">string</param>
        /// <param name="description">string</param>
        /// <param name="countrycode">string</param>
        /// <param name="mobileNumber">string</param>
        /// <returns>SessionResponseObject</returns>
        public SessionResponseObject UpdatePersonalInfoByUserId(string sessionKey, string firstName, string lastName, string displayName, string isUser, string isExpert, string catsubcat,
                                                string description, string mobileNumber)
        {
            AuthenticationEngine authEngine = new AuthenticationEngine();
            User user = new User();
            bool isValid = authEngine.IsValidSession(sessionKey);
            SessionResponseObject responseObject = new SessionResponseObject();
            ResponseObjectForAnything obj = new ResponseObjectForAnything();
            if (isValid)
            {
                if (!string.IsNullOrEmpty(sessionKey))
                {
                    obj = authEngine.GetUserFromSession(sessionKey);
                    user = (User)Serializer.JSONStringToObject<User>(obj.ResultObjectJSON);
                }

                if(user != null)
                {
                    try
                    {
                        Database db = DatabaseFactory.CreateDatabase();
                        DbCommand dbCommand = db.GetStoredProcCommand("usp_UpdateProfileByUserID");

                        db.AddInParameter(dbCommand, "UserID", DbType.Int32, user.UserID);
                        db.AddInParameter(dbCommand, "FirstName", DbType.String, firstName);
                        db.AddInParameter(dbCommand, "LastName", DbType.String, lastName);
                        db.AddInParameter(dbCommand, "DisplayName", DbType.String, displayName);
                        db.AddInParameter(dbCommand, "IsUser", DbType.Boolean, Convert.ToBoolean(isUser));
                        db.AddInParameter(dbCommand, "IsExpert", DbType.Boolean, Convert.ToBoolean(isExpert));

                        string[] lstcatsubcat = catsubcat.Split(";".ToCharArray());
                        DataSet dataSet = new DataSet();
                        DataTable dataTable = dataSet.Tables.Add();
                        dataTable.Columns.Add("CategoryID");
                        dataTable.Columns.Add("SubCategoryID");
                        for (int count = 0; count < lstcatsubcat.Length - 1; count++)
                        {
                            string category = lstcatsubcat[count].Split(",".ToCharArray())[0];
                            string subcategory = lstcatsubcat[count].Split(",".ToCharArray())[1];
                            dataTable.Rows.Add(new object[] { category, subcategory });
                        }
                        db.AddInParameter(dbCommand, "CatSubCat", DbType.String, dataSet.GetXml());
                        db.AddInParameter(dbCommand, "BriefDescription", DbType.String, description);
                        db.AddInParameter(dbCommand, "MobileNumber", DbType.String, mobileNumber);

                        dbCommand.ExecuteNonQuery();

                        responseObject.ResultCode = "SUCCESS";
                        responseObject.ResultMessage = "Profile information updated successfully.";
                    }
                    catch(Exception ex)
                    {
                        responseObject.ResultCode = "ERROR";
                        responseObject.ResultMessage = ex.Message;
                        CustomException exc = new CustomException(ex.ToString(), this.ToString(), "UpdatePersonalInfoByUserId", System.DateTime.Now);
                        ExceptionManager.PublishException(exc);
                    }
                }
            }
            return (responseObject);
        }
Пример #3
0
        /// <summary>
        /// Update contact info for a user ID.
        /// </summary>
        /// <param name="sessionKey">string</param>
        /// <param name="address1">string</param>
        /// <param name="address2">string</param>
        /// <param name="address3">string</param>
        /// <param name="state">string</param>
        /// <param name="city">string</param>
        /// <param name="pincode">string</param>
        /// <returns>SessionResponseObject</returns>
        public ResponseObjectForAnything UpdateContactInfoByUserId(string sessionKey, string address1, string address2, string address3, string stateID, string countryID, string city, string pincode)
        {
            AuthenticationEngine authEngine = new AuthenticationEngine();
            ResponseObjectForAnything responseObject = new ResponseObjectForAnything();
            User user = new User();
            bool isValid = authEngine.IsValidSession(sessionKey);
            if (isValid)
            {
                if (!string.IsNullOrEmpty(sessionKey))
                {
                    responseObject = authEngine.GetUserFromSession(sessionKey);
                    user = (User)Serializer.JSONStringToObject<User>(responseObject.ResultObjectJSON);
                }

                if (user != null)
                {
                    try
                    {
                        Database db = DatabaseFactory.CreateDatabase();
                        DbCommand dbCommand = db.GetStoredProcCommand("usp_UpdateContactByUserID");

                        db.AddInParameter(dbCommand, "UserID", DbType.Int32, user.UserID);
                        db.AddInParameter(dbCommand, "Address1", DbType.String, address1);
                        db.AddInParameter(dbCommand, "Address2", DbType.String, address2);
                        db.AddInParameter(dbCommand, "Address3", DbType.String, address3);
                        db.AddInParameter(dbCommand, "State", DbType.String, stateID);
                        db.AddInParameter(dbCommand, "City", DbType.String, city);
                        db.AddInParameter(dbCommand, "PinCode", DbType.String, pincode);

                        dbCommand.ExecuteNonQuery();

                        responseObject.ResultCode = "SUCCESS";
                        responseObject.ResultMessage = "Contact information updated successfully.";
                    }
                    catch (Exception ex)
                    {
                        responseObject.ResultCode = "ERROR";
                        responseObject.ResultMessage = ex.Message;
                        CustomException exc = new CustomException(ex.ToString(), this.ToString(), "UpdateContactInfoByUserId", System.DateTime.Now);
                        ExceptionManager.PublishException(exc);
                    }
                }
            }
            return (responseObject);
        }
Пример #4
0
        /// <summary>
        /// Update contact info for a user ID.
        /// </summary>
        /// <param name="sessionKey">string</param>
        /// <param name="address1">string</param>
        /// <param name="address2">string</param>
        /// <param name="address3">string</param>
        /// <param name="state">string</param>
        /// <param name="city">string</param>
        /// <param name="pincode">string</param>
        /// <returns>SessionResponseObject</returns>
        public ResponseObjectForAnything UpdateCardDetailsByUserId(string sessionKey, string cardtype, string cardnumber)
        {
            AuthenticationEngine authEngine = new AuthenticationEngine();
            User user = new User();
            bool isValid = authEngine.IsValidSession(sessionKey);
            ResponseObjectForAnything obj = new ResponseObjectForAnything();
            if (isValid)
            {
                if (!string.IsNullOrEmpty(sessionKey))
                {
                    obj = authEngine.GetUserFromSession(sessionKey);
                    user = (User)Serializer.JSONStringToObject<User>(obj.ResultObjectJSON);
                }

                if (user != null)
                {
                    try
                    {
                        Database db = DatabaseFactory.CreateDatabase();
                        DbCommand dbCommand = db.GetStoredProcCommand("usp_UpdateCardsByUserID");

                        db.AddInParameter(dbCommand, "UserID", DbType.Int32, user.UserID);
                        db.AddInParameter(dbCommand, "CardType", DbType.Xml, cardtype);
                        db.AddInParameter(dbCommand, "CardNumber", DbType.Xml, cardnumber);

                        dbCommand.ExecuteNonQuery();

                        obj.ResultCode = "SUCCESS";
                        obj.ResultMessage = "Card details information updated successfully.";
                    }
                    catch (Exception ex)
                    {
                        obj.ResultCode = "ERROR";
                        obj.ResultMessage = ex.Message;
                        CustomException exc = new CustomException(ex.ToString(), this.ToString(), "UpdateContactInfoByUserId", System.DateTime.Now);
                        ExceptionManager.PublishException(exc);
                    }
                }
            }
            return (obj);
        }
Пример #5
0
        /// <summary>
        /// This method gets all user details by QB ID.
        /// </summary>
        /// <param name="sessionKey">string</param>
        /// <param name="qbUserName">string</param>
        /// <returns>SessionResponseObject</returns>
        public SessionResponseObject GetUserDetailsByQBID(string sessionKey, string qbUserName)
        {
            SessionResponseObject responseObject = new SessionResponseObject();
            AuthenticationEngine authEngine = new AuthenticationEngine();
            User user = new User();

            DataSet dsProfile = new DataSet();

            bool isValid = authEngine.IsValidSession(sessionKey);

            if(isValid)
            {
                try
                {
                    Database db = DatabaseFactory.CreateDatabase();
                    DbCommand dbCommand = db.GetStoredProcCommand("usp_GetProfilebyQBID");
                    db.AddInParameter(dbCommand, "QBUserName", DbType.String, qbUserName);
                    dsProfile = db.ExecuteDataSet(dbCommand);

                    if(dsProfile.Tables.Count > 0)
                    {
                        DataTable tUser = dsProfile.Tables[0];
                        foreach(DataRow tRow in tUser.Rows)
                        {
                            if (tRow["UserID"] != DBNull.Value) { user.UserID = Int32.Parse(tRow["UserID"].ToString()); }
                            if (tRow["FirstName"] != DBNull.Value) { user.FirstName = tRow["FirstName"].ToString(); }
                            if (tRow["LastName"] != DBNull.Value) { user.LastName = tRow["LastName"].ToString(); }
                            if (tRow["DisplayName"] != DBNull.Value) { user.DisplayName = tRow["DisplayName"].ToString(); }
                            if (tRow["EmailID"] != DBNull.Value) { user.EmailID = tRow["EmailID"].ToString(); }
                            if (tRow["PinCode"] != DBNull.Value) { user.EmailID = tRow["PinCode"].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["CountryCode"] != DBNull.Value) { user.CountryCode = tRow["CountryCode"].ToString(); }
                            if (tRow["PhoneNumber"] != DBNull.Value) { user.PhoneNumber = tRow["PhoneNumber"].ToString(); }
                            if (tRow["ProfilePicPath"] != DBNull.Value) { user.ProfilePicPath = tRow["ProfilePicPath"].ToString(); }
                        }
                        responseObject.ResultCode = "SUCCESS";
                        responseObject.ResultObjectRecordCount = tUser.Rows.Count;
                        if (responseObject.ResultObjectRecordCount == 0) { responseObject.ResultMessage = "No quickblox user information found for this user."; }
                    }
                }
                catch (Exception ex)
                {
                    responseObject.ResultCode = "ERROR";
                    responseObject.ResultMessage = ex.Message;
                    CustomException exc = new CustomException(ex.ToString(), this.ToString(), "CreateUser", System.DateTime.Now);
                    ExceptionManager.PublishException(exc);
                }
            }
            return (responseObject);
        }
Пример #6
0
        /// <summary>
        /// Get problem spefic experts who quoted or all
        /// experts for a category/sub category combination.
        /// </summary>
        /// <param name="sessionKey">string</param>
        /// <param name="problemid">string</param>
        /// <param name="categoryid">string</param>
        /// <param name="subcategoryid">string</param>
        /// <returns>SessionResponseObject</returns>
        public ResponseObjectForAnything GetExpertsByCatSubCat(string sessionKey, string pincode, string distance, string categoryid, string subcategoryid)
        {
            List<User> lstexperts = new List<User>();
            List<ProblemBid> lstProblemBids = new List<ProblemBid>();
            ResponseObjectForAnything responseObject = new ResponseObjectForAnything();
            SessionResponseObject session = new SessionResponseObject();
            AuthenticationEngine authEngine = new AuthenticationEngine();
            bool isValid = authEngine.IsValidSession(sessionKey);
            DataSet dsExperts = new DataSet();

            if(isValid)
            {
                try
                {
                    Database db = DatabaseFactory.CreateDatabase();
                    DbCommand dbCommand = db.GetStoredProcCommand("usp_GetExperts");
                    float latitude, longitude;
                    GeoHelper geoHelper = new GeoHelper();
                    geoHelper.GetGeoLocationByPinCode(pincode, out latitude, out longitude);
                    db.AddInParameter(dbCommand, "@Distance", DbType.Decimal, distance);
                    db.AddInParameter(dbCommand, "@Latitude", DbType.Decimal, latitude);
                    db.AddInParameter(dbCommand, "@Longitude", DbType.Decimal, longitude);
                    db.AddInParameter(dbCommand, "@CategoryID", DbType.Int32, Int32.Parse(categoryid));
                    db.AddInParameter(dbCommand, "@SubCategoryID", DbType.Int32, Int32.Parse(subcategoryid));
                    dsExperts = db.ExecuteDataSet(dbCommand);

                    if(dsExperts.Tables.Count > 0)
                    {
                        DataTable tUser = dsExperts.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["UserRoleID"] != DBNull.Value) { user.UserID = Int32.Parse(tRow["UserRoleID"].ToString()); }
                            if (tRow["FirstName"] != DBNull.Value) { user.FirstName = tRow["FirstName"].ToString(); }
                            if (tRow["LastName"] != DBNull.Value) { user.LastName = tRow["LastName"].ToString(); }
                            if (tRow["DisplayName"] != DBNull.Value) { user.DisplayName = tRow["DisplayName"].ToString(); }
                            if (tRow["EmailID"] != DBNull.Value) { user.EmailID = tRow["EmailID"].ToString(); }
                            if (tRow["PinCode"] != DBNull.Value) { user.PinCode = tRow["PinCode"].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["Distance"] != DBNull.Value) { user.Distance = Convert.ToDecimal(tRow["Distance"].ToString()); }
                            if (tRow["PhoneNumber"] != DBNull.Value) { user.PhoneNumber = tRow["PhoneNumber"].ToString(); }
                            if (tRow["ProfilePicPath"] != DBNull.Value) { user.ProfilePicPath = tRow["ProfilePicPath"].ToString(); }
                            if (tRow["AvgRating"] != DBNull.Value) { user.AvgRating = Convert.ToDecimal(tRow["AvgRating"].ToString()); }
                            lstexperts.Add(user);
                        }
                        responseObject.ResultCode = "SUCCESS";
                        responseObject.ResultObjectRecordCount = tUser.Rows.Count;
                        responseObject.ResultObjectJSON = Serializer.ObjectToJSON(lstexperts);
                        if (tUser.Rows.Count == 0) { responseObject.ResultMessage = "No Experts found for this combination of category and subcategory."; }
                    }
                }
                catch (Exception ex)
                {
                    responseObject.ResultCode = "ERROR";
                    responseObject.ResultMessage = ex.Message;
                    CustomException exc = new CustomException(ex.ToString(), this.ToString(), "GetExpertsByCatSubCat", System.DateTime.Now);
                    ExceptionManager.PublishException(exc);
                }
            }
            return responseObject;
        }
Пример #7
0
        public ResponseObjectForAnything InviteExperts(string sessionkey, string problemid, string expertids)
        {
            ResponseObjectForAnything responseObject = new ResponseObjectForAnything();
            AuthenticationEngine authEngine = new AuthenticationEngine();
            User user = new User();
            int expertid = 0;
            bool isValid = authEngine.IsValidSession(sessionkey);
            if(isValid)
            {
                try
                {
                    Database db = DatabaseFactory.CreateDatabase();
                    DbCommand dbCommand = db.GetStoredProcCommand("usp_InviteExperts");
                    db.AddInParameter(dbCommand, "@SessionKey", DbType.String, sessionkey);
                    db.AddInParameter(dbCommand, "@ProblemID", DbType.Int32, Int32.Parse(problemid));
                    string[] invitedexperts = expertids.Split(",".ToCharArray());
                    DataSet dsExperts = ToDataSet(invitedexperts, "Name");
                    db.AddInParameter(dbCommand, "@UserIDs", DbType.String, dsExperts.GetXml());

                    expertid = Int32.Parse(db.ExecuteScalar(dbCommand).ToString());
                    if (expertid > 0)
                    {
                        responseObject.ResultCode = "SUCCESS";
                        responseObject.ResultMessage = "Problem created successfully.";
                        responseObject.ResultObjectID = expertid;
                    }
                    else
                    {
                        responseObject.ResultCode = "ERROR";
                        responseObject.ResultMessage = "Unknown error occured, please try again later.";
                    }

                }
                catch(Exception ex)
                {
                    responseObject.ResultCode = "ERROR";
                    responseObject.ResultMessage = ex.Message;
                    CustomException exc = new CustomException(ex.ToString(), this.ToString(), "SaveProblem", System.DateTime.Now);
                    ExceptionManager.PublishException(exc);
                }
            }
            return (responseObject);
        }
Пример #8
0
        /// <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;
        }
Пример #9
0
        /// <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;
        }