コード例 #1
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                if (Request["filter"] != null)
                {
                    txtFilter.Text = Request["filter"].ToString();
                }
                QDEUtils.GetItemIdFromRequest();
                item = SessionState.CurrentItem;
            }
            catch
            {
                UITools.JsCloseWin();
            }

            try
            {
                culture = QDEUtils.UpdateCultureCodeFromRequest();
                if (!Page.IsPostBack)
                {
                    UpdateDataView();
                }
            }
            finally
            {
                culture.Dispose();
            }
        }
コード例 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (SessionState.User.IsReadOnly)
            {
                uwToolbar.Items.FromKeyButton("Save").Enabled =
                    wdcAnnouncementDate.Enabled       = wdcBlindDate.Enabled = wdcPID.Enabled = wdcObsoleteDate.Enabled =
                        wdcRemovalDate.Enabled        = cbAnnL.Enabled = cbBlindL.Enabled = cbObsoL.Enabled =
                            cbPIDL.Enabled            = cbRemovL.Enabled = cboxPID.Enabled = cboxRemovalDate.Enabled =
                                cboxBlindDate.Enabled = cboxAnnouncementDate.Enabled = cboxObsoleteDate.Enabled = false;
            }

            Culture c = null;

            try
            {
                using (Item item = QDEUtils.GetItemIdFromRequest())
                {
                    if (!SessionState.User.HasItemInScope(item.Id))
                    {
                        UITools.HideToolBarButton(uwToolbar, "Save");
                        UITools.HideToolBarSeparator(uwToolbar, "SaveSep");
                    }
                    else
                    {
                        UITools.ShowToolBarButton(uwToolbar, "Save");
                        UITools.ShowToolBarSeparator(uwToolbar, "SaveSep");
                    }

                    itemId      = item.Id;
                    curSku      = item.Sku;
                    curItemType = item.TypeId;
                    int PLCUserId = PLC.PLCUser(itemId);
                    if (Request["co"] != null)
                    {
                        // Country code is passed directly
                        using (CultureList cul = HyperCatalog.Business.Culture.GetAll("CountryCode = '" + Request["co"].ToString() + "'"))
                        {
                            if (cul.Count > 0)
                            {
                                c = cul[0];
                            }
                            else
                            {
                                UITools.FrameAlertAndBack("Invalid Country Code [" + Request["co"].ToString() + "'");
                            }
                        }
                    }
                    else
                    {
                        c = QDEUtils.UpdateCultureCodeFromRequest();
                    }
                    curLanguageCode = c.LanguageCode;
                    curCountryCode  = c.CountryCode;
                    if (Request["dg"] != null)
                    {
                        Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "InitVarNames",
                                                                    "<script>dg = '" + Request["dg"].ToString() + "';" + Environment.NewLine +
                                                                    "col = " + Request["col"].ToString() + ";" + Environment.NewLine +
                                                                    "row = " + Request["row"].ToString() + ";</script>");
                    }
                    Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "InitVarNames2",
                                                                "<script>var cbPIDL = '" + cbPIDL.ClientID + "';" + Environment.NewLine +
                                                                "var cbObsoL = '" + cbObsoL.ClientID + "';" + Environment.NewLine +
                                                                "var cbBlindL = '" + cbBlindL.ClientID + "';" + Environment.NewLine +
                                                                "var cbAnnL = '" + cbAnnL.ClientID + "';" + Environment.NewLine +
                                                                "var cbRemovL = '" + cbRemovL.ClientID + "';" + Environment.NewLine +
                                                                "var cboxPID = '" + cboxPID.ClientID + "';" + Environment.NewLine +
                                                                "var cboxObsoleteDate = '" + cboxObsoleteDate.ClientID + "';" + Environment.NewLine +
                                                                "var cboxBlindDate = '" + cboxBlindDate.ClientID + "';" + Environment.NewLine +
                                                                "var cboxAnnouncementDate = '" + cboxAnnouncementDate.ClientID + "';" + Environment.NewLine +
                                                                "var cboxRemovalDate = '" + cboxRemovalDate.ClientID + "';" + Environment.NewLine +
                                                                "var wdcObsoleteDate = '" + wdcObsoleteDate.ClientID + "';" + Environment.NewLine +
                                                                "var wdcPID = '" + wdcPID.ClientID + "';" + Environment.NewLine +
                                                                "var wdcRemovalDate = '" + wdcRemovalDate.ClientID + "';" + Environment.NewLine +
                                                                "var wdcBlindDate = '" + wdcBlindDate.ClientID + "';" + Environment.NewLine +
                                                                "var wdcAnnouncementDate = '" + wdcAnnouncementDate.ClientID + "';" + Environment.NewLine +
                                                                "</script>");
                    if (c.CountryCode != string.Empty)
                    {
                        uwToolbarTitle.Items.FromKeyLabel("Culture").Image = "/hc_v4/img/flags/" + curCountryCode + ".gif";
                    }
                    uwToolbarTitle.Items.FromKeyLabel("Culture").Text = c.Country.Name + "&nbsp;";
                    uwToolbarTitle.Items.FromKeyLabel("Sku").Text     = "[" + item.Sku + "]";

                    if (!Page.IsPostBack)
                    {
                        RetrievePLC();
                        lError.Visible = false;
                    }
                    //Modified for CR 4516/4537 - Prabhu
                    //if (!c.Country.CanLocalizePLC || item.IsMinimizedByCulture(SessionState.Culture.Code) || item.IsRoll || PLCUserId < 1)
                    if (!c.Country.CanLocalizePLC || item.IsRoll || PLCUserId < 1)
                    {
                        UITools.HideToolBarButton(uwToolbar, "Save");
                        UITools.HideToolBarSeparator(uwToolbar, "SaveSep");
                        wdcAnnouncementDate.Enabled       = wdcBlindDate.Enabled = wdcPID.Enabled = wdcObsoleteDate.Enabled =
                            wdcRemovalDate.Enabled        = cbAnnL.Enabled = cbBlindL.Enabled = cbObsoL.Enabled =
                                cbPIDL.Enabled            = cbRemovL.Enabled = cboxPID.Enabled = cboxRemovalDate.Enabled =
                                    cboxBlindDate.Enabled = cboxAnnouncementDate.Enabled = cboxObsoleteDate.Enabled = false;

                        if (!c.Country.CanLocalizePLC)
                        {
                            lError.Text = "This country cannot localize PLC";
                        }
                        else if (item.IsRoll)
                        {
                            lError.Text = "This product is roll";
                        }
                        //else if (item.IsMinimizedByCulture(SessionState.Culture.Code))
                        //{
                        //  lError.Text = "This product is minimized";
                        //}
                        //QC 1639: CRYS: PLC section becomes editable after the PLC is updated through UI (using reports from Localize menu)
                        // Fixed by Prabhu - 02 Mar 08
                        // Comment: Added PLCUserId check to filter PMG sourced products being edited in UI
                        else if (PLCUserId < 1)
                        {
                            lError.Text = "The PLC for this product is sourced from PMG. User cannot edit it.";
                        }
                        lError.CssClass = "hc_error";
                        lError.Visible  = true;
                    }
                    System.Globalization.CultureInfo ci = System.Globalization.CultureInfo.CreateSpecificCulture("en-US");
                    ci.DateTimeFormat.ShortDatePattern         = SessionState.User.FormatDate;
                    ci.DateTimeFormat.LongDatePattern          = SessionState.User.FormatDate;
                    wdcAnnouncementDate.CalendarLayout.Culture = ci;
                    wdcBlindDate.CalendarLayout.Culture        = ci;
                    wdcPID.CalendarLayout.Culture          = ci;
                    wdcObsoleteDate.CalendarLayout.Culture = ci;
                    wdcRemovalDate.CalendarLayout.Culture  = ci;
                }
            }
            catch (Exception fe)
            {
                UITools.FrameAlertAndBack(fe.ToString().Replace(Environment.NewLine, "."));
            }
            finally
            {
                if (c != null)
                {
                    c.Dispose();
                }
            }
        }