Пример #1
0
        public void GetInitialDropDownComplexModel(MyProfileObject model)
        {
            ResponseObjectForAnything responseObject = new ResponseObjectForAnything();
            MasterlistEngine masterEngine = new MasterlistEngine();
            string response = masterEngine.GetCategoryListJSON();
            responseObject = (ResponseObjectForAnything)Serializer.JSONStringToObject<ResponseObjectForAnything>(response);
            List<Common.DTO.Category> categories = new List<Common.DTO.Category>();
            categories = (List<Common.DTO.Category>)Serializer.JSONStringToObject<List<Common.DTO.Category>>(responseObject.ResultObjectJSON);

            model.Categories = categories;
            ViewBag.CategoryId = new SelectList(categories, "ID", "Name"); ;
            response = string.Empty;
            response = masterEngine.GetCountryListJSON();
            responseObject = (ResponseObjectForAnything)Serializer.JSONStringToObject<ResponseObjectForAnything>(response);
            List<Common.DTO.Country> countries = new List<Common.DTO.Country>();
            countries = (List<Common.DTO.Country>)Serializer.JSONStringToObject<List<Common.DTO.Country>>(responseObject.ResultObjectJSON);

            model.Countries = countries;
        }
Пример #2
0
 /// <summary>
 /// Action for change the password of login user
 /// </summary>
 /// <param name="pCurrentPassword">current password of a login user</param>
 /// <param name="pNewPassword">new password that needs to be set for user</param>
 /// <returns></returns>
 public ActionResult ChangePassword(string pCurrentPassword, string pNewPassword)
 {
     MyProfileObject model = new MyProfileObject();
     AuthenticationEngine authEngine = new AuthenticationEngine();
     string response = authEngine.ChangePassword(Request.Cookies["sessionkey"].Value, pCurrentPassword, pNewPassword);
     ResponseObjectForAnything responseObject = new ResponseObjectForAnything();
     responseObject = (ResponseObjectForAnything)Serializer.JSONStringToObject<ResponseObjectForAnything>(response);
     if (responseObject.ResultCode == "SUCCESS")
     {
         ProbFox.Common.DTO.Alert alert = new Common.DTO.Alert();
         alert.AlertType = Common.DTO.Alert.ALERTTYPE.Success;
         alert.MessageType = Common.DTO.Alert.ALERTMESSAGETYPE.TextWithClose;
         alert.Message = response;
         ViewBag.Alert = alert;
     }
     return View();
 }
Пример #3
0
 /// <summary>
 /// Save contact detail
 /// </summary>
 /// <returns></returns>
 public ActionResult SaveContactDetail(FormCollection form)
 {
     MyProfileObject model = new MyProfileObject();
     UserEngine userEngine = new UserEngine();
     string response = userEngine.UpdateContactInfoByUserIdJSON(Request.Cookies["sessionkey"].Value, form["Address1"], form["Address2"], form["Address3"], form["City"], form["StateID"], form["CountryID"], form["PinCode"]);
     ResponseObjectForAnything responseObject = new ResponseObjectForAnything();
     responseObject = (ResponseObjectForAnything)Serializer.JSONStringToObject<ResponseObjectForAnything>(response);
     if (responseObject.ResultCode == "SUCCESS")
     {
         ProbFox.Common.DTO.Alert alert = new Common.DTO.Alert();
         alert.AlertType = Common.DTO.Alert.ALERTTYPE.Success;
         alert.MessageType = Common.DTO.Alert.ALERTMESSAGETYPE.TextWithClose;
         alert.Message = response;
         ViewBag.Alert = alert;                
     }
     return View();
 }
Пример #4
0
        public ActionResult MyProfile(FormCollection form)
        {
            MyProfileObject model = new MyProfileObject();
            if(form["IsUser"] == "Yes")
            {
                form["IsUser"] = "******";
                form["IsExpert"] = "false";
            }
            UserEngine userEngine = new UserEngine();
            string response = userEngine.UpdatePersonalInfoByUserIdJSON(Request.Cookies["sessionkey"].Value, form["FirstName"], form["LastName"], form["DisplayName"], form["IsUser"], form["isExpert"], form["hdfCategoryJSON"], form["BriefDescription"], form["PhoneNumber"]);
            ResponseObjectForAnything responseObject = new ResponseObjectForAnything();
            responseObject = (ResponseObjectForAnything)Serializer.JSONStringToObject<ResponseObjectForAnything>(response);
            if(responseObject.ResultCode == "SUCCESS")
            {
                ProbFox.Common.DTO.Alert alert = new Common.DTO.Alert();
                alert.AlertType = Common.DTO.Alert.ALERTTYPE.Success;
                alert.MessageType = Common.DTO.Alert.ALERTMESSAGETYPE.TextWithClose;
                alert.Message = response;
                ViewBag.Alert = alert;
                return View(model);
            }

            //List<UserCard_XREF> cardModelList = new List<UserCard_XREF>();

            //UserCard_XREF cardModel = new UserCard_XREF();
            //cardModel.ID = 1;
            //cardModel.UserID = UserSession.LoginUserID;
            //cardModel.CardNumber = "123455";
            //cardModel.CardType = "Visa";
            //cardModelList.Add(cardModel);

            //cardModel = new UserCard_XREF();
            //cardModel.ID = 2;
            //cardModel.UserID = UserSession.LoginUserID;
            //cardModel.CardNumber = "XXX458";
            //cardModel.CardType = "Credit";
            //cardModelList.Add(cardModel);

            //cardModel = new UserCard_XREF();
            //cardModel.ID = 3;
            //cardModel.UserID = UserSession.LoginUserID;
            //cardModel.CardNumber = "123";
            //cardModel.CardType = "Debit";
            //cardModelList.Add(cardModel);

            //model.UserCardModelList = cardModelList;

            //GetInitialDropDownComplexModel(model);

            //model.UserViewModel.FirstName = "John";
            //model.UserViewModel.LastName = "Smith";
            //model.UserViewModel.DisplayName = "John Smith";
            //model.UserViewModel.EmailID = "*****@*****.**";
            //model.UserViewModel.ProfilePicPath = ServerSettings.WebApplicationURL + "/upload/profilepic/profile.jpg";
            //model.UserViewModel.BriefDescription = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.";
            //model.UserViewModel.PhoneNumber = "1234567890";
            //model.UserViewModel.PinCode = "395009";
            //model.UserViewModel.Address1 = "b-123/tulsikunj soc";
            //model.UserViewModel.Address2 = "Bh. Viabhav Hall,Ghodasar";
            //model.UserViewModel.Address3 = "Maninagar";
            //model.UserViewModel.City = "Ahmedabad";

            //if (UserSession.LoginUserType == USERTYPE.Expert.ToString())
            //{
            //    SelectedCategoriesViewModel selectedCategoryModel = null;

            //    List<SubCategory> subcategoryList = new List<SubCategory>();
            //    subcategoryList.Add(new SubCategory { Name = "Tv", ID = 1 });
            //    subcategoryList.Add(new SubCategory { Name = "Freez", ID = 2 });
            //    subcategoryList.Add(new SubCategory { Name = "AC", ID = 3 });

            //    selectedCategoryModel = new SelectedCategoriesViewModel();
            //    selectedCategoryModel.CategoryID = 1;
            //    selectedCategoryModel.SubCategoryList = subcategoryList;
            //    selectedCategoryModel.SelectedSubCategories = "1,3";
            //    model.SelectedCategoriesViewModelList.Add(selectedCategoryModel);

            //    selectedCategoryModel = new SelectedCategoriesViewModel();
            //    selectedCategoryModel.CategoryID = 2;
            //    selectedCategoryModel.SubCategoryList = subcategoryList;
            //    selectedCategoryModel.SelectedSubCategories = "3";
            //    model.SelectedCategoriesViewModelList.Add(selectedCategoryModel);
            //}

            return View(model);
        }
Пример #5
0
 /// <summary>
 /// Action for display the profile page of a current login user
 /// </summary>
 /// <returns></returns>
 public ActionResult MyProfile()
 {
     MyProfileObject profileobj = new MyProfileObject();
     List<UserCard> usercards = new List<UserCard>();
     UserEngine userEngine = new UserEngine();
     AuthenticationEngine authEngine = new AuthenticationEngine();
     string response = authEngine.GetUserFromSessionJSON(Request.Cookies["sessionkey"].Value);
     ResponseObjectForAnything responseObject = new ResponseObjectForAnything();
     responseObject = (ResponseObjectForAnything)Serializer.JSONStringToObject<ResponseObjectForAnything>(response);
     profileobj = (MyProfileObject)Serializer.JSONStringToObject<MyProfileObject>(responseObject.ResultObjectJSON);
     GetInitialDropDownComplexModel(profileobj);            
     return View(profileobj);
 }
Пример #6
0
        /// <summary>
        /// This method creates/updates a problem into the system.
        /// </summary>
        /// <param name="sessionKey">string</param>
        /// <param name="problemId">string</param>
        /// <param name="companyRelated">string</param>
        /// <param name="companyId">string</param>
        /// <param name="problemHeading">string</param>
        /// <param name="hastags">string</param>
        /// <param name="categoryId">string</param>
        /// <param name="subcategoryId">string</param>
        /// <param name="productId">string</param>
        /// <param name="modelNo">string</param>
        /// <param name="description">string</param>
        /// <param name="purchaseMonth">string</param>
        /// <param name="purchaseYear">string</param>
        /// <param name="productStatus">string</param>
        /// <param name="resolutionneededby">string</param>
        /// <param name="thumbnailmedia">string</param>
        /// <param name="hashtags">string</param>
        /// <param name="imagesupload">string</param>
        /// <param name="videosupload">string</param>
        /// <param name="isVirtual">string</param>
        /// <param name="isRegisteredAddress">string</param>
        /// <param name="address1">string</param>
        /// <param name="address2">string</param>
        /// <param name="address3">string</param>
        /// <param name="city">string</param>
        /// <param name="stateId">string</param>
        /// <param name="countryId">string</param>
        /// <param name="pinCode">string</param>
        /// <param name="isEdit">string</param>
        /// <returns>string</returns>
        public string SaveProblem(string sessionKey, string problemId, string companyRelated, string companyId, string problemHeading, string categoryId, string subcategoryId, string productId, string modelNo,
                                  string description, string purchaseMonth, string purchaseYear, string productStatus, string resolutionneededby, string hashtags, string isVirtual,
                                  string isRegisteredAddress, string address1, string address2, string address3, string city, string stateId, string countryId, string pinCode)
        {
            string retVal = string.Empty;
            Int32 probId = -1;
            AuthenticationEngine authEngine = new AuthenticationEngine();
            MyProfileObject user = new MyProfileObject();
            bool isValid = authEngine.IsValidSession(sessionKey);

            ResponseObjectForAnything responseobject = new ResponseObjectForAnything();

            if(isValid)
            {
                responseobject = authEngine.GetUserFromSession(sessionKey);
                user = (MyProfileObject)Serializer.JSONStringToObject<MyProfileObject>(responseobject.ResultObjectJSON);

                if (user != null)
                {
                    try
                    {
                        if (!string.IsNullOrEmpty(problemId)) { probId = Int32.Parse(problemId); }

                        Database db = DatabaseFactory.CreateDatabase();
                        DbCommand dbCommand = db.GetStoredProcCommand("usp_UpsertProblem");
                        if (!string.IsNullOrEmpty(problemId)) { db.AddInParameter(dbCommand, "ProblemId", DbType.Int32, Int32.Parse(problemId)); }
                        else { db.AddInParameter(dbCommand, "ProblemId", DbType.Int32, null); }

                        db.AddInParameter(dbCommand, "UserId", DbType.Int32, user.UserObject.UserID);
                        db.AddInParameter(dbCommand, "CompanyRelated", DbType.Boolean, Convert.ToBoolean(companyRelated));
                        if (!string.IsNullOrEmpty(companyId)) { db.AddInParameter(dbCommand, "CompanyID", DbType.Int32, Int32.Parse(companyId)); }
                        db.AddInParameter(dbCommand, "ProblemHeading", DbType.String, problemHeading);
                        db.AddInParameter(dbCommand, "CategoryID", DbType.Int32, Int32.Parse(categoryId));
                        db.AddInParameter(dbCommand, "SubCategoryID", DbType.Int32, Int32.Parse(subcategoryId));
                        if (!string.IsNullOrEmpty(productId)) { db.AddInParameter(dbCommand, "ProductID", DbType.Int32, Int32.Parse(productId)); }
                        db.AddInParameter(dbCommand, "ModelNo", DbType.String, modelNo);
                        db.AddInParameter(dbCommand, "Description", DbType.String, description);
                        db.AddInParameter(dbCommand, "PurchaseMonth", DbType.String, purchaseMonth);
                        db.AddInParameter(dbCommand, "PurchaseYear", DbType.String, purchaseYear);
                        db.AddInParameter(dbCommand, "ProductStatusID", DbType.String, Int32.Parse(productStatus));
                        if (!string.IsNullOrEmpty(resolutionneededby)) { db.AddInParameter(dbCommand, "ResolutionNeededBy", DbType.DateTime, Convert.ToDateTime(resolutionneededby)); }
                        else { db.AddInParameter(dbCommand, "ResolutionNeededBy", DbType.DateTime, null); }
                        string[] problemhashtags = hashtags.Split(",".ToCharArray());
                        DataSet dsHashTags = ToDataSet(problemhashtags, "Name");
                        db.AddInParameter(dbCommand, "ProblemHashTags", DbType.Xml, dsHashTags.GetXml());

                        db.AddInParameter(dbCommand, "IsVirtual", DbType.Boolean, Convert.ToBoolean(isVirtual));
                        db.AddInParameter(dbCommand, "IsRegisteredAddress", DbType.Boolean, Convert.ToBoolean(isRegisteredAddress));
                        db.AddInParameter(dbCommand, "Address1", DbType.String, address1);
                        db.AddInParameter(dbCommand, "Address2", DbType.String, address2);
                        db.AddInParameter(dbCommand, "Address3", DbType.String, address3);
                        db.AddInParameter(dbCommand, "City", DbType.String, city);
                        if (!string.IsNullOrEmpty(stateId)) { db.AddInParameter(dbCommand, "StateID", DbType.Int32, Convert.ToInt32(stateId)); }
                        else { db.AddInParameter(dbCommand, "StateID", DbType.Int32, null); }
                        if (!string.IsNullOrEmpty(countryId)) { db.AddInParameter(dbCommand, "CountryID", DbType.Int32, countryId); }
                        { db.AddInParameter(dbCommand, "CountryID", DbType.Int32, null); }
                        db.AddInParameter(dbCommand, "PinCode", DbType.String, pinCode);
                        float latitude, longitude;
                        GeoHelper geoHelper = new GeoHelper();
                        geoHelper.GetGeoLocationByPinCode(pinCode, out latitude, out longitude);
                        db.AddInParameter(dbCommand, "Latitude", DbType.Decimal, latitude);
                        db.AddInParameter(dbCommand, "Longitude", DbType.Decimal, longitude);

                        if (string.IsNullOrEmpty(problemId))
                        {
                            probId = Int32.Parse(db.ExecuteScalar(dbCommand).ToString());
                            if(probId > 0)
                                responseobject.ResultCode = "SUCCESS";
                            else
                                responseobject.ResultCode = "ERROR";
                            responseobject.ResultMessage = "Problem created successfully.";
                            responseobject.ResultObjectID = probId;
                        }
                        else
                        {
                            db.ExecuteNonQuery(dbCommand);
                            responseobject.ResultCode = "SUCCESS";
                            responseobject.ResultMessage = "Problem saved successfully.";
                        }
                    }
                    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);
                    }
                }
            }
            retVal = Serializer.ObjectToJSON(responseobject);
            return retVal;
        }