Example #1
0
 /// <summary>
 /// Delete Button Click Event
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     ProfileAdmin profileAdmin = new ProfileAdmin();
     Profile profileEntity = profileAdmin.GetByProfileID(ItemID);
     bool status;
     string message;
     if (profileEntity.IsDefault == true)
     {
        status = false;
        message = "The profile can not be deleted because it is set to default";
     }
     else
     {
        status = profileAdmin.Delete(profileEntity);
        message ="The profile can not be deleted until all associated items are removed. Please ensure that this profile does not associated with accounts or promotions. If it does, then delete these Items first.";
     }
     if(status)
     {
         Response.Redirect(CancelLink);
     }
     else
     {
         lblErrorMessage.Text = message;
     }
 }
Example #2
0
    /// <summary>
    /// 
    /// </summary>
    protected void BindProfiles()
    {
        ProfileAdmin profileAdmin = new ProfileAdmin();
        TList<Profile> profileList = profileAdmin.GetAll();

        foreach (Profile entity in profileList)
        {
            Literal ltrl = new Literal();
            ltrl.Text = "<div class=\"FieldStyle\">" + entity.Name + "</div><div class=\"ValueStyle\">";

            TextBox textBox = new TextBox();
            textBox.ID = "txtProfile" + entity.ProfileID.ToString();
            XmlNode node = QBXmlDataSource.GetXmlDocument().SelectSingleNode("//Messages/Message[@MsgKey='ProfileID" + entity.ProfileID.ToString() + "']");
            if (node != null)
            {
                textBox.Text = node.Attributes["MsgValue"].Value;
            }

            Literal newLine = new Literal();
            newLine.Text = "</div>";

            ControlPlaceHolder.Controls.Add(ltrl);
            ControlPlaceHolder.Controls.Add(textBox);
            ControlPlaceHolder.Controls.Add(newLine);
        }
    }
Example #3
0
    /// <summary>
    /// Bind fields for this Profile
    /// </summary>
    protected void BindData()
    {
        ProfileAdmin profileAdmin = new ProfileAdmin();
        ZNode.Libraries.DataAccess.Entities.Profile profile = profileAdmin.GetByProfileID(ItemID);

        if (profile != null)
        {
            ProfileName.Text = profile.Name;
            chkDefaultInd.Checked = profile.IsDefault;
            chkIsAnonymous.Checked = profile.IsAnonymous;
            chkShowPrice.Checked = profile.ShowPricing;
            chkShowOnPartner.Checked = profile.ShowOnPartnerSignup;
            if (profile.UseWholesalePricing.HasValue)
                chkUseWholesalePrice.Checked = profile.UseWholesalePricing.Value;

            chkTaxExempt.Checked = profile.TaxExempt;
            ExternalAccountNum.Text = profile.DefaultExternalAccountNo;

            // Set Page Title
            lblTitle.Text += profile.Name;
        }
        else
        {
            //throw error
        }
    }
    protected void btnDeleteUnusedAircraft_Click(object sender, EventArgs e)
    {
        int i = ProfileAdmin.DeleteUnusedAircraftForUser(Page.User.Identity.Name);

        lblDeleteErr.Text     = String.Format(CultureInfo.CurrentCulture, Resources.Profile.ProfileBulkDeleteAircraftDeleted, i);
        lblDeleteErr.CssClass = "success";
    }
 protected void btnDeleteFlights_Click(object sender, EventArgs e)
 {
     try
     {
         ProfileAdmin.DeleteFlightsForUser(Page.User.Identity.Name);
         lblDeleteFlightsCompleted.Visible = true;
     }
     catch (MyFlightbookException ex) { lblDeleteErr.Text = ex.Message; }
 }
 protected void btnCloseAccount_Click(object sender, EventArgs e)
 {
     try
     {
         ProfileAdmin.DeleteEntireUser(Page.User.Identity.Name);
         Response.Redirect("~");
     }
     catch (MyFlightbookException ex) { lblDeleteErr.Text = ex.Message; }
 }
Example #7
0
    /// <summary>
    /// Bind the data for a Product id
    /// </summary>
    public void BindData()
    {
        ProfileAdmin profileAdmin = new ProfileAdmin();
        Profile profileEntity = profileAdmin.GetByProfileID(ItemID);

        if (profileEntity != null)
        {
            ProfileName = profileEntity.Name;
        }
    }
Example #8
0
    /// <summary>
    /// Submit Button Click Event
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        ProfileAdmin profileAdmin = new ProfileAdmin();
        ZNode.Libraries.DataAccess.Entities.Profile profile = new Profile();

        if (ItemID > 0) //Edit Mode
        {
            //get profile by Id
            profile = profileAdmin.GetByProfileID(ItemID);
        }

        if (ExternalAccountNum.Text.Trim().Length > 0)
        {
            profile.DefaultExternalAccountNo = ExternalAccountNum.Text.Trim();
        }
        else if (ItemID > 0)
        {
            profile.DefaultExternalAccountNo = ExternalAccountNum.Text.Trim();
        }

        profile.Name = ProfileName.Text.Trim();
        profile.IsDefault = chkDefaultInd.Checked;
        profile.IsAnonymous = chkIsAnonymous.Checked;
        profile.ShowPricing = chkShowPrice.Checked;
        profile.ShowOnPartnerSignup = chkShowOnPartner.Checked;
        profile.UseWholesalePricing = chkUseWholesalePrice.Checked;
        profile.TaxExempt = chkTaxExempt.Checked;
        profile.PortalID = ZNode.Libraries.Framework.Business.ZNodeConfigManager.SiteConfig.PortalID;

        bool Status = false;

        if (ItemID > 0)
        {
            Status = profileAdmin.Update(profile);
        }
        else
        {
            Status = profileAdmin.Add(profile);
        }

        if (Status)
        {
            Response.Redirect(ListPageLink);
        }
        else
        {
            lblErrorMsg.Text = "Unable to update profile. Please try again.";
        }
    }
Example #9
0
 private void metroLabel6_Click(object sender, EventArgs e)
 {
     if (User.isAdmin)
     {
         ProfileAdmin form = new ProfileAdmin(this.StyleManager);
         form.User = User;
         form.ShowDialog();
     }
     else
     {
         Profile form = new Profile(this.StyleManager);
         form.User = User;
         form.ShowDialog();
     }
 }
    protected void btnDeleteFlights_Click(object sender, EventArgs e)
    {
        MembershipUser mu = Membership.GetUser(Page.User.Identity.Name, false);

        if (mu == null)
        {
            return;
        }
        try
        {
            ProfileAdmin.DeleteForUser(mu, ProfileAdmin.DeleteLevel.OnlyFlights);
            lblDeleteFlightsCompleted.Visible = true;
        }
        catch (MyFlightbookException ex) { lblDeleteErr.Text = ex.Message; }
    }
    protected void btnCloseAccount_Click(object sender, EventArgs e)
    {
        MembershipUser mu = Membership.GetUser(Page.User.Identity.Name, false);

        if (mu == null)
        {
            return;
        }
        try
        {
            ProfileAdmin.DeleteForUser(mu, ProfileAdmin.DeleteLevel.EntireUser);
            FormsAuthentication.SignOut();
            Response.Redirect("~");
        }
        catch (MyFlightbookException ex) { lblDeleteErr.Text = ex.Message; }
    }
Example #12
0
    /// <summary>
    /// User has been created - (a) sign them in, and (b) update their profile with the first/last name (if any) that they provided
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void UserCreated(object sender, EventArgs e)
    {
        string szUser = ((TextBox)CreateUserWizardStep1.ContentTemplateContainer.FindControl("UserName")).Text;

        FormsAuthentication.SetAuthCookie(szUser, false);

        // we send email from here rather than from the createuserwizard because for some reason createuserwizard isn't sending it.
        ProfileAdmin.FinalizeUser(szUser, ((TextBox)CreateUserWizardStep1.ContentTemplateContainer.FindControl("txtFirst")).Text, ((TextBox)CreateUserWizardStep1.ContentTemplateContainer.FindControl("txtLast")).Text, false);

        Response.Cookies[MFBConstants.keyNewUser].Value = true.ToString(System.Globalization.CultureInfo.InvariantCulture);

        // Redirect to the next page, but only if it is relative (for security)
        string szURLNext = util.GetStringParam(Request, "ReturnUrl");

        Response.Redirect(!String.IsNullOrEmpty(szURLNext) && Uri.IsWellFormedUriString(szURLNext, UriKind.Relative) ? szURLNext : "~/Member/LogbookNew.aspx");
    }
Example #13
0
    /// <summary>
    /// Gets the Name of the Profile for this ProfileID
    /// </summary>
    /// <param name="ProfileID"></param>
    /// <returns></returns>
    public string GetProfileName(object ProfileID)
    {
        ProfileAdmin AdminAccess = new ProfileAdmin();
        if (ProfileID == null)
        {
            return "All Profile";
        }
        else
        {
            Profile profile = AdminAccess.GetByProfileID(int.Parse(ProfileID.ToString()));

            if (profile != null)
            {
                return profile.Name;
            }
        }
        return "";
    }
Example #14
0
    /// <summary>
    /// Bind List controls 
    /// </summary>
    public void BindData()
    {
        // Bind DiscountTypes
        ZNode.Libraries.Admin.PromotionAdmin Discountname = new ZNode.Libraries.Admin.PromotionAdmin();
        DiscountType.DataSource = Discountname.GetAllDiscountTypes();
        DiscountType.DataTextField = "Name";
        DiscountType.DataValueField = "ClassName";
        DiscountType.DataBind();

        ProfileAdmin profileAdmin = new ProfileAdmin();
        ddlProfileTypes.DataSource = profileAdmin.GetAll();
        ddlProfileTypes.DataTextField = "Name";
        ddlProfileTypes.DataValueField = "ProfileID";
        ddlProfileTypes.DataBind();

        ListItem li = new ListItem("All Profiles", "0");
        ddlProfileTypes.Items.Insert(0, li);
        ddlProfileTypes.SelectedValue = "0";
    }
    /// <summary>
    /// Binds Profile dropdown list
    /// </summary>
    private void Bind()
    {
        ProfileAdmin profileAdmin = new ProfileAdmin();
        ddlProfiles.DataSource = profileAdmin.GetAll();
        ddlProfiles.DataTextField = "Name";
        ddlProfiles.DataValueField = "ProfileId";
        ddlProfiles.DataBind();

        ListItem li = new ListItem("Apply to All Profiles", "0");
        ddlProfiles.Items.Insert(0,li);
    }
Example #16
0
    /// <summary>
    /// 
    /// </summary>
    protected void BindData()
    {
        AccountAdmin accountAdmin = new AccountAdmin();
        AccountTypeAdmin accountTypeAdmin = new AccountTypeAdmin();
        ProfileAdmin profileAdmin = new ProfileAdmin();
        CustomerAdmin customerAdmin = new CustomerAdmin();
        ReferralCommissionAdmin referralCommissionAdmin = new ReferralCommissionAdmin();

        ZNode.Libraries.DataAccess.Entities.Account account = accountAdmin.GetByAccountID(AccountID);

        if (account != null)
        {
            // General Information
            lblAccountID.Text = account.AccountID.ToString();
            lblCompanyName.Text = account.BillingCompanyName;
            lblExternalAccNumber.Text = account.ExternalAccountNo;
            lblDescription.Text = account.Description;
            lblLoginName.Text = customerAdmin.GetByUserID(int.Parse(AccountID.ToString()));
            lblCustomerDetails.Text = account.AccountID.ToString() + " - " + account.BillingFirstName + " " + account.BillingLastName;
            lblWebSite.Text = account.Website;
            lblSource.Text = account.Source;
            lblCreatedDate.Text = account.CreateDte.ToShortDateString();
            lblCreatedUser.Text = account.CreateUser;

            // Referral Detail

            // Get Referral Type Name for a Account
            if (account.ReferralCommissionTypeID != null)
            {
                ReferralCommissionType referralType = referralCommissionAdmin.GetByReferralID(int.Parse(account.ReferralCommissionTypeID.ToString()));
                lblReferralType.Text = referralType.Name;
            }
            else
            {
                lblReferralType.Text = "";
            }

            if (account.ReferralStatus == "A")
            {
                string affiliateLink = "http://" + ZNodeConfigManager.SiteConfig.DomainName + "/default.aspx?affiliate_id=" + account.AccountID;
                hlAffiliateLink.Text = affiliateLink;
                hlAffiliateLink.NavigateUrl = affiliateLink;
            }
            else
            {
                hlAffiliateLink.Text = "NA";
            }

            if (account.ReferralCommission != null)
            {
                if (account.ReferralCommissionTypeID == 1)
                {
                    lblReferralCommission.Text = account.ReferralCommission.Value.ToString("N");
                }
                else
                {
                    lblReferralCommission.Text = account.ReferralCommission.Value.ToString("c");
                }
            }
            else
            {
                lblReferralCommission.Text = "";
            }

            lblTaxId.Text = account.TaxID;

            if (account.ReferralStatus != null)
            {
                //Getting the Status Description
                Array values = Enum.GetValues(typeof(ZNodeApprovalStatus.ApprovalStatus));
                Array names=Enum.GetNames(typeof(ZNodeApprovalStatus.ApprovalStatus));
                for (int i = 0; i < names.Length; i++)
                {
                    if (names.GetValue(i).ToString() == account.ReferralStatus)
                    {
                        lblReferralStatus.Text = ZNodeApprovalStatus.GetEnumValue(values.GetValue(i));
                        break;
                    }
                }

                BindPayments(accountAdmin);
            }
            else
            {
                pnlAffiliatePayment.Visible = false;
                lblReferralStatus.Text = "";
            }

            if (account.UpdateDte != null)
            {
                lblUpdatedDate.Text = account.UpdateDte.Value.ToShortDateString();
            }

            // Email Opt-In
            if (account.EmailOptIn)
            {
                EmailOptin.Src = ZNode.Libraries.Framework.Business.ZNodeHelper.GetCheckMark(true);
            }
            else
            {
                EmailOptin.Src = ZNode.Libraries.Framework.Business.ZNodeHelper.GetCheckMark(false);
            }

            lblUpdatedUser.Text = account.UpdateUser;
            lblCustom1.Text = account.Custom1;
            lblCustom2.Text = account.Custom2;
            lblCustom3.Text = account.Custom3;

            // Get Profile Type Name for a Account
            Profile _profileList = profileAdmin.GetByProfileID(int.Parse(account.ProfileID.ToString()));
            lblProfileTypeName.Text = _profileList.Name;

            // Address Information

            ZNodeAddress AddressFormat = new ZNodeAddress();

            // Format Billing Address
            AddressFormat.FirstName = string.IsNullOrEmpty(account.BillingFirstName) ? string.Empty : account.BillingFirstName;
            AddressFormat.LastName = string.IsNullOrEmpty(account.BillingLastName) ? string.Empty : account.BillingLastName;
            AddressFormat.CompanyName = string.IsNullOrEmpty(account.BillingCompanyName) ? string.Empty : account.BillingCompanyName;
            AddressFormat.Street1 = string.IsNullOrEmpty(account.BillingStreet) ? string.Empty : account.BillingStreet;
            AddressFormat.Street2 = string.IsNullOrEmpty(account.BillingStreet1) ? string.Empty : account.BillingStreet1;
            AddressFormat.City = string.IsNullOrEmpty(account.BillingCity) ? string.Empty : account.BillingCity;
            AddressFormat.StateCode = string.IsNullOrEmpty(account.BillingStateCode) ? string.Empty : account.BillingStateCode;
            AddressFormat.PostalCode = string.IsNullOrEmpty(account.BillingPostalCode) ? string.Empty : account.BillingPostalCode;
            AddressFormat.CountryCode = string.IsNullOrEmpty(account.BillingCountryCode) ? string.Empty : account.BillingCountryCode;
            lblBillingAddress.Text = AddressFormat.ToString() + "Tel: " + account.BillingPhoneNumber + "<br>Email: " + account.BillingEmailID;

            // Format Shipping Address
            AddressFormat.FirstName = string.IsNullOrEmpty(account.ShipFirstName) ? string.Empty : account.BillingFirstName;
            AddressFormat.LastName = string.IsNullOrEmpty(account.ShipLastName) ? string.Empty : account.ShipLastName;
            AddressFormat.CompanyName = string.IsNullOrEmpty(account.ShipCompanyName) ? string.Empty : account.ShipCompanyName;
            AddressFormat.Street1 = string.IsNullOrEmpty(account.ShipStreet) ? string.Empty : account.ShipStreet;
            AddressFormat.Street2 = string.IsNullOrEmpty(account.ShipStreet1) ? string.Empty : account.ShipStreet1;
            AddressFormat.City = string.IsNullOrEmpty(account.ShipCity) ? string.Empty : account.ShipCity;
            AddressFormat.StateCode = string.IsNullOrEmpty(account.ShipStateCode) ? string.Empty : account.ShipStateCode;
            AddressFormat.PostalCode = string.IsNullOrEmpty(account.ShipPostalCode) ? string.Empty : account.ShipPostalCode;
            AddressFormat.CountryCode = string.IsNullOrEmpty(account.ShipCountryCode) ? string.Empty : account.ShipCountryCode;
            lblShippingAddress.Text = AddressFormat.ToString() + "Tel: " + account.ShipPhoneNumber + "<br>Email: " + account.ShipEmailID;

            //To get Amount owed
            AccountHelper helperAccess = new AccountHelper();
            DataSet myDataSet = helperAccess.GetCommisionAmount(ZNodeConfigManager.SiteConfig.PortalID, account.AccountID.ToString());

            lblAmountOwed.Text = "$" + myDataSet.Tables[0].Rows[0]["CommissionOwed"].ToString();

            // Orders Grid
            this.BindGrid();

            // Retrieves the Role for User using Userid
            if (account.UserID != null)
            {
                 Guid UserKey = new Guid();
                 UserKey = account.UserID.Value;
                 MembershipUser _user = Membership.GetUser(UserKey);
                 string roleList = "";

                //Get roles for this User account
                string[] roles = Roles.GetRolesForUser(_user.UserName);

                foreach (string Role in roles)
                {
                    roleList += Role + "<br>";
                }
                lblRoles.Text = roleList;

                string rolename = roleList;

                //Hide the Edit button if a NonAdmin user has entered this page
                if(!Roles.IsUserInRole("ADMIN"))
                {
                    if (Roles.IsUserInRole(_user.UserName, "ADMIN"))
                    {
                        EditCustomer.Visible = false;
                    }
                    else if (Roles.IsUserInRole(HttpContext.Current.User.Identity.Name, "CUSTOMER SERVICE REP"))
                    {
                        if (rolename == Convert.ToString("USER<br>") || rolename == Convert.ToString(""))
                        {
                            EditCustomer.Visible = true;
                        }
                        else
                        {
                            EditCustomer.Visible = false;
                        }
                    }
                }
            }
        }
    }
Example #17
0
 /// <summary>
 /// Binds Account Type drop-down list
 /// </summary>
 private void BindProfile()
 {
     ZNode.Libraries.Admin.ProfileAdmin _Profileadmin = new ProfileAdmin();
     ListProfileType.DataSource = _Profileadmin.GetAll();
     ListProfileType.DataTextField = "name";
     ListProfileType.DataValueField = "profileID";
     ListProfileType.DataBind();
 }
Example #18
0
    protected void gvUsers_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        MembershipUser mu = Membership.GetUser(e.CommandArgument, false);

        if (mu == null)
        {
            return;
        }

        lblResetErr.Text = "";

        string szUser = mu.UserName;

        if (!ProfileAdmin.ValidateUser(szUser))
        {
            return;
        }

        // SendMessage is available for any valid user; other commands are not valid for the current admin
        if (e.CommandName.CompareTo("SendMessage") == 0)
        {
            pnlSendEmail.Visible = true;
            lblRecipient.Text    = mu.UserName;
            return;
        }

        if (String.Compare(szUser, Page.User.Identity.Name, true) == 0)
        {
            return;
        }

        if (e.CommandName.CompareTo("Impersonate") == 0)
        {
            ProfileRoles.ImpersonateUser(Page.User.Identity.Name, szUser);
            Response.Redirect("~/Member/LogbookNew.aspx");
        }
        else if (e.CommandName.CompareTo("ResetPassword") == 0)
        {
            // Need to get the user offline
            mu = ProfileAdmin.ADMINUserFromName(szUser);
            if (mu == null)
            {
                lblResetErr.Text = String.Format("User '{0}' not found", szUser);
            }
            else
            {
                string szPass = mu.ResetPassword();
                lblResetErr.Text       = szPass;
                lblPwdUsername.Text    = szUser;
                btnSendInEmail.Visible = true;
            }
        }
        else if (e.CommandName.CompareTo("DeleteUser") == 0)
        {
            try
            {
                ProfileAdmin.DeleteForUser(mu, MyFlightbook.ProfileAdmin.DeleteLevel.EntireUser);
                lblResetErr.Text = String.Format("User {0} ({1}) successfully deleted.", mu.UserName, mu.Email);
            }
            catch (Exception ex) { lblResetErr.Text = ex.Message; }
        }
        else if (e.CommandName.CompareTo("DeleteFlightsForUser") == 0)
        {
            try
            {
                ProfileAdmin.DeleteForUser(mu, MyFlightbook.ProfileAdmin.DeleteLevel.OnlyFlights);
                lblResetErr.Text = String.Format("Flights for User {0} ({1}) successfully deleted.", mu.UserName, mu.Email);
            }
            catch (Exception ex) { lblResetErr.Text = ex.Message; }
        }
        else if (e.CommandName.CompareTo("EndowClub") == 0)
        {
            DBHelper dbh = new DBHelper();
            dbh.DoNonQuery("INSERT INTO earnedgratuities SET idgratuitytype=3, username=?szUser, dateEarned=Now(), dateExpired=Date_Add(Now(), interval 30 day), reminderssent=0, dateLastReminder='0001-01-01 00:00:00'", (comm) => { comm.Parameters.AddWithValue("szUser", mu.UserName); });
        }
    }
 public ProfileController(ProfileAdmin profileAdmin)
 {
     _profileAdmin = profileAdmin;
 }
Example #20
0
    /// <summary>
    /// Binds Account Type drop-down list
    /// </summary>
    private void BindProfile()
    {
        ZNode.Libraries.Admin.ProfileAdmin _Profileadmin = new ProfileAdmin();
        ListProfileType.DataSource = _Profileadmin.GetAll();
        ListProfileType.DataTextField = "name";
        ListProfileType.DataValueField = "profileID";
        ListProfileType.DataBind();

        if (AccountID == 0)
        {
            ProfileAdmin AdminAccess = new ProfileAdmin();
            Profile entity = AdminAccess.GetByProfileID(int.Parse(ListProfileType.SelectedValue));

            if (entity != null)
            { txtExternalAccNumber.Text = entity.DefaultExternalAccountNo; }
        }
    }
Example #21
0
 /// <summary>
 /// Bind Grid
 /// </summary>
 protected void Bind()
 {
     ProfileAdmin profileAdmin = new ProfileAdmin();
     uxGrid.DataSource = profileAdmin.GetAll();
     uxGrid.DataBind();
 }
Example #22
0
    /// <summary>
    /// Event is raised when the selection from the profile type list control changes between posts to the server
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void ListProfileType_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (AccountID == 0)
        {
            ProfileAdmin AdminAccess = new ProfileAdmin();
            Profile entity = AdminAccess.GetByProfileID(int.Parse(ListProfileType.SelectedValue));

            if (entity != null)
                txtExternalAccNumber.Text = entity.DefaultExternalAccountNo;
        }
    }
    protected void gvUsers_RowCommand(object sender, CommandEventArgs e)
    {
        if (e == null)
        {
            throw new ArgumentNullException(nameof(e));
        }
        MembershipUser mu = Membership.GetUser(e.CommandArgument, false);

        if (mu == null)
        {
            return;
        }

        lblResetErr.Text = "";

        string szUser = mu.UserName;

        if (!ProfileAdmin.ValidateUser(szUser))
        {
            return;
        }

        // SendMessage is available for any valid user; other commands are not valid for the current admin
        if (e.CommandName.CompareOrdinalIgnoreCase("SendMessage") == 0)
        {
            pnlSendEmail.Visible = true;
            lblRecipient.Text    = HttpUtility.HtmlEncode(mu.UserName);
            return;
        }

        if (String.Compare(szUser, Page.User.Identity.Name, StringComparison.InvariantCultureIgnoreCase) == 0)
        {
            return;
        }

        if (e.CommandName.CompareOrdinalIgnoreCase("Impersonate") == 0)
        {
            ProfileRoles.ImpersonateUser(Page.User.Identity.Name, szUser);
            Response.Redirect("~/Member/LogbookNew.aspx");
        }
        else if (e.CommandName.CompareOrdinalIgnoreCase("ResetPassword") == 0)
        {
            // Need to get the user offline
            mu = ProfileAdmin.ADMINUserFromName(szUser);
            if (mu == null)
            {
                lblResetErr.Text = HttpUtility.HtmlEncode(String.Format(CultureInfo.CurrentCulture, "User '{0}' not found", szUser));
            }
            else
            {
                string szPass = mu.ResetPassword();
#pragma warning disable CA3002 // Watch out for injection
                lblResetErr.Text    = szPass;
                lblPwdUsername.Text = szUser;
#pragma warning restore CA3002 // Watch out for injection
                btnSendInEmail.Visible = true;
            }
        }
        else if (e.CommandName.CompareOrdinalIgnoreCase("DeleteUser") == 0)
        {
            try
            {
                ProfileAdmin.DeleteForUser(mu, MyFlightbook.ProfileAdmin.DeleteLevel.EntireUser);
                lblResetErr.Text = HttpUtility.HtmlEncode(String.Format(CultureInfo.CurrentCulture, "User {0} ({1}) successfully deleted.", mu.UserName, mu.Email));
            }
            catch (Exception ex) when(!(ex is OutOfMemoryException))
            {
                lblResetErr.Text = ex.Message;
            }
        }
        else if (e.CommandName.CompareOrdinalIgnoreCase("DeleteFlightsForUser") == 0)
        {
            try
            {
                ProfileAdmin.DeleteForUser(mu, MyFlightbook.ProfileAdmin.DeleteLevel.OnlyFlights);
                lblResetErr.Text = HttpUtility.HtmlEncode(String.Format(CultureInfo.CurrentCulture, "Flights for User {0} ({1}) successfully deleted.", mu.UserName, mu.Email));
            }
            catch (Exception ex) when(!(ex is OutOfMemoryException))
            {
                lblResetErr.Text = ex.Message;
            }
        }
        else if (e.CommandName.CompareOrdinalIgnoreCase("EndowClub") == 0)
        {
            DBHelper dbh = new DBHelper();
            dbh.DoNonQuery("INSERT INTO earnedgratuities SET idgratuitytype=3, username=?szUser, dateEarned=Now(), dateExpired=Date_Add(Now(), interval 30 day), reminderssent=0, dateLastReminder='0001-01-01 00:00:00'", (comm) => { comm.Parameters.AddWithValue("szUser", mu.UserName); });
        }
        else if (e.CommandName.CompareCurrentCultureIgnoreCase("Disable2FA") == 0)
        {
            Profile pf = Profile.GetUser(szUser);
            if (pf.PreferenceExists(MFBConstants.keyTFASettings))
            {
                pf.SetPreferenceForKey(MFBConstants.keyTFASettings, null, true);
                lblResetErr.Text = "2fa turned off for user " + HttpUtility.HtmlEncode(szUser);
            }
            else
            {
                lblResetErr.Text = "2fa was not on for user " + HttpUtility.HtmlEncode(szUser);
            }
        }
    }
Example #24
0
    /// <summary>
    /// Page Load Event
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>    
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.Params["filter"] != null)
        {
            Mode = Request.Params["filter"];
        }

        if (!Page.IsPostBack)
        {
            // Load Order State Item
            OrderAdmin _OrderAdminAccess = new OrderAdmin();
            ddlOrderStatus.DataSource = _OrderAdminAccess.GetAllOrderStates();
            ddlOrderStatus.DataTextField = "orderstatename";
            ddlOrderStatus.DataValueField = "Orderstateid";
            ddlOrderStatus.DataBind();
            ListItem item1 = new ListItem("ALL", "0");
            ddlOrderStatus.Items.Insert(0, item1);
            ddlOrderStatus.SelectedIndex = 0;

            // Load Profile Types
            ProfileAdmin profileAdmin = new ProfileAdmin();
            ddlProfilename.DataSource = profileAdmin.GetAll();
            ddlProfilename.DataTextField = "Name";
            ddlProfilename.DataValueField = "ProfileID";
            ddlProfilename.DataBind();
            ListItem item2 = new ListItem("ALL", "0");
            ddlProfilename.Items.Insert(0, item2);
            ddlProfilename.SelectedIndex = 0;

            // Get Filetered Orders in DataSet
            OrderAdmin _OrderAdmin = new OrderAdmin();
            dsOrders = _OrderAdmin.ReportList(Mode, Year, "");
            dsOrdersLineItems = _OrderAdmin.GetAllOrderLineItems().ToDataSet(false);
            DataView dv = new DataView(dsOrders.Tables[0]);

            if (Request.Params["filter"] != null)
            {
                if (Mode.Equals("12"))
                {
                    this.objReportViewer.LocalReport.ReportPath = "Admin/Secure/Reports/Orders.rdlc";
                    pnlOrderStatus.Visible = true;
                    lblOrderStatus.Visible = true;
                    lblOrderStatus.Text = "Order Status";
                    btnOrderFilter.Text = "Get Orders";
                }
                if (Mode.Equals("21"))
                {
                    this.objReportViewer.LocalReport.ReportPath = "Admin/Secure/Reports/Accounts.rdlc";
                    pnlprofile.Visible = true;
                    lblProfileName.Visible = true;
                    lblProfileName.Text = "Profiles";
                    btnOrderFilter.Text = "Get Details";
                }
            }

            if (dv.ToTable().Rows.Count == 0)
            {
                lblErrorMsg.Text = "No records found";
                objReportViewer.Visible = false;
                pnlCustom.Visible = false;
                return;
            }

            objReportViewer.LocalReport.DataSources.Clear();
            ReportParameter param1 = new ReportParameter("CurrentLanguage", System.Globalization.CultureInfo.CurrentCulture.Name);
            objReportViewer.LocalReport.SetParameters(new ReportParameter[] { param1 });
            this.objReportViewer.LocalReport.SubreportProcessing += new SubreportProcessingEventHandler(LocalReport_SubreportProcessing);
            if (Mode.Equals("12"))
                objReportViewer.LocalReport.DataSources.Add(new ReportDataSource("ZNodeOrderDataSet_ZNodeOrder", dv));
            else if(Mode.Equals("21"))
                objReportViewer.LocalReport.DataSources.Add(new ReportDataSource("ZNodeAccountDataSet_ZNodeAccount", dv));
            objReportViewer.LocalReport.Refresh();
        }
    }
Example #25
0
    /// <summary>
    /// Submit Button click event
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        QBXmlDataSource.GetXmlDocument().SelectSingleNode("//Messages/Message[@MsgKey='SalesTaxItem']").Attributes["MsgValue"].Value = txtTaxItem.Text;
        QBXmlDataSource.GetXmlDocument().SelectSingleNode("//Messages/Message[@MsgKey='DiscountItemName']").Attributes["MsgValue"].Value = txtDiscountItem.Text;
        QBXmlDataSource.GetXmlDocument().SelectSingleNode("//Messages/Message[@MsgKey='ShippingItemName']").Attributes["MsgValue"].Value = txtShippingItem.Text;
        QBXmlDataSource.GetXmlDocument().SelectSingleNode("//Messages/Message[@MsgKey='SalesIncomeAccount']").Attributes["MsgValue"].Value = txtIncomeAccount.Text;
        QBXmlDataSource.GetXmlDocument().SelectSingleNode("//Messages/Message[@MsgKey='CostofGoodsSoldAccount']").Attributes["MsgValue"].Value = txtCOGSAccount.Text;
        QBXmlDataSource.GetXmlDocument().SelectSingleNode("//Messages/Message[@MsgKey='InventoryAssetAccount']").Attributes["MsgValue"].Value = txtAssetAccount.Text;
        QBXmlDataSource.GetXmlDocument().SelectSingleNode("//Messages/Message[@MsgKey='SalesReceiptMessage']").Attributes["MsgValue"].Value = txtSalesCustomerMessage.Text;
        QBXmlDataSource.GetXmlDocument().SelectSingleNode("//Messages/Message[@MsgKey='CompanyFilePath']").Attributes["MsgValue"].Value = txtCompanyFile.Text.Trim();
        QBXmlDataSource.GetXmlDocument().SelectSingleNode("//Messages/Message[@MsgKey='OrdersDownloadType']").Attributes["MsgValue"].Value = lstorderDownloadType.SelectedValue;

        ProfileAdmin profileAdmin = new ProfileAdmin();
        TList<Profile> profileList = profileAdmin.GetAll();

        foreach (Profile entity in profileList)
        {
            TextBox txt = (TextBox)ControlPlaceHolder.FindControl("txtProfile" + entity.ProfileID.ToString());

             XmlNode node = QBXmlDataSource.GetXmlDocument().SelectSingleNode("//Messages/Message[@MsgKey='ProfileID" + entity.ProfileID.ToString() + "']");
             if (node != null)
             {
                 node.Attributes["MsgValue"].Value = txt.Text.Trim();
             }
             else
             {

                 XmlElement element = QBXmlDataSource.GetXmlDocument().CreateElement("Message");
                 element.SetAttribute("MsgKey", "ProfileID" + entity.ProfileID.ToString());
                 element.SetAttribute("MsgDescription", "");
                 element.SetAttribute("MsgValue", txt.Text.Trim());

                 QBXmlDataSource.GetXmlDocument().SelectSingleNode("//Messages").AppendChild(element);
             }
        }

        try
        {
            QBXmlDataSource.Save();
        }
        catch
        {
            //display error message
            lblMsg.Text = "An error occurred while updating. Please try again.";
        }

        Response.Redirect("~/admin/secure/settings/default.aspx?mode=quickbooks");
    }