コード例 #1
0
    private void webTree_NodeBound(object sender, Infragistics.WebUI.UltraWebNavigator.WebTreeNodeEventArgs e)
    {
        if (e.Node != null)
        {
            string sItemId = e.Node.DataKey.ToString();
            e.Node.Text     = e.Node.Text + " [#" + e.Node.DataKey.ToString() + "]";
            e.Node.DataPath = sItemId;

            // Retrieve the count of children, if the count is positive then the current node can be expanded
            e.Node.ShowExpand = Utils.GetCount(dbObj, String.Format("SELECT COUNT(*) FROM Items WHERE ParentId = {0}", sItemId)) > 0;

            using (HyperCatalog.Business.Item currentItem = HyperCatalog.Business.Item.GetByKey(Convert.ToInt64(sItemId)))
            {
                // Update checkbox
                if (user != null && user.HasItemInScope(currentItem.Id))
                {
                    e.Node.Checked = true;
                }

                if (e.Node.Parent != null)
                {
                    Infragistics.WebUI.UltraWebNavigator.Node p = e.Node.Parent;
                    if (p.Checked)
                    {
                        e.Node.Checked  = true;
                        e.Node.CheckBox = Infragistics.WebUI.UltraWebNavigator.CheckBoxes.False;
                    }
                    else
                    {
                        e.Node.CheckBox = Infragistics.WebUI.UltraWebNavigator.CheckBoxes.True;
                    }
                    if (e.Node.Checked)
                    {
                        while (p != null)
                        {
                            if (p.Level > 0)
                            {
                                p = p.Parent;
                            }
                            else
                            {
                                p = null;
                            }
                        }
                    }
                }

                if ((currentItem != null) && (currentItem.Level.SkuLevel))
                {
                    // Update Icon
                    e.Node.ImageUrl = "/hc_v4/img/type_" + currentItem.TypeId + ".png";
                }
            }
        }
    }
コード例 #2
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            // Get current culture
            culture = SessionState.Culture;
            user    = SessionState.User;

            try
            {
                // Get parameters
                item    = QDEUtils.GetItemIdFromRequest();
                culture = QDEUtils.UpdateCultureCodeFromRequest();

                if (Request["f"] != null)
                {
                    inputformId = Convert.ToInt32(Request["f"]);
                }
            }
            catch
            {
                UITools.DenyAccess(DenyMode.Popup);
                return;
            }

            // Check
            //	- user is valid
            //	- culture is valid
            //	- item is valid
            //	- user has the current culture in its scope
            //	- user has the item in its scope
            if (user != null && culture != null && item != null &&
                user.HasCultureInScope(culture.Code) &&
                user.HasItemInScope(item.Id))
            {
                Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "initVars", "var cultureCode='" + culture.Code + "';", true);
                if (!Page.IsPostBack)
                {
                    lbError.Visible  = false;
                    dg.Visible       = false;
                    lbResult.Visible = false;

                    // Update title (current item name)
                    if (item != null)
                    {
                        lbTitle.Text = item.FullName;
                        if (lbTitle.Text.Length > 50)
                        {
                            lbTitle.Text = lbTitle.Text.Substring(0, 49) + "...";
                        }

                        if (inputformId > -1)
                        {
                            pnlChildren.Visible = false;
                            UITools.HideToolBarSeparator(uwToolbar, "AnalyzeSep");
                            UITools.HideToolBarButton(uwToolbar, "Analyze");

                            Analyze();                             // analyse the content for this input form

                            // Retrieve input form name
                            string inputFormName = HyperCatalog.Business.InputForm.GetByKey(Convert.ToInt32(inputformId)).Name;
                            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "InitFormName", "<script>inputFormName='" + inputFormName + "';</script>");
                        }
                        else
                        {
                            pnlChildren.Visible = true;
                            UITools.ShowToolBarSeparator(uwToolbar, "AnalyzeSep");
                            UITools.ShowToolBarButton(uwToolbar, "Analyze");
                        }
                    }
                    else
                    {
                        UITools.DenyAccess(DenyMode.Popup);
                    }
                }
            }
            else
            {
                UITools.DenyAccess(DenyMode.Popup);
            }
        }
コード例 #3
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            System.Globalization.CultureInfo ci = System.Globalization.CultureInfo.CreateSpecificCulture("en-US");
            ci.DateTimeFormat.ShortDatePattern        = SessionState.User.FormatDate;
            ci.DateTimeFormat.LongDatePattern         = SessionState.User.FormatDate;
            wdMasterPublishing.CalendarLayout.Culture = ci;
            wdMasterPublishing.MinDate = DateTime.UtcNow;

            warningMessage = "<font color='red' size='2'><b>Error:</b> Regional MATF is not possible.</font><br><br>" +
                             "This item has project with BOR date in future. Hence this item cannot be region validated. <br>" +
                             "Requesting user to try again after BOR date has reached.";

            if (SessionState.User.IsReadOnly)
            {
                uwToolbar.Items.FromKeyButton("Save").Enabled = false;
            }

            // Hide or show button switch capabilities
            if (!SessionState.User.HasCapability(CapabilitiesEnum.EDIT_DELETE_FINAL_CHUNKS_MARKET_SEGMENT))
            {
                UITools.HideToolBarButton(uwToolbar, "Save");
                UITools.HideToolBarSeparator(uwToolbar, "SaveSep");
            }

            // Retrieve current user and current culture
            user    = SessionState.User;
            culture = SessionState.Culture;

            try
            {
                // Get parameters
                if (Request["i"] != null)
                {
                    item = HyperCatalog.Business.Item.GetByKey(Convert.ToInt64(Request["i"]));
                }
                else if (QDEUtils.GetItemIdFromRequest() != null)
                {
                    item = QDEUtils.GetItemIdFromRequest();
                }

                if (Request["l"] != null)
                {
                    culture = QDEUtils.UpdateCultureCodeFromRequest("l");
                }

                if (Request["f"] != null)
                {
                    inputFormId = Convert.ToInt32(Request["f"]);
                }

                //Added by Prabhu for CR 5160 & ACQ 8.12 (PCF1: Auto TR Redesign)-- 21/May/09
                if (Request["isATRButton"] != null)
                {
                    isAutoTRButton = Convert.ToBoolean(Request["isATRButton"]);
                }

                if (inputFormId > 0)
                {
                    containerMATFList = Request["c"].ToString();
                    if (culture.Type == CultureType.Regionale && isAutoTRButton)
                    {
                        lblChkBoxAlert.Visible = true;
                        lblChkBoxAlert.Text    = "<font color='red'><b>Note:</b> Move status to will be performed on locally authored content only.</font>";
                    }
                }

                // Check
                //	- user is valid
                //	- culture is valid
                //	- item is valid
                //	- user has the current culture in its scope
                //	- user has the item in its scope
                if (user != null && culture != null && item != null &&
                    user.HasCultureInScope(culture.Code) &&
                    user.HasItemInScope(item.Id))
                {
                    if (!Page.IsPostBack)
                    {
                        DateTime today = DateTime.UtcNow;
                        item.RegionCode = culture.Code;
                        // check if this item or its inherited item has BOR date in future.
                        if (item.Milestones != null && culture.Type == CultureType.Regionale && inputFormId < 0)
                        {
                            if (!item.Milestones.Inherited)
                            {
                                if ((item.Milestones.BeginningOfRegionalization != null && item.Milestones.BeginningOfRegionalization.Value > today))
                                {
                                    panelMATF.Visible         = false;
                                    lblWarningMessage.Visible = true;
                                    lblWarningMessage.Text    = warningMessage;
                                }
                                else
                                {
                                    UpdateDataView();
                                }
                            }
                            else
                            {
                                item.Milestones.InheritedItem.RegionCode = culture.Code;
                                if ((item.Milestones.InheritedItem.Milestones.BeginningOfRegionalization != null && item.Milestones.InheritedItem.Milestones.BeginningOfRegionalization.Value > today))
                                {
                                    panelMATF.Visible         = false;
                                    lblWarningMessage.Visible = true;
                                    lblWarningMessage.Text    = warningMessage;
                                }
                                else
                                {
                                    UpdateDataView();
                                }
                            }
                        }
                        else
                        {
                            UpdateDataView();
                        }
                    }
                }
                else
                {
                    UITools.DenyAccess(DenyMode.Popup);
                    return;
                }
            }
            catch (Exception excep)
            {
                //Response.Write(excep.ToString());
                UITools.DenyAccess(DenyMode.Popup);
            }
        }