Exemple #1
0
    protected override void Page_Load(object sender, System.EventArgs e)
    {
        try
        {
            base.Page_Load(sender, e);
            if (!Utilities.ValidateUserLogin())
            {
                return;
            }

            if (!Ektron.Cms.DataIO.LicenseManager.LicenseManager.IsFeatureEnable(m_refContentApi.RequestInformationRef, Ektron.Cms.DataIO.LicenseManager.Feature.eCommerce))
            {
                throw (new Exception(GetMessage("feature locked error")));
            }
            dg_orders.Columns[0].HeaderText = this.GetMessage("generic id");
            dg_orders.Columns[1].HeaderText = this.GetMessage("lbl attr date");
            dg_orders.Columns[2].HeaderText = this.GetMessage("lbl site");
            dg_orders.Columns[3].HeaderText = this.GetMessage("lbl search status");
            dg_orders.Columns[4].HeaderText = this.GetMessage("lbl customer");
            dg_orders.Columns[5].HeaderText = this.GetMessage("lbl order value");
            orderApi = new OrderApi();
            defaultCurrency = (new CurrencyApi()).GetItem(m_refContentApi.RequestInformationRef.CommerceSettings.DefaultCurrencyId);
            CustomerManager = new Customer(m_refContentApi.RequestInformationRef);
            Util_CheckAccess();
            Util_RegisterResources();
            Util_SetServerJSVariable();
            switch (this.m_sPageAction)
            {

                //case "editaddress":

                //    if (Request.QueryString["addressType"] != "")
                //    {
                //        addressType = Request.QueryString["addressType"];
                //    }

                //    RegionManager = new RegionApi();
                //    CountryManager = new CountryApi();

                //    if (Page.IsPostBack && isCPostData.Value == "")
                //    {
                //        Process_EditAddress();
                //    }
                //    else
                //    {
                //        Display_ViewAddress(true);
                //    }
                //   break;

                case "vieworder":
                    if (Page.IsPostBack && Request.Form["hdn_code"] == "2")
                    {
                        Process_Capture();
                    }
                    else if (Page.IsPostBack && Request.Form["hdn_code"] == "3")
                    {
                        Process_Fraud();
                    }
                    else if (Page.IsPostBack && Request.Form["hdn_code"] == "4")
                    {
                        Process_CancelOrder();
                    }
                    else if (Page.IsPostBack && Request.Form["hdn_code"] == "5")
                    {

                        Process_CallOrderEvent();

                    }
                    else
                    {
                        Display_ViewOrder(null);
                    }
                    break;
                case "showpayment":

                    if (Page.IsPostBack && Request.Form["hdn_code"] == "2")
                    {

                        Process_Capture();

                    }
                    else if (Page.IsPostBack && Request.Form["hdn_code"] == "7")
                    {

                        Process_CaptureAndSettle();

                    }
                    else if (Page.IsPostBack && Request.Form["hdn_code"] == "8")
                    {

                        Process_Settle();

                    }
                    else
                    {

                        Display_ViewPayment();

                    }
                    break;

                case "editnotes":

                    if (Page.IsPostBack && Request.Form["hdn_code"] == "6")
                    {
                        Process_EditNotes();
                    }
                    else
                    {
                        Display_ViewNotes();
                    }
                    break;

                case "trackingnumber":
                    if (Page.IsPostBack)
                    {
                        Process_TrackingNumber();
                    }
                    else
                    {
                        Display_TrackingNumber();
                    }
                    break;
                case "mostrecent":
                    if (Page.IsPostBack == false)
                    {
                        Display_MostRecent();
                    }
                    break;
                case "bydates":
                    if (Page.IsPostBack == false)
                    {
                        Display_ByDates();
                    }
                    break;
                case "byproduct":
                    if (Page.IsPostBack == false)
                    {
                        Display_ByProduct();
                    }
                    break;
                case "bycustomer":
                    if (Page.IsPostBack == false)
                    {
                        Display_ByCustomer();
                    }
                    break;
                case "custom":
                    Display_ViewCustom();
                    break;
                case "onhold":
                    if (Page.IsPostBack == false)
                    {
                        Display_ViewOnHold();
                    }
                    break;
                case "delete":
                    if (Page.IsPostBack == false)
                    {
                        if (bCommerceAdmin)
                        {
                            if (!string.IsNullOrEmpty(Request.QueryString["orderid"])
                                && Convert.ToInt64(Request.QueryString["orderid"]) > 0)
                            {
                              orderApi.DeleteOrder(Convert.ToInt64(Request.QueryString["orderid"]));
                              Display_ViewAll();
                            }

                        }
                        else
                        {
                            throw (new Exception(GetMessage("err not role commerce-admin")));
                        }
                    }
                    break;
                default: // "viewall"
                    if (Page.IsPostBack == false)
                    {
                        Display_ViewAll();
                    }
                    break;
            }
            Util_SetLabels();
            Util_SetJS();

        }
        catch (Exception ex)
        {

            Utilities.ShowError(ex.Message);

        }
    }