public static void updateFamilyPage(BasicInfoBO objClass) { MongoCollection <BsonDocument> objDocCollection = db.GetCollection <BsonDocument>("c_BasicInfo"); var query = Query.EQ("UserId", ObjectId.Parse(objClass.UserId)); var result = objDocCollection.Find(query); if (result.Any()) { MongoCollection <BasicInfo> objCollection = db.GetCollection <BasicInfo>("c_BasicInfo"); var equery = Query.EQ("UserId", ObjectId.Parse(objClass.UserId)); var sortBy = SortBy.Descending("UserId"); var update = Update.Set("UserId", ObjectId.Parse(objClass.UserId)) .Set("RelationshipStatus", objClass.RelationshipStatus); var eresult = objCollection.FindAndModify(equery, sortBy, update, true); } else { BsonDocument doc = new BsonDocument { { "UserId", ObjectId.Parse(objClass.UserId) }, { "CurrentCity", "" }, { "HomeTown", "" }, { "Address", "" }, { "CityTown", "" }, { "ZipCode", "" }, { "Neighbourhood", "" }, { "RelationshipStatus", objClass.RelationshipStatus } }; var rt = objDocCollection.Insert(doc); } }
protected void LoadBasicInfo() { BasicInfoBO objBasicInfo = new BasicInfoBO(); objBasicInfo = BasicInfoBLL.getBasicInfoByUserId(Userid); BasicInfoBO objFriendBasicInfo = null; if (Session["FriendID"] != null) { if (Session["FriendID"].ToString() != "") { objFriendBasicInfo = new BasicInfoBO(); objBasicInfo = BasicInfoBLL.getBasicInfoByUserId(Session["FriendID"].ToString()); } } if (objFriendBasicInfo.HomeTown != null) { lblHomeTown.Text = objBasicInfo.HomeTown + " and " + objFriendBasicInfo.HomeTown; } else { lblHomeTown.Text = objBasicInfo.HomeTown; } if (objFriendBasicInfo.CurrentCity != null) { lblCurrentCity.Text = objBasicInfo.CurrentCity + " and " + objFriendBasicInfo.CurrentCity; } else { lblCurrentCity.Text = objBasicInfo.CurrentCity; } }
protected void LoadBasicInfo() { BasicInfoBO objBasicInfo = new BasicInfoBO(); objBasicInfo = BasicInfoBLL.getBasicInfoByUserId(Userid); lstRelationshipStatus.SelectedValue = objBasicInfo.RelationshipStatus; }
protected void btnSave_Click(object sender, EventArgs e) { BasicInfoBO objBasicInfo = new BasicInfoBO(); objBasicInfo.UserId = Userid; objBasicInfo.CityTown = txtTownCity.Text; objBasicInfo.Address = txtAddress.Text; objBasicInfo.ZipCode = txtZipCode.Text; objBasicInfo.Neighbourhood = txtNeighbourhood.Text; BasicInfoBLL.updateContactInfoPage(objBasicInfo); UpdateEmail(); LoadContactInfo(); PostProperties postProp = new PostProperties(); postProp.PostText = Global.POST_CHANGED_CONTACT_INFO; postProp.WallOwnerUserId = Userid; postProp.PostedByUserId = Userid; postProp.PostType = Global.PROFILE_CHANGE; postProp.EmbedPost = null; PostOnWall.post(postProp); imgSave.Visible = true; lblSave.Visible = true; }
public string GetDynamicContent(string contextKey) { MongoCollection <User> objCollection = BaseClass.db.GetCollection <User>("c_User"); UserBO objClass = new UserBO(); foreach (User item in objCollection.Find(Query.EQ("_id", ObjectId.Parse(contextKey)))) { objClass.Id = item._id.ToString(); objClass.Email = item.Email.ToString(); objClass.UserName = item.UserName; objClass.Password = item.Password; objClass.FirstName = item.FirstName; objClass.DateOfBirth = item.DateOfBirth; objClass.LastName = item.LastName; objClass.PhoneNumber = item.PhoneNumber; objClass.PasswordResetCode = item.PasswordResetCode; objClass.IsMobileAlert = item.IsMobileAlert; objClass.PhoneNumber = item.PhoneNumber; objClass.Gender = item.Gender; objClass.UserStatus = item.UserStatus; break; } MongoCollection <BasicInfo> objCollection2 = BaseClass.db.GetCollection <BasicInfo>("c_BasicInfo"); BasicInfoBO objClassBasicInfo = new BasicInfoBO(); foreach (BasicInfo item in objCollection2.Find(Query.EQ("UserId", ObjectId.Parse(contextKey))).SetLimit(1)) { objClassBasicInfo.Id = item._id.ToString(); objClassBasicInfo.UserId = item.UserId.ToString(); objClassBasicInfo.CurrentCity = item.CurrentCity; objClassBasicInfo.HomeTown = item.HomeTown; objClassBasicInfo.Address = item.Address; objClassBasicInfo.CityTown = item.CityTown; objClassBasicInfo.ZipCode = item.ZipCode; objClassBasicInfo.Neighbourhood = item.Neighbourhood; objClassBasicInfo.RelationshipStatus = item.RelationshipStatus; break; } StringBuilder b = new StringBuilder(); b.Append("<table "); b.Append("width:200px; font-size:10pt; font-family:Verdana;' cellspacing='0' cellpadding='3'>"); // b.Append("<tr><td colspan='3' style='background-color:#336699; color:white;'></td>View Post</tr>"); b.Append("<tr><td><img src='../../Resources/ProfilePictures/" + contextKey + ".jpg' width='50px'/> </td></tr>"); b.Append("<tr><td><b>" + objClass.FirstName + " " + objClass.LastName + "</b> </td></tr>"); b.Append("<tr><td>" + objClass.DateOfBirth.ToLongDateString() + " </td></tr>"); b.Append("<tr><td>" + objClass.Gender + " </td></tr>"); b.Append("<tr><td>" + objClassBasicInfo.CurrentCity + " </td></tr>"); // b.Append("<asp:ImageButton ID="ImageButton1" runat="server" ImageUrl='../../Resources/CompressedVideo/play.png' Visible='<%# (((int)Eval("Type")) == Global.VIDEO)||(((int)Eval("Type")) == Global.TAG_VIDEOLINK)||(((int)Eval("Type")) == Global.TAG_VIDEO)||(((int)Eval("Type")) == Global.POST_VIDEOLINK)?true:false %>' CommandName="show" style='<%# "background:url(" +Eval("EmbedPost") + ")" %>' /> b.Append("</table>"); return(b.ToString()); }
protected void LoadUser() { BasicInfoBO objBasicInfo = new BasicInfoBO(); objBasicInfo = BasicInfoBLL.getBasicInfoByUserId(Userid); lblHomeTown.Text = objBasicInfo.HomeTown; lblCurrentCity.Text = objBasicInfo.CurrentCity; }
protected void saveRelationshipStatus() { BasicInfoBO objBasicInfo = new BasicInfoBO(); objBasicInfo.UserId = Userid; objBasicInfo.RelationshipStatus = lstRelationshipStatus.SelectedValue; BasicInfoBLL.updateFamilyPage(objBasicInfo); LoadBasicInfo(); }
protected void LoadBasicInfo() { BasicInfoBO objBasicInfo = new BasicInfoBO(); objBasicInfo = BasicInfoBLL.getBasicInfoByUserId(Userid); txtHometown.Text = objBasicInfo.HomeTown; txtCurrentCity.Text = objBasicInfo.CurrentCity; }
public static int calculateHomeTownRecomendationScore(string userId, string friendsId) { BasicInfoBO userInfo = BasicInfoDAL.getBasicInfoByUserId(userId); BasicInfoBO friendsInfo = BasicInfoDAL.getBasicInfoByUserId(friendsId); if (userInfo.HomeTown.Equals(friendsInfo.HomeTown)) { return(1 * Global.WEIGHT_HOMETOWN); } return(0); }
public static BasicInfoBO getBasicInfoByUserId(string UserId) { BasicInfoBO obj = new BasicInfoBO(); ArrayList lst = database.getByParam("UserId", UserId, "c_BasicInfo"); foreach (Object _o in lst) { obj = BasicInfoBLL.getConvertedObject(_o); break; } return(obj); }
public static void updateBasicInfoPage(BasicInfoBO objBasicInfo) { ArrayList lst = database.getByParam("UserId", objBasicInfo.UserId, "c_BasicInfo"); if (lst.Count > 0) { database.update(objBasicInfo, "UserId", objBasicInfo.UserId, "c_BasicInfo"); } else { database.insert(objBasicInfo, "c_BasicInfo"); } }
protected void LoadContactInfo() { BasicInfoBO objBasicInfo = new BasicInfoBO(); objBasicInfo = BasicInfoBLL.getBasicInfoByUserId(Userid); lblTownCity.Text = objBasicInfo.CityTown; lblAddress.Text = objBasicInfo.Address; lblZipCode.Text = objBasicInfo.ZipCode; lblNeighbourhood.Text = objBasicInfo.Neighbourhood; //UserBO userObj= new UserBO(); // userObj = UserBLL.getUserByUserId(userid); // txtPrimaryEmail.Text = userObj.Email; }
public static void insertBasicInfo(BasicInfoBO objClass) { MongoCollection <BsonDocument> objCollection = db.GetCollection <BsonDocument>("c_BasicInfo"); BsonDocument doc = new BsonDocument { { "UserId", ObjectId.Parse(objClass.UserId) }, { "CurrentCity", objClass.CurrentCity }, { "HomeTown", objClass.HomeTown }, { "Address", objClass.Address }, { "CityTown", objClass.CityTown }, { "ZipCode", objClass.ZipCode }, { "Neighbourhood", objClass.Neighbourhood }, { "RelationshipStatus", objClass.RelationshipStatus } }; var rt = objCollection.Insert(doc); }
public static void updateBasicInfo(BasicInfoBO objClass) { MongoCollection <BasicInfo> objCollection = db.GetCollection <BasicInfo>("c_BasicInfo"); var query = Query.EQ("_id", ObjectId.Parse(objClass.Id)); var sortBy = SortBy.Descending("_id"); var update = Update.Set("UserId", ObjectId.Parse(objClass.UserId)) .Set("CurrentCity", objClass.CurrentCity) .Set("HomeTown", objClass.HomeTown) .Set("Address", objClass.Address) .Set("CityTown", objClass.CityTown) .Set("ZipCode", objClass.ZipCode) .Set("RelationshipStatus", objClass.RelationshipStatus) .Set("Neighbourhood", objClass.Neighbourhood) ; var result = objCollection.FindAndModify(query, sortBy, update, true); }
public static List <UserFriendsBO> getAllSuggestions(string UserId) { List <UserFriendsBO> list = FriendsDAL.getAllSuggestions(UserId); foreach (UserFriendsBO Useritem in list) { BasicInfoBO info = BasicInfoDAL.getBasicInfoByUserId(Useritem.FriendUserId); Useritem.Hometown = info.HomeTown; Useritem.Location = info.CurrentCity; EmployerBO emp = EmployerDAL.getEmployerByUserId(Useritem.FriendUserId); Useritem.Employer = emp.Organization; UniversityBO uni = UniversityDAL.getUniversityByUniversityId(Useritem.FriendUserId); Useritem.Education = uni.UniversityName; } return(list); }
protected void btnSave_Click(object sender, EventArgs e) { int year = Convert.ToInt32(lstYear.SelectedValue); int month = Convert.ToInt32(lstMonth.SelectedValue); int day = Convert.ToInt32(lstDay.SelectedValue); DateTime birthDate = new DateTime(year, month, day); DateTime now = DateTime.Today; int age = now.Year - Convert.ToInt32(lstYear.SelectedValue); if (now < birthDate.AddYears(age)) { age--; } if (age < 13) { CustomValidator1.IsValid = false; } if (Page.IsValid) { BasicInfoBO objBasicInfo = new BasicInfoBO(); objBasicInfo.UserId = Userid; objBasicInfo.CurrentCity = txtCurrentCity.Text; objBasicInfo.HomeTown = txtHometown.Text; BasicInfoBLL.updateBasicInfoPage(objBasicInfo); // BasicInfoBLL.updateTownCity(txtCurrentCity.Text, txtHometown.Text, 1); UpdateUserInfo(); LoadUserInfo(); LoadBasicInfo(); imgSave.Visible = true; lblSave.Visible = true; PostProperties postProp = new PostProperties(); postProp.PostText = Global.POST_CHANGED_BASIC_INFO; postProp.WallOwnerUserId = Userid; postProp.PostedByUserId = Userid; postProp.PostType = Global.PROFILE_CHANGE; postProp.EmbedPost = null; PostOnWall.post(postProp); } }
private static BasicInfoBO getConvertedObject(Object _o) { BasicInfoBO obj = new BasicInfoBO(); if (_o.GetType().Name == "BsonDocument") { BsonDocument bson = (BsonDocument)_o; obj.Address = Convert.ToString(bson.GetElement("Address").Value); obj.CurrentCity = Convert.ToString(bson.GetElement("CurrentCity").Value); obj.HomeTown = Convert.ToString(bson.GetElement("HomeTown").Value); obj.CityTown = Convert.ToString(bson.GetElement("CityTown").Value); obj.ZipCode = Convert.ToString(bson.GetElement("ZipCode").Value); obj.Neighbourhood = Convert.ToString(bson.GetElement("Neighbourhood").Value); obj.RelationshipStatus = Convert.ToString(bson.GetElement("RelationshipStatus").Value); obj.Id = bson.GetElement("_id").Value.ToString(); obj.UserId = bson.GetElement("UserId").ToString(); } return(obj); }
public static BasicInfoBO getBasicInfoByUserId(string UserId) { MongoCollection <BasicInfo> objCollection = db.GetCollection <BasicInfo>("c_BasicInfo"); BasicInfoBO objClass = new BasicInfoBO(); foreach (BasicInfo item in objCollection.Find(Query.EQ("UserId", ObjectId.Parse(UserId))).SetLimit(1)) { objClass.Id = item._id.ToString(); objClass.UserId = item.UserId.ToString(); objClass.CurrentCity = item.CurrentCity; objClass.HomeTown = item.HomeTown; objClass.Address = item.Address; objClass.CityTown = item.CityTown; objClass.ZipCode = item.ZipCode; objClass.Neighbourhood = item.Neighbourhood; objClass.RelationshipStatus = item.RelationshipStatus; break; } return(objClass); }
protected void LoadContactInfo() { BasicInfoBO objBasicInfo = new BasicInfoBO(); objBasicInfo = BasicInfoBLL.getBasicInfoByUserId(Userid); lblTownCity.Text = objBasicInfo.CityTown; if (lblTownCity.Text == "") { lblTownCity.Visible = false; lblTownCiylabel.Visible = false; } lblAddress.Text = objBasicInfo.Address; if (lblAddress.Text == "") { lblAddress.Visible = false; lblAddressLabel.Visible = false; } lblZipCode.Text = objBasicInfo.ZipCode; if (lblZipCode.Text == "") { lblZipCode.Visible = false; lblZipCodeLabel.Visible = false; } lblNeighbourhood.Text = objBasicInfo.Neighbourhood; if (lblNeighbourhood.Text == "") { lblNeighbourhood.Visible = false; lblNeighbourhoodLabel.Visible = false; } lblRelationshipStatus.Text = objBasicInfo.RelationshipStatus; //UserBO userObj= new UserBO(); // userObj = UserBLL.getUserByUserId(userid); // txtPrimaryEmail.Text = userObj.Email; }
public static void insertBasicInfo(BasicInfoBO objBasicInfo) { database.insert(objBasicInfo, "c_BasicInfo"); }
public static void updateBasicInfo(BasicInfoBO objBasicInfo) { database.update(objBasicInfo, "_Id", objBasicInfo.Id, "c_BasicInfo"); }
public static void updateContactInfoPage(BasicInfoBO objBasicInfo) { BasicInfoBLL.updateBasicInfoPage(objBasicInfo); }
public static void updateFamilyPage(BasicInfoBO objBasicInfo) { BasicInfoBLL.updateFamilyPage(objBasicInfo); }