protected void btnLogin_Click(object sender, EventArgs e) { string userName = TxtUserName.Text.ToString(); string password = TxtPassword.Text.ToString(); DataTable objDataTable = ValidateUser(userName, password); if (objDataTable.Rows.Count > 0) { if (!bool.Parse(objDataTable.Rows[0]["IsActive"].ToString())) { lblErrorMessage.Text = "Inactive user. Please contact your administrator for more details."; } else { ProfileCommon userProfile = Profile.GetProfile(userName); userProfile.UserId = Convert.ToInt64(objDataTable.Rows[0]["UserId"].ToString()); userProfile.UserName = objDataTable.Rows[0]["UserName"].ToString(); userProfile.FirstName = objDataTable.Rows[0]["FirstName"].ToString(); userProfile.LastName = objDataTable.Rows[0]["LastName"].ToString(); userProfile.UserRole = objDataTable.Rows[0]["role_name"].ToString(); userProfile.Save(); FormsAuthentication.RedirectFromLoginPage(userName, false); } } else { lblErrorMessage.Text = "Invalid username or password."; } }
public MembersDS GetMembers() { //Load a list of Member selections MembersDS ds = new MembersDS(); MembershipUserCollection members = Membership.GetAllUsers(); foreach (MembershipUser member in members) { MembersDS.MembershipTableRow row = ds.MembershipTable.NewMembershipTableRow(); row.Comment = member.Comment; row.CreateDate = member.CreationDate; row.Email = member.Email; row.IsApproved = member.IsApproved; row.IsLockedOut = member.IsLockedOut; row.IsOnline = member.IsOnline; row.LastActivityDate = member.LastActivityDate; row.LastLockoutDate = member.LastLockoutDate; row.LastLoginDate = member.LastLoginDate; row.LastPasswordChangedDate = member.LastPasswordChangedDate; row.PasswordQuestion = member.PasswordQuestion; row.UserName = member.UserName; ProfileCommon profile = new ProfileCommon().GetProfile(member.UserName); row.UserFullName = profile.UserFullName; row.Company = profile.Company; ds.MembershipTable.AddMembershipTableRow(row); } ds.AcceptChanges(); return(ds); }
protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e) { TextBox eMail = (TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("Email"); TextBox firstName = (TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("FirstName"); TextBox lastName = (TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("LastName"); TextBox userName = (TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("UserName"); TextBox userPw = (TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("Password"); //Log in user programatically. if (Membership.ValidateUser(userName.Text, userPw.Text)) { ProfileCommon pc = new ProfileCommon(); ProfileCommon userPro = pc.GetProfile(userName.Text); //First set profile properties. userPro.EMail = eMail.Text; userPro.FirstName = firstName.Text; userPro.LastName = lastName.Text; userPro.Save(); // Next add user to ProfileProperty table. UserClass uc = new UserClass(userPro.UserName); uc.SignUpUser(eMail.Text, firstName.Text, lastName.Text); } }
private static List <string> GetMenu(string userName) { var profile = ProfileCommon.GetProfile(userName); var roleMenuList = new RoleBFC().RetrieveDetails(profile.RoleID).Select(p => p.ModuleID).Distinct(); return(roleMenuList.ToList()); }
public void SaveProfile() { // if the UserName property contains an emtpy string, save the current user's profile, // othwerwise save the profile for the specified user ProfileCommon profile = this.Profile; if (this.UserName.Length > 0) { profile = this.Profile.GetProfile(this.UserName); } profile.Preferences.Newsletter = (SubscriptionType)Enum.Parse(typeof(SubscriptionType), ddlSubscriptions.SelectedValue); profile.Preferences.Culture = ddlLanguages.SelectedValue; profile.FirstName = txtFirstName.Text; profile.LastName = txtLastName.Text; profile.Gender = ddlGenders.SelectedValue; if (txtBirthDate.Text.Trim().Length > 0) { profile.BirthDate = DateTime.Parse(txtBirthDate.Text); } profile.Occupation = ddlOccupations.SelectedValue; profile.Website = txtWebsite.Text; profile.Address.Street = txtStreet.Text; profile.Address.City = txtCity.Text; profile.Address.PostalCode = txtPostalCode.Text; profile.Address.State = txtState.Text; profile.Address.Country = ddlCountries.SelectedValue; profile.Contacts.Phone = txtPhone.Text; profile.Contacts.Fax = txtFax.Text; profile.Forum.AvatarUrl = txtAvatarUrl.Text; profile.Forum.Signature = txtSignature.Text; profile.Save(); }
public ActionResult AddLogPage(AircraftLogModel viewModel, HttpPostedFileBase fileBase) { string relFolderUrl = Url.Content("~/Content/AircraftLogs/" + viewModel.RegistrationNumber); string absFolderUrl = Server.MapPath(relFolderUrl); string origFileUrl = Server.MapPath(Path.Combine(relFolderUrl, viewModel.EditPageNumber.ToString() + "orig.jpg")); string pageFileName = viewModel.EditPageNumber.ToString() + ".jpg"; string pageUrl = Server.MapPath(Path.Combine(relFolderUrl, pageFileName)); if (System.IO.File.Exists(pageUrl)) { ModelState.AddModelError(String.Empty, "The page number " + viewModel.EditPageNumber.ToString() + " already exists. Please delete it first or use different number."); return(ViewLog(viewModel.AircraftId, viewModel.RegistrationNumber)); } if (!System.IO.Directory.Exists(absFolderUrl)) { System.IO.Directory.CreateDirectory(absFolderUrl); } fileBase.SaveAs(origFileUrl); ImageHelper.ScaleToWidth(origFileUrl, pageUrl, 800); if (System.IO.File.Exists(pageUrl)) { Aircraft aircraft = _dataService.GetAircraftById(viewModel.AircraftId); aircraft.LogUpdloadedOn = DateTime.Now; aircraft.LogUploadedByMemberId = ProfileCommon.GetUserProfile().MemberId; _dataService.UpdateAircraft(aircraft); System.IO.File.Delete(origFileUrl); } ModelState.Clear(); return(ViewLog(viewModel.AircraftId, viewModel.RegistrationNumber)); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { string id = Request.QueryString["id"].ToString(); MembershipUser u = Membership.GetUser(id); Guid a = new Guid(u.ProviderUserKey.ToString()); Label1.Text = u.UserName.ToString(); DataSet ds = ad.getuserpassword(a); if (ds.Tables[0].Rows.Count == 0) { } else { Label2.Text = ds.Tables[0].Rows[0]["password"].ToString(); } Label5.Text = u.Email.ToString(); ProfileCommon comm = Profile.GetProfile(Label1.Text); Label3.Text = comm.FirstName; Label6.Text = comm.Mobile; Label7.Text = comm.Phone; Label8.Text = comm.Address; Label9.Text = comm.City; Label10.Text = comm.State; } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { // Create test user. if (Membership.GetUser("test") == null) { MembershipCreateStatus status; Membership.CreateUser("test", "test99!", "", "Why should you not panic?", "This is only a test.", true, out status); if (status != MembershipCreateStatus.Success) { lblInfo.InnerHtml = "Attempt to create user \"test\" failed with " + status.ToString(); return; } // Place test user in role. if (!Roles.RoleExists("Administrator")) { Roles.CreateRole("Administrator"); Roles.AddUserToRole("test", "Administrator"); } // Assign profile values. ProfileCommon profile = Profile.GetProfile("test"); profile.FirstName = "Tester"; profile.LastName = "Smith"; profile.CustomerCode = "540-SLJTE"; profile.Save(); } } }
public void fillgrid() { admin ad = new admin(); int totrec; ArrayList list = new ArrayList(Roles.GetUsersInRole("user")); //MembershipUserCollection coll = // Roles.GetUsersInRole(ddlrole.SelectedItem.Text); DataTable dtt = new DataTable(); dtt.Columns.Add("UserName"); dtt.Columns.Add("Name"); dtt.Columns.Add("Email"); dtt.Columns.Add("MobileNumber"); int j = 0; foreach (string strrr in list) { MembershipUserCollection coll = Membership.FindUsersByName(strrr); foreach (MembershipUser user1 in coll) { ProfileCommon com = Profile.GetProfile(user1.UserName); string a = user1.ProviderUserKey.ToString(); dtt.Rows.Add(user1.UserName, com.name, user1.Email, com.Mobile); ++j; } } totrec = j; GridView1.DataSource = dtt; GridView1.DataBind(); }
public ActionResult UpdateFlightReview(int pilotId) { FlightReviewViewModel viewModel = new FlightReviewViewModel(); viewModel.PilotId = pilotId; ProfileCommon profile = ProfileCommon.GetProfile(); Member member = _dataService.GetMemberWithPilotData(pilotId); viewModel.PilotId = pilotId; viewModel.PilotName = member.FullName; viewModel.InstructorId = profile.MemberId; viewModel.InstructorName = profile.FirstName + " " + profile.LastName; if (member.FlightReviews != null && member.FlightReviews.Count() > 0) { FlightReview lastReview = member.FlightReviews.OrderByDescending(r => r.Date).First(); viewModel.TotalTime = lastReview.TotalTime; viewModel.RetractTime = lastReview.RetractTime; } viewModel.ReviewDate = DateTime.Now; return(View(ViewNames.UpdateFlightReview, viewModel)); }
public ActionResult ResolveSquawk(ResolveSquawkViewModel viewModel) { ProfileCommon profile = (ProfileCommon)HttpContext.Profile; Squawk squawk = _dataService.GetSquawkById(viewModel.Id); squawk.ResolutionNotes = viewModel.ResolutionNotes; squawk.ResolvedById = profile.MemberId; squawk.ResolvedOn = DateTime.Now; squawk.Status = viewModel.Status; _dataService.UpdateSquawk(squawk); SquawkDetailViewModel sqVM = new SquawkDetailViewModel() { Id = squawk.Id, AircraftId = squawk.AircraftId, Description = squawk.Description, PostedById = squawk.PostedById, PostedOn = squawk.PostedOn, RegistrationNumber = squawk.Aircraft.RegistrationNumber, ResolutionNotes = squawk.ResolutionNotes, ResolvedOn = squawk.ResolvedOn, ResolvedBy = profile.FirstName + " " + profile.LastName, Status = squawk.Status, Subject = squawk.Subject }; return(View(ViewNames.SquawkDetails, sqVM)); }
public ActionResult AddStageCheck(int pilotId) { Member pilot = _dataService.GetMemberWithPilotData(pilotId); AddStageCheckViewModel viewModel = new AddStageCheckViewModel(); viewModel.CheckDate = DateTime.Now; viewModel.PilotId = pilotId; viewModel.PilotName = pilot.FullName; viewModel.AvailableStages = new Dictionary <string, string>(); string[] stagenames = Enum.GetNames(typeof(StageChecks)); foreach (var name in stagenames) { if (!pilot.StageChecks.Any(s => s.StageName == name)) { viewModel.AvailableStages.Add(name, name.ToFriendlyString()); } } int instructorId = ProfileCommon.GetProfile().MemberId; Member instructor = _dataService.GetMember(instructorId); viewModel.InstructorId = instructor.Id; viewModel.InstructorName = instructor.FullName; return(View(ViewNames.AddStageCheck, viewModel)); }
public MembershipDS GetTrackingUsers() { // ProfileCommon profileCommon = new ProfileCommon(); ProfileCommon profile = null; string email = ""; string[] users = Roles.GetUsersInRole(TRACKINGROLE); MembershipDS member = new MembershipDS(); //Append members for (int i = 0; i < users.Length; i++) { email = Membership.GetUser(users[i]).Email; profile = profileCommon.GetProfile(users[i]); if (profile.Type.Length == 0) { profile.Type = "client"; } if (profile.ClientVendorID.Length == 0) { profile.ClientVendorID = TrackingServices.ID_ARGIX; } member.MemberTable.AddMemberTableRow(profile.UserName, profile.UserFullName, email, profile.Company, profile.Type, profile.ClientVendorID, profile.WebServiceUser, profile.LastActivityDate, profile.LastUpdatedDate); } member.AcceptChanges(); return(member); }
protected void btnSaveButton_ServerClick(object sender, EventArgs e) { if (!HasPriv()) { return; } try { string tenantUserName = new Upn(CurrentTenant.Name, txtUserID.Text.Trim()).ToString(); MembershipUser user = Membership.GetUser(tenantUserName); if (user.Email != txtEmail.Text.Trim()) { user.Email = txtEmail.Text.Trim(); Membership.UpdateUser(user); } ProfileCommon commProfile = Profile.GetProfile(tenantUserName); commProfile.FullName = txtFullName.Text.Trim(); commProfile.Title = txtTitle.Text.Trim(); commProfile.Sex = dplSex.Text.Trim(); commProfile.Birthday = txtBirthday.Text.Trim(); commProfile.Telephone = txtTel.Text.Trim(); commProfile.Fax = txtFax.Text.Trim(); commProfile.MsnAccount = txtMsn.Text.Trim(); commProfile.Address = txtAddress.Text.Trim(); commProfile.ZipCode = txtZipCode.Text.Trim(); commProfile.Mobile = txtMobile.Text.Trim(); commProfile.Save(); lblErrMsg.Text = Resources.GlobalResources.SuccessSave; } catch (Exception) { lblErrMsg.Text = Resources.GlobalResources.FailSave; } }
protected void cuwCreateUser_CreatedUser(object sender, EventArgs e) { ProfileCommon userProfile = Profile.GetProfile(cuwCreateUser.UserName); string firstname = ((TextBox)CreateUserWizardStep1.ContentTemplateContainer.FindControl("txtFirstname")).Text; string lastname = ((TextBox)CreateUserWizardStep1.ContentTemplateContainer.FindControl("txtLastname")).Text; userProfile.Firstname = firstname; userProfile.Lastname = lastname; DataAccessLayer dal = new DataAccessLayer(); dal.AddParameter("@Username", cuwCreateUser.UserName.Trim(), System.Data.DbType.String); dal.AddParameter("@Firstname", firstname, System.Data.DbType.String); dal.AddParameter("@Lastname", lastname, System.Data.DbType.String); dal.AddParameter("@By", Membership.GetUser().UserName, System.Data.DbType.String); dal.ExecuteNonQuery("EXEC dbo.UserDetailsUpdate @Username, @Firstname, @Lastname, @By"); dal.ClearParameters(); userProfile.Save(); Logging.WriteLog(Logging.Action.Create, Logging.ObjectType.ADUCUser, cuwCreateUser.UserName); HttpContext.Current.Items["username"] = cuwCreateUser.UserName.Trim(); HttpContext.Current.Items["password"] = ((TextBox)CreateUserWizardStep1.ContentTemplateContainer.FindControl("Password")).Text; Server.Transfer("EditUsers.aspx"); }
public ActionResult Detail(string key) { var obj = new UserModel(); var membership = Membership.GetUser(key); var profile = ProfileCommon.GetProfile(key); obj.UserID = membership.UserName; if (profile != null) { obj.RoleID = profile.RoleID; obj.IsActive = profile.IsActive; } if (obj.RoleID != 0) { var role = new RoleBFC().RetrieveByID(obj.RoleID); obj.RoleName = role.Name; } ViewBag.Mode = UIMode.Detail; SetViewBagNotification(); SetViewBagPermission(); return(View(obj)); }
protected void Button1_Click(object sender, EventArgs e) { MessageBox msg = new MessageBox(); admin ad = new admin(); MembershipUser u = Membership.GetUser(TextBox1.Text); if (u == null) { msg.Show("Invalid username"); } else { Guid a = new Guid(u.ProviderUserKey.ToString()); DataSet ds = ad.getuserpassword(a); string pass = ds.Tables[0].Rows[0]["password"].ToString(); string email = u.Email.ToString(); ProfileCommon comm = Profile.GetProfile(TextBox1.Text); string username = TextBox1.Text; string mobile = comm.Mobile; string name = comm.FirstName; mailing mail = new mailing(); string mess1 = "Dear " + name + ",<br><br>Your freshprawnsonline account password is:" + pass + "<br><br>Regards,<br>Admin, Farm Fresh Prawns."; string mess = "Dear " + name + " Your freshprawnsonline account password is:" + pass; mail.mymail(email, mess1, "Password Retrieval"); sms s = new sms(); s.SendSMS(mobile, mess); TextBox1.Text = ""; msg.Show("Password has been sent to your provided email and mobile number"); } }
public IEnumerable <CashValueUI> GetCashValuesByPolicy([FromUri] PoliciesFilter filter) { ProfileCommon profile = APIhelper.GetProfileCommon(Request); web_Company wc = DB.GetCompanyByID(profile.CompanyID); return(CashValueUI.GetCashValuesByPolicy(profile, wc, filter)); }
/// <summary> /// Gets the settings for the current user. /// </summary> /// <returns></returns> public static ListViewSettingsCollection GetSettingsForUser() { ProfileCommon pc = new ProfileCommon(); return pc.TicketListSettings; }
public void data() { MembershipUser mem = Membership.GetUser(); if (mem != null) { Literal text = (Literal)LoginView1.FindControl("Literal2"); ProfileCommon comm = Profile.GetProfile(mem.UserName); string tempname = comm.name; if (tempname.Length > 8) { tempname = tempname.Substring(0, 8); text.Text = "Welcome " + tempname + "..."; } else { text.Text = "Welcome " + tempname; } } else { } }
protected void Page_Load(object sender, EventArgs e) { string userName = User.Identity.Name; ProfileCommon theProfile = Profile.GetProfile("userName"); User user = myEntities.Users.Where(u => u.UserName == userName).Single(); CreateDateTimeLabel.Text = user.CreateDateTime.ToString(); IPAdressLabel.Text = user.IPAdress; AvatarImg.ImageUrl = user.AvatarUrl; InviteLabel.Text = user.Invite.ToString(); BounsLabel.Text = user.Bouns.ToString(); TorrentCommentLabel.Text = "0"; int forumReplyTotal = myEntities.ForumReplies.Count(); int myForumReplyCount = myEntities.ForumReplies.Where(f => f.UserName == userName).Count(); ForumPostLabel.Text = myForumReplyCount.ToString(); ForumReplyTotal.Text = forumReplyTotal.ToString(); if (forumReplyTotal > 0) { decimal percent = ((decimal)myForumReplyCount / forumReplyTotal) * 100; ForumPostsPercent.Text = percent.ToString("#.00"); } else { ForumPostsPercent.Text = "0"; } }
protected void Button1_Click(object sender, EventArgs e) { /* MembershipCreateStatus status; * Membership.CreateUser(TextBox1.Text, TextBox2.Text, TextBox3.Text, "Username?", TextBox1.Text, true, out status); * if (status == MembershipCreateStatus.Success) * { * /* MembershipUser user = Membership.GetUser(TextBox1.Text); * var profile = HttpContext.Current.Profile; * profile.SetPropertyValue("Name", TextBox4.Text); * profile.Save();*/ //Profile.Name = TextBox4.Text; // Label1.Text = "Created"; // }*/ MembershipCreateStatus status; Membership.CreateUser(TextBox1.Text, TextBox2.Text, TextBox3.Text, "Username?", TextBox1.Text, true, out status); if (status == MembershipCreateStatus.Success) { Label1.Text = "Created"; } else { Label1.Text = "Failed"; } ProfileCommon pc = Profile.GetProfile(TextBox1.Text); pc.Name = TextBox4.Text; pc.Save(); }
protected void Login1_Authenticate(object sender, AuthenticateEventArgs e) { // find login control in loginview control Login Login1 = GetLogin1(); // We need to determine if the user is authenticated and set e.Authenticated accordingly // Get the values entered by the user string loginUsername = Login1.UserName; string loginPassword = Login1.Password; // find captcha control in login control //WebControlCaptcha.CaptchaControl loginCAPTCHA = (WebControlCaptcha.CaptchaControl)Login1.FindControl("CAPTCHA"); // First, check if CAPTCHA matches up // Next, determine if the user's username/password are valid if (Membership.ValidateUser(loginUsername, loginPassword)) { e.Authenticated = true; ProfileCommon p = new ProfileCommon().GetProfile(loginUsername); Session["profile"] = p; Response.Redirect("~/UserUpT2.aspx"); //FormsAuthentication.RedirectFromLoginPage(loginUsername, true); } else { e.Authenticated = false; lblFailureText.Text = "User Name and/or Password did not match."; lblFailureText.Visible = true; } }
// protected void GetUserInfo() { ProfileCommon pf = new ProfileCommon(); pf.Initialize(TextUserName.Text, true); this.TextName.Text = pf.Name; this.TextAddress.Text = pf.Address; this.TextPhone.Text = pf.Phone; Literal2.Text = ""; foreach (ListItem item in cblRoles.Items) { item.Selected = false; } string[] sa = Roles.GetRolesForUser(TextUserName.Text); foreach (string s in sa) { int idx = 1; ListItem item = cblRoles.Items.FindByText(s); if (item != null) { idx = cblRoles.Items.IndexOf(item); cblRoles.Items[idx].Selected = true; Literal2.Text += s + ";"; } } }
private void BindProfileView() { user = Membership.GetUser(User.Identity.Name); p = Profile.GetProfile(User.Identity.Name); //((Label)GridView.FindControl("UsernameView")).Text = User.Identity.Name; ((Label)GridView.FindControl("CorpView")).Text = p.UserProfile.Corp; ((Label)GridView.FindControl("AddressView")).Text = p.UserProfile.Zipcht + p.UserProfile.Address; ((Label)GridView.FindControl("NameView")).Text = p.UserProfile.Name; ((Label)GridView.FindControl("TelView")).Text = p.UserProfile.Tel; ((Label)GridView.FindControl("FaxView")).Text = p.UserProfile.Fax; ((Label)GridView.FindControl("EmailView")).Text = user.Email; /*object[] param = new object[2]; * param[0] = "K"; * param[1] = p.UserProfile.Kind; * * Param obj = mgrParam.getParam(param); * ((Label)GridView.FindControl("KindView")).Text = obj.Paramname;*/ if (p.UserProfile.Kind.Equals("A")) { ((Label)GridView.FindControl("KindView")).Text = "學術單位"; } else if (p.UserProfile.Kind.Equals("B")) { ((Label)GridView.FindControl("KindView")).Text = "研究單位"; } else if (p.UserProfile.Kind.Equals("C")) { ((Label)GridView.FindControl("KindView")).Text = "其他"; } }
protected void RegisterUser_CreatedUser(object sender, EventArgs e) { ProfileCommon p = new ProfileCommon(); p.Initialize(RegisterUser.UserName, true); p.Address = ((TextBox)RegisterUser.CreateUserStep.ContentTemplateContainer.FindControl("TextAddress")).Text; p.Name = ((TextBox)RegisterUser.CreateUserStep.ContentTemplateContainer.FindControl("TextName")).Text; p.Phone = ((TextBox)RegisterUser.CreateUserStep.ContentTemplateContainer.FindControl("TextPhone")).Text; //// Save the profile - must be done since we explicitly created this profile instance p.Save(); FormsAuthentication.SetAuthCookie(RegisterUser.UserName, false /* createPersistentCookie */); if (RegisterUser.UserName == "admin") { Roles.AddUserToRole(RegisterUser.UserName, "admin"); } else { Roles.AddUserToRole(RegisterUser.UserName, "customer"); } string continueUrl = RegisterUser.ContinueDestinationPageUrl; if (String.IsNullOrEmpty(continueUrl)) { continueUrl = "~/FirstPage.aspx"; } Response.Redirect(continueUrl); }
//Interface protected void Page_Load(object sender, EventArgs e) { //Event handler for page load event try { if (!Page.IsPostBack) { //Get query request and setup for new or existing user this.mUserName = new MembershipServices().Username; ViewState.Add("username", this.mUserName); // Membership MembershipUser member = Membership.GetUser(this.mUserName, false); this.txtUserName.Text = member.UserName; this.txtUserName.Enabled = false; this.txtEmail.Text = member.Email; //try { if(!member.IsLockedOut) this.txtPassword.Text = member.GetPassword(); } catch { } //this.txtComments.Text = member.Comment; // Profile ProfileCommon profileCommon = new ProfileCommon(); ProfileCommon profile = profileCommon.GetProfile(this.mUserName); this.txtFullName.Text = profile.UserFullName; this.txtCompany.Text = profile.Company; //this.txtCompanyType.Text = profile.Type; //this.txtCustomer.Text = profile.ClientVendorID; this.txtStoreNumber.Text = profile.StoreNumber; } else { this.mUserName = ViewState["username"].ToString(); } } catch (Exception ex) { Master.ReportError(ex, 3); } }
protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e) { TextBox eMail = (TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("Email"); TextBox firstName = (TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("FirstName"); TextBox lastName = (TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("LastName"); TextBox userName = (TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("UserName"); ProfileCommon pc = new ProfileCommon(); ProfileCommon userPro = pc.GetProfile(userName.Text); //First set profile properties. userPro.EMail = eMail.Text; if (userPro.FirstName != "" && userPro.FirstName != null) { userPro.FirstName = firstName.Text; } if (userPro.LastName != "" && userPro.LastName != null) { userPro.LastName = lastName.Text; } userPro.Save(); // Next add user to ProfileProperty table. UserClass uc = new UserClass(userPro.UserName); uc.SignUpUser(eMail.Text, firstName.Text, lastName.Text); }
protected void loginControl_LoggedIn(object sender, EventArgs e) { ProfilesMembershipUser user = (ProfilesMembershipUser)Membership.GetUser(((Login)sender).UserName); // Get an instance of the ProfileCommon object ProfileCommon p = (ProfileCommon)ProfileCommon.Create(user.UserName, true); // Set our parameters from the custom authentication provider p.UserId = user.UserID; p.UserName = user.UserName; p.HasProfile = user.HasProfile; p.ProfileId = user.ProfileID; p.DisplayName = user.DisplayName; // Persist the profile data p.Save(); // Refetch the profile data Profile.Initialize(user.UserName, true); //Profile.GetProfile(user.UserName); if (HttpContext.Current.Request.QueryString["EditMyProfile"] != null) { Response.Redirect("~/ProfileEdit.aspx?From=Self&Person=" + user.ProfileID.ToString()); } }
private void SendPM() { MembershipUser currentUser = Membership.GetUser(_username); if (currentUser == null || currentUser.ProviderUserKey == null) { return; } string[] toMembers = Regex.Split(newTo.Text, ";"); foreach (string member in toMembers) { ProfileCommon profile = ProfileCommon.GetUserProfile(member); MembershipUser recipient = Membership.GetUser(member, false); if (recipient != null && recipient.ProviderUserKey != null) { var pm = new PrivateMessageInfo { FromMemberId = (int)currentUser.ProviderUserKey, Read = 0, Subject = newSubject.Text, Message = newMessage.Text, OutBox = _layout != "none" ? 1 : 0, SentDate = DateTime.UtcNow.ToForumDateStr(), ToMemberId = (int)recipient.ProviderUserKey, Mail = profile.PMEmail == null ? 0 : profile.PMEmail.Value }; Snitz.BLL.PrivateMessages.SendPrivateMessage(pm); } } //TODO: Send notify if required statusTxt.Text = Resources.PrivateMessage.PmSent; pnlMessage.Visible = false; }
private Control GetTopicAuthorIcon(int authorid) { var author = Members.GetAuthor(authorid); ProfileCommon prof = ProfileCommon.GetUserProfile(author.Username); if (prof.Gravatar) { Gravatar avatar = new Gravatar { Email = author.Email }; if (author.AvatarUrl != "" && author.AvatarUrl.StartsWith("http:")) { avatar.DefaultImage = author.AvatarUrl; } avatar.CssClass = "avatarsmall"; return(avatar); } else { SnitzMembershipUser mu = (SnitzMembershipUser)Membership.GetUser(author.Username); Literal avatar = new Literal { Text = author.AvatarImg }; if (mu != null && mu.IsActive && !(Config.AnonMembers.Contains(mu.UserName))) { avatar.Text = avatar.Text.Replace("'avatar'", "'avatarsmall online'"); } else { avatar.Text = avatar.Text.Replace("'avatar'", "'avatarsmall'"); } return(avatar); } }
public void UpdateProfile() { ProfileCommon profile = HttpContext.Current.Profile as ProfileCommon; profile.Address1 = address1; profile.Address2 = address2; profile.City = city; profile.Region = region; profile.PostalCode = postalCode; profile.Country = country; profile.ShippingRegion = shippingRegion; profile.DayPhone = dayPhone; profile.EvePhone = evePhone; profile.MobPhone = mobPhone; profile.CreditCard = creditCard; MembershipUser user = Membership.GetUser(profile.UserName); user.Email = email; Membership.UpdateUser(user); try { SecureCard secureCard = new SecureCard( creditCardHolder, creditCardNumber, creditCardIssueDate, creditCardExpiryDate, creditCardIssueNumber, creditCardType); profile.CreditCard = secureCard.EncryptedData; } catch { creditCard = ""; } }
public static void sendApprovalRequest(string uid) { Guid userKey = new Guid(uid); MembershipUser user = Membership.GetUser(userKey); ProfileCommon pObj = new ProfileCommon().GetProfile(user.UserName); Dictionary<string, dynamic> args = new Dictionary<string, dynamic>(); args.Add("method", "request.approval"); args.Add("uid", uid); args.Add("companyname", pObj.CompanyName); Address address = new Address(); address.country = pObj.Country; address.city = pObj.City; address.street = pObj.Street; address.postal_code = pObj.PostalCode; args.Add("address", address); args.Add("phone", pObj.PhoneNumber); args.Add("email", pObj.ContactEmail); WebRequestHandler.load(args); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { bindLstUsers(); } selectedUsername = lstUsers.SelectedValue; selectedUser = Membership.GetUser(selectedUsername); selectedProfile = (ProfileCommon)ProfileCommon.Create(selectedUsername, true); }
private void BindControls() { ProfileCommon pc = new ProfileCommon(); //pc =(ProfileCommon)pc.GetProfile( _enrollmentEntity[0].UserName); //UserNameHyperLink.Text = pc.FirstName + " " + pc.LastName; UserNameHyperLink.NavigateUrl = "~/Admin/UserDetails.aspx?user="******"{0} day", _enrollmentEntity[0].TrialPeriod); else TrialPeriodLiteral.Text = string.Format("{0} days", _enrollmentEntity[0].TrialPeriod); switch (_enrollmentEntity[0].SubscriptionDuration) { case 0: SubscriptionLiteral.Text = "Infinite"; break; case 1: SubscriptionLiteral.Text = string.Format("{0} month", _enrollmentEntity[0].SubscriptionDuration); break; default : SubscriptionLiteral.Text = string.Format("{0} months", _enrollmentEntity[0].SubscriptionDuration); break; } switch (_enrollmentEntity[0].AvailableDuration) { case 0: AvailableDurationLiteral.Text = "Infinite"; break; case 1: AvailableDurationLiteral.Text = string.Format("{0} month", _enrollmentEntity[0].AvailableDuration); break; default: AvailableDurationLiteral.Text = string.Format("{0} months", _enrollmentEntity[0].AvailableDuration); break; } EnrollmentDateLiteral.Text = string.Format("{0}",_enrollmentEntity[0].EnrollmentStartDate.ToShortDateString()); PricePerMonthLiteral.Text = string.Format("{0:c}", _enrollmentEntity[0].PricePerMonth); InitialPriceLiteral.Text = string.Format("{0:c}", _enrollmentEntity[0].InitialPrice); IsFreeCheckBox.Checked = _enrollmentEntity[0].IsFree; IsTestCheckBox.Checked = _enrollmentEntity[0].IsTest; //LastUpdatedByLiteral.Text = _enrollmentEntity[0].LastUpdatedBy; LastUpdatedOnLiteral.Text = _enrollmentEntity[0].LastEditDate.ToString(); CreatedOnLiteral.Text = _enrollmentEntity[0].CreationDate.ToString(); }
public static bool approveCompany(string uid) { //Load user name from uid Guid userKey = new Guid(uid); MembershipUser user = Membership.GetUser(userKey); //Load profile from username ProfileCommon pObj = new ProfileCommon().GetProfile(user.UserName); pObj.Status = 2; pObj.Save(); string[] receiver = { user.Email.ToString() }; string body = "Hello " + user.UserName.ToString() + "\n\nYour account has been validated!"; MessageManager.send(receiver, "You account has been validated", body); return true; }
//Starts proposal phase, sets status and sends out invitations public static void startProposalPhase(long inquiryId, string[] jeids, string message, DateTime propstart, DateTime propend) { InquiriesDataContext dbContext = new InquiriesDataContext(); inquiries myInquiry = dbContext.inquiries.Single(p => p.iid == inquiryId); myInquiry.proposal_start = propstart; myInquiry.proposal_end = propend; myInquiry.status = 2; dbContext.SubmitChanges(); List<string> receivers = new List<string>(); foreach (var single in jeids) { likes like = dbContext.likes.Single(p => p.iid == inquiryId && p.jeid == single); like.status = 2; receivers.Add(like.email); } dbContext.SubmitChanges(); //Send Web Service request send.proposalrequest //Load user name from uid Guid userKey = new Guid(myInquiry.uid); MembershipUser user = Membership.GetUser(userKey); //Load profile from username ProfileCommon pObj = new ProfileCommon().GetProfile(user.UserName); Dictionary<string, dynamic> args = new Dictionary<string, dynamic>(); args.Add("method", "send.proposalrequest"); args.Add("companyname", pObj.CompanyName); args.Add("iid", myInquiry.iid); args.Add("receivers", jeids); args.Add("title", "Proposal submit invitation"); args.Add("message", message); WebRequestHandler.load(args); //Send introductory message to junior enterprises MessageManager.send(receivers.ToArray(), "Invitation to submit proposal for " + myInquiry.title, message); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { btnSubmit.OnClientClick = "return confirm('Do you really want to submit this order?');"; if (!Context.User.IsInRole("customer")) { Utils.ShowMessageBox(this, "not a customer,the order can't be submitted"); LabelRslt.Text = "The user is not a customer,the order can't be submitted"; } DataTable dtOrder = (DataTable)Session["order"]; if (dtOrder != null) { for (int i = 0; i < dtOrder.Rows.Count; i++) for (int j = 0; j < dtOrder.Columns.Count; j++) { GvOrderDetail.TableOrder.Rows[i][j] = dtOrder.Rows[i][j]; } } // get the order types data foreach (TOrderType item in RestaurantBiz.AllOrderTypes) { ddlOrderType.Items.Add(new ListItem(item.Text, item.Id.ToString())); } //select the first as default ddlOrderType.Items[0].Selected = true; ProfileCommon pf = new ProfileCommon(); pf.Initialize(Context.User.Identity.Name, true); tbAdd.Text = pf.Address; tbPhone.Text = pf.Phone; tbName.Text = pf.Name; LabelRslt.Text = ""; } }
/// <summary> /// just remove all the properties and values from particular user and group's profile but the empty instance exists /// </summary> /// <param name="userName"></param> /// <param name="groupName"></param> /// <returns></returns> public bool RemoveProfileByUserGroup(string userName,string groupName) { ProfileCommon pc = new ProfileCommon(); ProfileCommon existing_pc = pc.GetProfile(userName); try{ Dictionary<string,object> profile = (Dictionary<string,object>)existing_pc.GetProfileGroup(groupName).GetPropertyValue("properties_block"); profile.Clear(); if(!SetProfile(groupName,userName,profile).Equals("success")) return false; } catch(Exception e) { return false; } return true; }
/// <summary> /// remove only provided properties from particular user and group's profile /// </summary> /// <param name="userName"></param> /// <param name="groupName"></param> /// <param name="propertyNameList"></param> /// <returns></returns> public bool RemoveProfilePropertiesByUserGroup(string userName,string groupName,ArrayList propertyNameList) { Dictionary<string, object> existPropertiesDictionary = new Dictionary<string,object>(); ProfileCommon pc = new ProfileCommon(); ProfileCommon existing_pc = pc.GetProfile(userName); Dictionary<string,object> profileDictionary = (Dictionary<string,object>)existing_pc.GetProfileGroup(groupName).GetPropertyValue("properties_block"); if(profileDictionary.Keys.Count > 0) { propertyDepth = ""; existPropertiesDictionary = DeleteProperties(profileDictionary,propertyNameList); } if(!SetProfile(groupName,userName,existPropertiesDictionary).Equals("success")) return false; return true; }
/// <summary> /// set the profile dictionary according to merchant_group and user_name /// </summary> /// <param name="groupName"></param> /// <param name="username"></param> /// <param name="userProfile"></param> /// <returns>return "success" if profile is inserted successfully otherwise return "error!![error_text]"</returns> public string SetProfile(string groupName,string userName,Dictionary<string,object> userProfile) { if(Membership.GetUser(userName) == null) Membership.CreateUser(userName,"1234567"); try { ProfileCommon pc = new ProfileCommon(); ProfileCommon existing_pc = pc.GetProfile(userName); existing_pc.GetProfileGroup(groupName).SetPropertyValue("properties_block",userProfile); existing_pc.Save(); } catch(Exception e) { return "error!!" + e; } return "success"; }
/// <summary> /// Saves the user's list settings. /// </summary> public void Save() { ProfileCommon pc = new ProfileCommon(); pc.TicketListSettings = this; }
protected void btnLogin_Click(object sender, EventArgs e) { strUserName = txtUsername.Text.Trim(); strPassword = txtPassword.Text.Trim(); divErrorMessage.Visible = false; lblLoginMessage.Text = string.Empty; try { if (!string.IsNullOrEmpty(strUserName) && !string.IsNullOrEmpty(strPassword)) { bool blValResult = Membership.ValidateUser(strUserName, strPassword); if (blValResult) { // memUser = Membership.GetUser(strUserName); ////Get all the roles for the signed in user // string[] roles = Roles.GetRolesForUser(strUserName); // //Get the roles allowed in the service // string[] AllowedRoles = objServ.AllowedRoles.Split(','); // if (AllowedRoles[0] != string.Empty) // { // foreach (string strAllowedRole in AllowedRoles) // { // var srchString = strAllowedRole; // var strFound = Array.FindAll(roles, str => str.ToLower().Trim().Equals(srchString.ToLower().Trim())); // if (strFound.ToList().Count > 0) // { // //if role exists in the roles for the particular user, set flag allow to true // Allow = true; // break; // } // } // } // else // { // Response.Redirect("Default.aspx", false); // //Server.Transfer("Default.aspx"); // } //if (Allow) //{ objProf = Profile.GetProfile(strUserName); cus = objProf.MyCustomProfile; //Add tgheAuthenticated user detiails objUserInfo = objUserInfo.getUserInfoObject; objUserInfo.UserId = 0; objUserInfo.UserName = strUserName; objUserInfo.IsAuthenticated = true; //Add the User Object to Session Session.Add("objUserInfo", objUserInfo); //Add the UserFavouites to Session Session["UserFavorites"] = objProf.MyCustomProfile.FavoriteList; //Redirect to Default Page if (Session["RedirectURL"] != null) { string str = Session["RedirectURL"].ToString(); str = str.Substring(0, str.LastIndexOf('/')); str = str + "/" + strFinalPubName; Response.Redirect(str + "/default2.aspx", false); HttpContext.Current.ApplicationInstance.CompleteRequest(); } //} //else //{ // lblLoginMessage.Text = objCommonUtil.getTransText(Constants.LOGIN_NOPUBACCESS); // divErrorMessage.Visible = true; //} } else { lblLoginMessage.Text = objCommonUtil.getTransText(Constants.LOGIN_INVALID_CREDENTIALS); divErrorMessage.Visible = true; } } } catch (Exception ex) { lblLoginMessage.Text = objCommonUtil.getTransText(Constants.LOGIN_GENERIC_ERROR); divErrorMessage.Visible = true; al = new ArrayList(); al.Add(strFinalPubName); al.Add(LOGIN_MODULE); al.Add(objUserInfo.UserName); AgriCastException currEx = new AgriCastException(al, ex); AgriCastLogger.Publish(currEx, AgriCastLogger.LogType.Error); } }
// protected void GetUserInfo() { ProfileCommon pf = new ProfileCommon(); pf.Initialize(TextUserName.Text, true); this.TextName.Text = pf.Name; this.TextAddress.Text = pf.Address; this.TextPhone.Text = pf.Phone; Literal2.Text = ""; foreach (ListItem item in cblRoles.Items) { item.Selected = false; } string[] sa = Roles.GetRolesForUser(TextUserName.Text); foreach (string s in sa) { int idx = 1; ListItem item = cblRoles.Items.FindByText(s); if (item != null) { idx = cblRoles.Items.IndexOf(item); cblRoles.Items[idx].Selected = true; Literal2.Text += s+";"; } } }
/// <summary> /// Get View table. /// </summary> /// <param name="Profile"></param> /// <returns></returns> public string getProfileView(ProfileCommon Profile) { string s = ""; /*// This is not in order. * foreach (SettingsProperty p in ProfileCommon.Properties) { s += p.Name + ","; }*/ for (int i = 0, n = ProfilePropertyCollection.Length; i < n; ++i) { ClsProfileEntry property = ProfilePropertyCollection[i]; if (! property.ShowInUI) continue; string row = string.Format("<tr><td>{0}:</td><td>{1}</td></tr>", property.Label, Profile[property.Name]); s += row; } s = "<table class=\"tbl_profile\">" + s + "</table>"; return s; }
/// <summary> /// Get Edit table. /// </summary> /// <param name="Profile"></param> /// <returns></returns> public string getProfileEdit(ProfileCommon Profile, string Country = "") { string s = ""; string script = ""; // for client side validation. string row; for (int i = 0, n = ProfilePropertyCollection.Length; i < n; ++i) { ClsProfileEntry property = ProfilePropertyCollection[i]; if (! property.ShowInUI) continue; string propertyName = property.Name; string label = (string) property.Label; string value = (string) Profile[property.Name]; string spanIsRequired = property.IsRequired ? IsRequiredLabel : ""; string disabled = property.IsDisabled ? " disabled" : ""; if (property.IsRequired) { script = string.Format(@" if ($.trim(document.getElementById('{0}{1}').value) == '') {{ eo = $('#{0}{1}'); $('#{0}{1}').addClass('perror'); document.getElementById('e_{1}').innerHTML = 'cannot be empty'; }} else {{ $('#{0}{1}').removeClass('perror'); document.getElementById('e_{1}').innerHTML = ''; }} ", fieldNamePrefix, propertyName) + script; } if (propertyName == "Gender") { value = getDropDownList_Gender(value, string.Format(" id=\"txtGender\" name=\"txtGender\"{0}", disabled)); } else if (propertyName == "State" && Country != "" && ClsStateList.getStateList(Country) != null) { value = ClsStateList.getStateListAsDropDownList( ClsStateList.getStateList(Country), string.Format(" id=\"{0}State\" name=\"{0}State\"{1}", fieldNamePrefix, disabled), value); } else if (propertyName == "Country") { //value = new ClsDBUtil().getDropDownListFromDB("Select Country, Country FROM T_CountryList", " id=\"txtCountry\" name=\"txtCountry\"", value); value = ClsStateList.getCountryListAsDropDownList(" id=\"txtCountry\" name=\"txtCountry\"", value); } else { value = string.Format("<input type=\"Text\" id=\"{0}{1}\" name=\"{0}{1}\" value=\"{2}\"{3}>", fieldNamePrefix, propertyName, value, disabled); } string spanErrMsg = string.Format("<span id=\"e_{0}\" class=\"error\"></span>", propertyName); row = string.Format("<tr><td>{0}:</td><td>{1}{2} {3}</td></tr>\n", label, value, spanIsRequired, spanErrMsg); s += row; } s += "<tr><td colspan=\"2\" align='right'><input type='submit' value='Update' name='btnSubmit' onclick='return validation();' /></td></tr>"; s = "<table class=\"tbl_profile\">" + s + "</table>"; if (script != "") { script = string.Format(@" <script type=""text/javascript""> function validation() {{ var eo = null; // object with empty value. {0} if (eo != null) {{ eo.focus(); return false; // cancel submit. }} return true; }} </script> ", script); //script = script.Replace("\n", "<br/>"); s += script; } return s; }
public CarServiceUser(MembershipUser user, ProfileCommon profileCommon) { this.user = user; this.profileCommon = profileCommon; }
/// <summary> /// get all profiles of all groups with metioned properties for particular user /// </summary> /// <param name="userName"></param> /// <param name="propertyNameList"></param> /// <returns>return a dictionary object that holds "group_name" as a key and total properties_block(dictionary object) for that particular group as a value</returns> public Dictionary<string, object> GetProfilesByUser(string userName,ArrayList propertyNameList) { Dictionary<string, object> profileListDictionary = new Dictionary<string, object>(); ProfileCommon pc = new ProfileCommon(); ProfileCommon existing_pc = pc.GetProfile(userName); string []groupNameArray = Enum.GetNames(typeof(ProfileTypeEnum)); for(int i=0;i<groupNameArray.Length;i++) { Dictionary<string,object> profileDictionary = (Dictionary<string,object>)existing_pc.GetProfileGroup(groupNameArray[i]).GetPropertyValue("properties_block"); if(profileDictionary.Keys.Count > 0) { propertyDepth = ""; Dictionary<string, object> selectedPropertiesDictionary = new Dictionary<string,object>(); selectedPropertiesDictionary = FindProperties(profileDictionary,selectedPropertiesDictionary,propertyNameList); if(selectedPropertiesDictionary.Keys.Count > 0) profileListDictionary.Add(groupNameArray[i],selectedPropertiesDictionary); } } return profileListDictionary; }
protected void Button1_Click(object sender, EventArgs e) { // if (Roles.IsUserInRole(Context.User.Identity.Name, "admin")) { if ( (Membership.FindUsersByName(TextUserName.Text) !=null) && (Membership.FindUsersByName(TextUserName.Text).Count>0) ) { } else { Literal1.Text = "no such user:"******"Detail Information Saved Successfully!"; } else { ProfileCommon p = new ProfileCommon(); p.Initialize(Context.User.Identity.Name, true); p.Address = TextName.Text; p.Phone = TextPhone.Text; p.Name = TextName.Text; //// Save the profile - must be done since we explicitly created this profile instance p.Save(); Literal1.Text = "Detail Information Saved Successfully!"; } }
/// <summary> /// get only metioned properties of profile for all user and group /// </summary> /// <param name="propertyNameList"></param> /// <returns>return a dictionary object that holds "user_name|merchant_Group_Name" as a key and total properties_block(dictionary object) for that particular user and group as a value</returns> public Dictionary<string, object> GetTotalProfileCollection(ArrayList propertyNameList) { Dictionary<string, object> profileListDictionary = new Dictionary<string, object>(); MembershipUserCollection userList = Membership.GetAllUsers(); foreach(MembershipUser user in userList) { ProfileCommon pc = new ProfileCommon(); ProfileCommon existing_pc = pc.GetProfile(user.UserName); string []groupNameArray = Enum.GetNames(typeof(ProfileTypeEnum)); for(int i=0;i<groupNameArray.Length;i++) { Dictionary<string,object> profileDictionary = (Dictionary<string,object>)existing_pc.GetProfileGroup(groupNameArray[i]).GetPropertyValue("properties_block"); if(profileDictionary.Keys.Count > 0) { propertyDepth = ""; Dictionary<string, object> selectedPropertiesDictionary = new Dictionary<string,object>(); selectedPropertiesDictionary = FindProperties(profileDictionary,selectedPropertiesDictionary,propertyNameList); if(selectedPropertiesDictionary.Keys.Count > 0) profileListDictionary.Add(user.UserName+"|"+groupNameArray[i],selectedPropertiesDictionary); } } } return profileListDictionary; }
public CommerceLibOrderInfo(DataRow orderRow) { OrderID = Int32.Parse(orderRow["OrderID"].ToString()); DateCreated = orderRow["DateCreated"].ToString(); DateShipped = orderRow["DateShipped"].ToString(); Comments = orderRow["Comments"].ToString(); Status = Int32.Parse(orderRow["Status"].ToString()); AuthCode = orderRow["AuthCode"].ToString(); Reference = orderRow["Reference"].ToString(); Customer = Membership.GetUser( new Guid(orderRow["CustomerID"].ToString())); CustomerProfile = (HttpContext.Current.Profile as ProfileCommon) .GetProfile(Customer.UserName); CreditCard = new SecureCard(CustomerProfile.CreditCard); OrderDetails = CommerceLibAccess.GetOrderDetails( orderRow["OrderID"].ToString()); // Get Shipping Data if (orderRow["ShippingID"] != DBNull.Value && orderRow["ShippingType"] != DBNull.Value && orderRow["ShippingCost"] != DBNull.Value) { Shipping.ShippingID = Int32.Parse(orderRow["ShippingID"].ToString()); Shipping.ShippingType = orderRow["ShippingType"].ToString(); Shipping.ShippingCost = double.Parse(orderRow["ShippingCost"].ToString()); } else { Shipping.ShippingID = -1; } // Get Tax Data if (orderRow["TaxID"] != DBNull.Value && orderRow["TaxType"] != DBNull.Value && orderRow["TaxPercentage"] != DBNull.Value) { Tax.TaxID = Int32.Parse(orderRow["TaxID"].ToString()); Tax.TaxType = orderRow["TaxType"].ToString(); Tax.TaxPercentage = double.Parse(orderRow["TaxPercentage"].ToString()); } else { Tax.TaxID = -1; } // set info properties Refresh(); }
/// <summary> /// get profile with metioned properties for particular group and user /// </summary> /// <param name="userName"></param> /// <param name="groupName"></param> /// <returns>return a dictionary object that holds "property_name" as a key and "property_value" as a value</returns> public Dictionary<string, object> GetProfileByUserGroup(string userName,string groupName,ArrayList propertyNameList) { Dictionary<string, object> selectedPropertiesDictionary = new Dictionary<string,object>(); ProfileCommon pc = new ProfileCommon(); ProfileCommon existing_pc = pc.GetProfile(userName); Dictionary<string,object> profileDictionary = (Dictionary<string,object>)existing_pc.GetProfileGroup(groupName).GetPropertyValue("properties_block"); if(profileDictionary.Keys.Count > 0) { propertyDepth = ""; selectedPropertiesDictionary = FindProperties(profileDictionary,selectedPropertiesDictionary,propertyNameList); } return selectedPropertiesDictionary; }
public bool CreateEnrollment(string username, string email, string password, string firstname ,string lastname ,string address ,string city , string zipcode ,string phone ,string cellphone ) { try { //string firstname = "", lastname = "", address = "", city = "", zipcode = "", phone = "", cellphone = ""; MembershipCreateStatus _status; bool bln = Membership.DeleteUser(username); //bln = Roles.DeleteRole(username); string user_name = username; //string email = "*****@*****.**"; //string password = "******"; string question = null; string answer = null; MembershipUser user = Membership.CreateUser ( user_name, password, email, question, answer, true, out _status ); Roles.AddUserToRoles(user.UserName, new string[] { "Member" }); ProfileCommon profile = new ProfileCommon(); profile = profile.GetProfile(user.UserName); //ProfileCommon profile = Profile.GetProfile(user.UserName); profile.FirstName = firstname; profile.LastName = lastname; profile.DateOfBirth = Convert.ToDateTime("1/1/1900"); profile.Sex = System.DBNull.Value.ToString(); profile.ShippingZipCode = zipcode; profile.ShippingAddress1 = address; profile.ShippingCity = city; profile.WorkPhone = phone; profile.Browser = HttpContext.Current.Request.Browser.Browser + " " + HttpContext.Current.Request.Browser.MajorVersion; profile.IPAddress = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"].ToString(); profile.LanguageCode = HttpContext.Current.Request.ServerVariables["HTTP_ACCEPT_LANGUAGE"].ToString(); profile.Timezone = TimeZone.CurrentTimeZone.StandardName.ToString(); profile.Save(); Subscriber subscriberInfo = new Subscriber(); subscriberInfo.FirstName = firstname; subscriberInfo.LastName = lastname; subscriberInfo.Email = email; subscriberInfo.SubscribedStatus = true; subscriberInfo.TotalEmailsSent = 0; Subscriber.ManageSubscription(subscriberInfo); return true; } catch (Exception ex) { return false; } }
/// <summary> /// get profile for particular group and user /// </summary> /// <param name="userName"></param> /// <param name="groupName"></param> /// <returns>return a dictionary object that holds "property_name" as a key and "property_value" as a value</returns> public Dictionary<string, object> GetProfileByUserGroup(string userName,string groupName) { ProfileCommon pc = new ProfileCommon(); ProfileCommon existing_pc = pc.GetProfile(userName); return (Dictionary<string,object>)existing_pc.GetProfileGroup(groupName).GetPropertyValue("properties_block"); }
/// <summary> /// get profiles of all users with metioned properties for particular groupName /// </summary> /// <param name="groupName"></param> /// <param name="propertyNameList"></param> /// <returns>return a dictionary object that holds "user_name" as a key and total properties_block(dictionary object) for that particular user as a value</returns> public Dictionary<string, object> GetProfilesByGroup(string groupName,ArrayList propertyNameList) { Dictionary<string, object> profileListDictionary = new Dictionary<string, object>(); ProfileCommon pc = new ProfileCommon(); MembershipUserCollection userList = Membership.GetAllUsers(); foreach(MembershipUser user in userList) { ProfileCommon existing_pc = pc.GetProfile(user.UserName); Dictionary<string,object> profileDictionary = (Dictionary<string,object>)existing_pc.GetProfileGroup(groupName).GetPropertyValue("properties_block"); if(profileDictionary.Keys.Count > 0) { propertyDepth = ""; Dictionary<string, object> selectedPropertiesDictionary = new Dictionary<string,object>(); selectedPropertiesDictionary = FindProperties(profileDictionary,selectedPropertiesDictionary,propertyNameList); if(selectedPropertiesDictionary.Keys.Count > 0) profileListDictionary.Add(user.UserName,selectedPropertiesDictionary); } } return profileListDictionary; }