Beispiel #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Util.AlignRadDatePicker(dp_start_date);
            Util.AlignRadDatePicker(dp_end_date);
            Security.BindPageValidatorExpressions(this);
            if (Util.IsBrowser(this, "IE"))
            {
                rfd.Visible = false;
            }

            if (Request.QueryString["off"] != null && !String.IsNullOrEmpty(Request.QueryString["off"]))
            {
                hf_office.Value = Request.QueryString["off"];
                Util.MakeCountryDropDown(dd_country);
                BindReps();

                String CompanyID = CompanyManager.AddTemporaryCompany("Media Sales");
                ContactManager.CompanyID = CompanyID;
                ContactManager.BindContacts(CompanyID);
            }
            else
            {
                Util.PageMessage(this, "There was an error getting the office information, please close and reload this window.");
            }
        }
    }
    protected void ToggleCompanySearchMode(object sender, EventArgs e)
    {
        bool Searching = !btn_toggle_new_or_search.Text.Contains("New");

        div_company.Visible = div_contacts.Visible = false;

        rcb_search.Visible         = Searching;
        tbl_add_lead.Visible       = !Searching;
        btn_update_company.Visible = Searching;

        CompanyManager.Reset();
        ContactManager.Reset();

        if (!Searching)
        {
            lbl_toggle_new_or_search.Text = "Looking for a company?";
            btn_toggle_new_or_search.Text = "Search for Company";
            btn_toggle_new_or_search.Icon.PrimaryIconUrl = "~/images/leads/ico_search.png";
            lbl_new_or_search.Text = "Add a new company and contacts...";

            String CompanyID = CompanyManager.AddTemporaryCompany("Lead");
            ContactManager.CompanyID = CompanyID;

            hf_clicked_company_id.Value    = CompanyID;
            CompanyManager.CountryRequired = false;
            BindCompanyAndContacts(null, null);
            CompanyManager.CountryRequired = true;
        }
        else
        {
            lbl_toggle_new_or_search.Text = "Can't find a company?";
            btn_toggle_new_or_search.Text = "Add a New Company";
            btn_toggle_new_or_search.Icon.PrimaryIconUrl = "~/images/leads/ico_add.png";
            lbl_new_or_search.Text = "Search for a company or add a new one to create <b>Leads</b>..";
        }

        ScriptManager.RegisterStartupScript(this, this.GetType(), "Resize", "rw = GetRadWindow(); rw.autoSize(); rw.center();", true);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Security.BindPageValidatorExpressions(this);
            if (!Util.IsBrowser(this, "IE"))
            {
                tbl.Style.Add("position", "relative; top:10px; left:8px;");
            }
            else
            {
                rfd.Visible = false;
            }

            if (Request.QueryString["bid"] != null && !String.IsNullOrEmpty(Request.QueryString["bid"]) &&
                Request.QueryString["rows"] != null && !String.IsNullOrEmpty(Request.QueryString["rows"]) &&
                Request.QueryString["totr"] != null && !String.IsNullOrEmpty(Request.QueryString["totr"]) &&
                Request.QueryString["end_d"] != null && !String.IsNullOrEmpty(Request.QueryString["end_d"]) &&
                Request.QueryString["off"] != null && !String.IsNullOrEmpty(Request.QueryString["off"]))
            {
                hf_book_id.Value       = Request.QueryString["bid"];
                hf_grid_rows.Value     = Request.QueryString["rows"];
                hf_total_revenue.Value = Request.QueryString["totr"];
                hf_book_end_date.Value = Request.QueryString["end_d"];
                hf_office.Value        = Request.QueryString["off"];

                String qry = "SELECT IssueName FROM db_salesbookhead WHERE SalesBookID=@sb_id";
                hf_book_name.Value = SQL.SelectString(qry, "IssueName", "@sb_id", hf_book_id.Value);

                hf_total_ads.Value = Request.QueryString["tota"];
                if (hf_total_ads.Value == String.Empty)
                {
                    hf_total_ads.Value = "0";
                }

                SetFeatures();
                SetMagazines();
                SetFriendlynames();
                Util.MakeCountryDropDown(dd_new_country);

                bool is_uk = Util.IsOfficeUK(hf_office.Value);
                tr_magazine_note.Visible = rfv_magazine_note.Enabled = is_uk;

                if (is_uk || hf_office.Value == "ANZ")
                {
                    tr_conversion.Visible = true;

                    if (hf_office.Value != "ANZ")
                    {
                        cb_to_details.Checked  = true; // Only show details sheet after add for UK
                        tb_new_conversion.Text = String.Empty;
                    }
                    else
                    {
                        tb_new_conversion.ReadOnly  = true;
                        tb_new_conversion.BackColor = Color.LightGray;
                    }
                }

                String CompanyID = CompanyManager.AddTemporaryCompany("SB Advertiser");
                ContactManager.CompanyID = CompanyID;
                ContactManager.BindContacts(CompanyID);
            }
            else
            {
                Util.PageMessage(this, "There was a problem getting the book issue information. Please close this window and retry.");
            }
        }
    }