Exemple #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if ((Request["i"] != null) && (Request["c"] != null) && (Request["f"] != null) && (Request["p"] != null))
        {
            itemId = Convert.ToInt64(Request["i"]);
            using (cul = HyperCatalog.Business.Culture.GetByKey(Request["c"].ToString()))
            {
                frequency = Request["p"].ToString();
                filter    = Request["f"].ToString();

                if (cul != null)
                {
                    uwToolbarTitle.Items.FromKeyLabel("Culture").Image = "/hc_v4/img/flags/" + cul.CountryCode + ".gif";
                    uwToolbarTitle.Items.FromKeyLabel("Culture").Text  = cul.Name + " ";
                }
                using (HyperCatalog.Business.Item item = HyperCatalog.Business.Item.GetByKey(itemId))
                {
                    uwToolbarTitle.Items.FromKeyLabel("ItemName").Text = item.Name;
                }

                if (!Page.IsPostBack)
                {
                    DisplayData();
                }
            }
        }
        else
        {
            UITools.DenyAccess(DenyMode.Popup);
            return;
        }
        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "InitVars", "<script>itemId='" + itemId + "';cultureCode='" + cul.Code + "';</script>");
    }
Exemple #2
0
        private void UpdateDataView()
        {
            // Check if main item has a roll in its descendants
            if (itemObj.HasRollDescendant() || itemObj.GetRoll() != null)
            {
                cbFilter.Visible = true;
                UITools.ShowToolBarLabel(uwToolbar, "lbSoftRoll");
                UITools.ShowToolBarSeparator(uwToolbar, "CloseSep");
            }
            else
            {
                cbFilter.Visible = false;
                UITools.HideToolBarLabel(uwToolbar, "lbSoftRoll");
                UITools.HideToolBarSeparator(uwToolbar, "CloseSep");
            }

            cbFilter.Checked = displaySoftRoll;

            //lbTitle.Text = "Export product - " + itemObj.FullName;
            //lbError.Visible = false;
            webTree.ClearAll();
            Node mainNode = webTree.Nodes.Add("Select the Items for Summary Report");

            mainNode.CheckBox = CheckBoxes.False;
            if (displaySoftRoll && itemObj.GetRoll() != null)
            {
                itemObj = itemObj.GetRoll();
            }
            AddChild(mainNode, itemObj);
            webTree.ExpandAll();
        }
 protected void Page_Load(object sender, System.EventArgs e)
 {
     try
     {
         if (Request["m"] != null)
         {
             isMandatory = Convert.ToBoolean(Request["m"]);
         }
         containerId = Convert.ToInt32(Request["d"]);
         culture     = QDEUtils.UpdateCultureCodeFromRequest();
         item        = QDEUtils.GetItemIdFromRequest();
         itemId      = item.Id;
         chunk       = ChunkWindow.GetChunk(itemId, containerId, culture.Code);
         container   = SessionState.QDEContainer;
         if (!Page.IsPostBack)
         {
             lbResult.Text = HyperCatalog.Business.Chunk.LastError;
             UpdateDataView();
         }
     }
     catch (Exception ex)
     {
         Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "close", "<script>alert('" + UITools.CleanJSString(ex.ToString()) + "');top.window.close();</script>");
     }
 }
 protected void Page_Load(object sender, System.EventArgs e)
 {
     //TODO: Bug sur la procedure Stockee
     #region check security
     if (!SessionState.User.HasCapability(CapabilitiesEnum.INSTANT_TRANSLATE))
     {
         UITools.DenyAccess(DenyMode.Popup);
     }
     #endregion
     else
     {
         using (item = QDEUtils.GetItemIdFromRequest())
         {
             itemId        = item.Id;
             cultureCode   = Request["c"].ToString();
             containerList = Request["con"].ToString();
             if (!Page.IsPostBack)
             {
                 uwToolbar.Items.FromKeyLabel("ItemName").Text = item.FullName + " - TinyTM on demand";
                 DoTranslation();
                 Page.DataBind();
             }
         }
     }
 }
        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();
            }
        }
Exemple #6
0
    protected void Page_Load(object sender, System.EventArgs e)
    {
        if (SessionState.User.HasCapability(CapabilitiesEnum.MANAGE_LINKS))
        {
            try
            {
                // get parameters
                if (Request["i"] != null)
                {
                    System.Int64 itemId = Convert.ToInt64(Request["i"]);
                    item = HyperCatalog.Business.Item.GetByKey(itemId);
                }

                if (!Page.IsPostBack)
                {
                    UpdateDataView();
                }
            }
            catch (FormatException fe)
            {
                lbError.Text     = fe.ToString();
                lbError.CssClass = "hc_error";
                lbError.Visible  = true;
                return;
            }
        }
        else
        {
            UITools.DenyAccess(DenyMode.Frame);
        }
    }
Exemple #7
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            #region Retrieve Item information
            try
            {
                if (Request["i"] != null)
                {
                    itemObj = HyperCatalog.Business.Item.GetByKey(Convert.ToInt64(Request["i"]));
                }
                else if (QDEUtils.GetItemIdFromRequest() != null)
                {
                    itemObj = QDEUtils.GetItemIdFromRequest();
                }

                if (itemObj != null)
                {
                    Ultrawebtoolbar1.Items.FromKeyLabel("ItemName").Text = "Move product - " + itemObj.FullName;
                }

                if (Request["c"] != null)
                {
                    QDEUtils.UpdateCultureCodeFromRequest();
                }
            }
            catch
            {
                throw new ArgumentException("Item Id was not provided");
            }
            #endregion

            if (itemObj != null)
            {
                #region Capability
                if ((SessionState.User.IsReadOnly) && (SessionState.User.HasCapability(CapabilitiesEnum.MOVE_ITEMS)) &&
                    (itemObj.LevelId < Convert.ToInt32(SessionState.CacheParams["Item_MoveMaxLevel"].Value)))
                {
                    UITools.JsCloseWin();
                }
                #endregion
                if (HyperCatalog.Business.ApplicationParameter.IOHeirachyStatus() == 1)
                {
                    UITools.JsCloseWin("The Product Hierarchy Refresh job is in progress.  User cannot perform this action.  Please try once the job completes!");
                }

                try
                {
                    if (!Page.IsPostBack)
                    {
                        Step       = StepEnum.MainInfo;
                        NbSteps    = 2;
                        StepNumber = 1;
                        ProcessStep();
                    }
                }
                catch
                {
                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "Close", "<script>window.Close();</script>");
                }
            }
        }
    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";
                }
            }
        }
    }
Exemple #9
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                containerId = Convert.ToInt32(Request["d"]);
                if (Request["m"] != null)
                {
                    isMandatory = Convert.ToBoolean(Request["m"]);
                }
                culture           = QDEUtils.UpdateCultureCodeFromRequest();
                item              = QDEUtils.GetItemIdFromRequest();
                itemId            = item.Id;
                chunk             = ChunkWindow.GetChunk(itemId, containerId, culture.Code);
                container         = SessionState.QDEContainer;
                uwToolbar.Enabled = Request["ui"] != null;

                /*#ACQ10.0 Starts
                 * Commented to bring out ILB for all catalogue irespective of mandatory status
                 * if (!isMandatory || culture.Type == CultureType.Regionale)
                 * {
                 * UITools.HideToolBarButton(uwToolbar, "ilb");
                 * }
                 * #ACQ10.0 Ends
                 */
            }
            catch
            {
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "close", "<script>alert('Chunk not found!');window.close()</script>");
            }

            //Modified this line for QCs# 839 and 1028
            ChunkButtonBar.Chunk = chunk;
            //Modified this line for QCs# 839 and 1028



            ChunkButtonBar.User      = SessionState.User;
            ChunkButtonBar.Item      = item;
            ChunkButtonBar.Container = container;
            ChunkButtonBar.Culture   = culture;
            if (!Page.IsPostBack)
            {
                //Added these lines for QCs# 839 and 1028
                ChunkComment1.Chunk  = chunk;
                ChunkModifier1.Chunk = chunk;
                //Added these lines for QCs# 839 and 1028


                lbResult.Text = string.Empty;
                UpdateDataView();
            }
        }
Exemple #10
0
 //Modified the code to add preview functionality for Softroll by Radha S - Start
 protected void Page_Load(object sender, System.EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         try
         {
             if (Request["preview"].ToString() == "original")
             {
                 item = QDEUtils.GetItemIdFromRequest();
                 long itemId = item.Id;
                 template = item.Templates;
                 funLoadContent();
             }
             if (Request["preview"].ToString() == "softroll")
             {
                 item = QDEUtils.GetItemIdFromRequest();
                 Database dbObj = new Database(HyperCatalog.Business.ApplicationSettings.Components["Crystal_DB"].ConnectionString);
                 DataSet  ds    = new DataSet();
                 ds = dbObj.RunSQLReturnDataSet("select NodeOID,ItemId,IsRoll from Items where NodeOID in(select NodeOID  from Items where ItemId =" + item.Id + ")");
                 if (ds.Tables[0].Rows.Count > 1)
                 {
                     DataRow[] dr1 = ds.Tables[0].Select("IsRoll = true");
                     for (int drVal = 0; drVal < dr1.Length; drVal++)
                     {
                         long itemId = Convert.ToInt64(dr1[drVal]["ItemId"].ToString());
                         item = QDEUtils.GetItemIdFromRequest(itemId);
                     }
                     itemSoftroll = QDEUtils.GetItemIdFromRequest();
                     if (item.Templates.Count >= 0)
                     {
                         template = itemSoftroll.Templates;
                     }
                     funLoadContent();
                 }
                 else
                 {
                     ClientScript.RegisterClientScriptBlock(GetType(), "Preview", "<script> alert('This Item is not a Softroll Item, Preview Not Available'); window.close();</script>", false);
                     tblPreview.Visible = false;
                     pnlMsg.Visible     = false;
                 }
             }
             //Modified the code to add preview functionality for Softroll by Radha S - End
         }
         catch
         {
             UITools.DenyAccess(DenyMode.Popup);
         }
     }
 }
Exemple #11
0
        private void AddChild(Node n, HyperCatalog.Business.Item obj)
        {
            if ((displaySoftRoll && (obj.IsRoll || obj.GetRoll() == null)) ||
                (!displaySoftRoll && !obj.IsRoll))
            {
                Node child = new Node();
                child.DataKey = obj.Id;
                child.Text    = string.Empty;
                if (obj.IsRoll)
                {
                    child.Text += "<img src='/hc_v4/img/ed_roll.gif'> ";
                }
                child.Text    += obj.FullName;
                child.ImageUrl = child.SelectedImageUrl = "/hc_v4/ig/s_" + obj.Status.ToString().Substring(0, 1) + ".gif";
                if (obj.LevelId == skuLevelId)
                {
                    child.ImageUrl = "/hc_v4/img/type_" + obj.TypeId.ToString() + ".png";
                    if (obj.Sku.ToUpper().EndsWith("T")) // Top Value
                    {
                        child.ImageUrl = "/hc_v4/img/type_1.png";
                    }
                    child.SelectedImageUrl = child.ImageUrl;
                    switch (obj.Status.ToString())
                    {
                    case ("O"):
                        child.Text = "<font color=gray>[O] </font>" + child.Text;
                        break;

                    case ("F"):
                        child.Text = "<font color=green>[F] </font>" + child.Text;
                        break;
                    }
                }
                else
                {
                    if (obj.LevelId > skuLevelId)
                    {
                        child.SelectedImageUrl = child.ImageUrl = "/hc_v4/img/option.png";
                    }
                }
                n.Nodes.Add(child);

                foreach (HyperCatalog.Business.Item subItem in obj.Childs)
                {
                    AddChild(child, subItem);
                }
            }
        }
    private void webTree_NodeBound(object sender, Infragistics.WebUI.UltraWebNavigator.WebTreeNodeEventArgs e)
    {
        if (e.Node != null)
        {
            e.Node.ShowExpand = Utils.GetCount(dbObj, "SELECT COUNT(*) FROM Items WHERE ParentId = " + e.Node.DataKey.ToString()) > 0;
            if (e.Node.Parent != null)
            {
                if (e.Node.Parent.Checked)
                {
                    // remove checkbox
                    e.Node.Checked  = true;
                    e.Node.CheckBox = Infragistics.WebUI.UltraWebNavigator.CheckBoxes.False;
                }
                else
                {
                    // add checkbox
                    e.Node.CheckBox = Infragistics.WebUI.UltraWebNavigator.CheckBoxes.True;
                }

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

            // Update image
            e.Node.ImageUrl = "/hc_v4/ig/s_l.gif";

            HyperCatalog.Business.Item currentItem = HyperCatalog.Business.Item.GetByKey(Convert.ToInt64(e.Node.DataKey));
            if ((currentItem != null) && (currentItem.Level.SkuLevel))
            {
                // Update Icon
                e.Node.ImageUrl = "/hc_v4/img/type_" + currentItem.TypeId + ".png";
            }
        }
    }
    //Code Added for Links Requirement (PR658943) - to load the Level dropdown on 11th Jan 2013 - end

    //Code added for Links Requirement (PR664195) - to find out if selected host/companion is obsolete by Prachi on 16th Jan 2013 - start
    private bool IsItemObsolete()
    {
        int r = 0;

        using (HyperCatalog.Business.Item item = HyperCatalog.Business.Item.GetByKey(itemId))
        {
            r = item.IsObsolete(SessionState.Culture.Code);
        }
        if (r == 1)
        {
            return(true);
        }
        else
        {
            return(false);
        }
    }
 public void InitScopeFromParent(HyperCatalog.Business.Item parentItem)
 {
     if (parentItem != null)
     {
         cblLanguageScope.ClearSelection();
         foreach (HyperCatalog.Business.Language cul in parentItem.Translations)
         {
             foreach (ListItem item in cblLanguageScope.Items)
             {
                 if (item.Value == cul.Code)
                 {
                     item.Selected = true;
                 }
             }
         }
     }
 }
Exemple #15
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            // Placer ici le code utilisateur pour initialiser la page

            if (Request["d"] != null)
            {
                containerId = Convert.ToInt32(Request["d"]);
                culture     = QDEUtils.UpdateCultureCodeFromRequest();
                item        = QDEUtils.GetItemIdFromRequest();
                container   = SessionState.QDEContainer;
                itemId      = item.Id;
                if (!Page.IsPostBack)
                {
                    ShowChunk();
                }
            }
        }
Exemple #16
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            #region Retrieve Item information
            try
            {
                itemObj    = QDEUtils.GetItemIdFromRequest();
                skuLevelId = HyperCatalog.Shared.SessionState.SkuLevel.Id;
                cul        = QDEUtils.UpdateCultureCodeFromRequest();

                if (Request["r"] != null)
                {
                    displaySoftRoll = Convert.ToBoolean(Request["r"]);
                }
            }
            catch
            {
                throw new ArgumentException("Item Id was not provided");
            }
            #endregion

            #region Capability
            //if ((SessionState.User.IsReadOnly) && (SessionState.User.HasCapability(CapabilitiesEnum.EXPORT_ITEMS)) &&
            //  (itemObj.LevelId < Convert.ToInt32(SessionState.CacheParams["Item_ExportMaxLevel"].Value)))
            //{
            //    UITools.DenyAccess(DenyMode.Popup);
            //}
            #endregion

            try
            {
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "Initialize", "<script>cbFilterID='" + cbFilter.ClientID + "'</script>");

                if (!Page.IsPostBack)
                {
                    UpdateDataView();
                }
            }
            catch (Exception ex)
            {
                UITools.JsCloseWin(Utils.jsReplace(ex.ToString()));
            }
        }
Exemple #17
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                if (Request["m"] != null)
                {
                    isMandatory = Convert.ToBoolean(Request["m"]);
                }
                containerId       = Convert.ToInt32(Request["d"]);
                culture           = QDEUtils.UpdateCultureCodeFromRequest();
                item              = QDEUtils.GetItemIdFromRequest();
                itemId            = item.Id;
                chunk             = ChunkWindow.GetChunk(itemId, containerId, culture.Code);
                container         = SessionState.QDEContainer;
                uwToolbar.Enabled = Request["ui"] != null;

                /*
                 * #ACQ10.0 Starts
                 * Commented to bring out ILB for all catalogue irespective of mandatory status
                 * if (!isMandatory || culture.Type == CultureType.Regionale)
                 * {
                 * UITools.HideToolBarButton(uwToolbar, "ilb");
                 * uwToolbar.Visible = false;
                 * }
                 #ACQ10.0 Ends
                 */
                rdNo.Attributes.Add("onClick", "dc()");
                rdYes.Attributes.Add("onClick", "dc()");
            }
            catch
            {
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "close", "<script>window.close()</script>");
            }
            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "blanktext", "<script>ILBText = '" + HyperCatalog.Business.Chunk.BlankText + "';</script>");
            if (!Page.IsPostBack)
            {
                lbResult.Text = string.Empty;
                UpdateDataView();
            }
        }
Exemple #18
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                containerId = Convert.ToInt32(Request["d"]);
                if (Request["m"] != null)
                {
                    isMandatory = Convert.ToBoolean(Request["m"]);
                }
                culture = QDEUtils.UpdateCultureCodeFromRequest();
                item    = QDEUtils.GetItemIdFromRequest();
                // Fix for QC#7852 - Assigned the correct item Id to the itemID variable before retrieving the Chunk..
                itemId            = item.Id;
                chunk             = ChunkWindow.GetChunk(itemId, containerId, culture.Code);
                container         = SessionState.QDEContainer;
                uwToolbar.Enabled = Request["ui"] != null;
                System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo("en-US");
                ci.DateTimeFormat.ShortDatePattern = SessionState.User.FormatDate;
                ci.DateTimeFormat.LongDatePattern  = SessionState.User.FormatDate;
                dateValue.CalendarLayout.Culture   = ci;
                System.Threading.Thread.CurrentThread.CurrentCulture = ci;
                //ACQ10.0 Starts
                //if (!isMandatory || culture.Type == CultureType.Regionale)
                //{
                //  UITools.HideToolBarButton(uwToolbar, "ilb");
                //}
                //ACQ10.0 Ends
            }
            catch
            {
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "close", "<script>window.close()</script>");
            }
            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "blanktext", "<script>ILBText = '" + HyperCatalog.Business.Chunk.BlankText + "';</script>");


            //Modified this line for QCs# 839 and 1028
            ChunkButtonBar.Chunk = chunk;
            //Modified this line for QCs# 839 and 1028


            ChunkButtonBar.Container = container;
            ChunkButtonBar.Item      = item;
            ChunkButtonBar.User      = SessionState.User;
            ChunkButtonBar.Culture   = culture;

            //#ACQ10.0 Starts
            if (chunk != null)
            {
                if (chunk.Text == HyperCatalog.Business.Chunk.BlankValue)
                {
                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "VarBlankChunk", "<script>var isBlankChunk = true;</script>");
                    //dateValue.Enabled = false;
                    dateValue.Value = HyperCatalog.Business.Chunk.BlankText;
                }
            }
            //#ACQ10.0 Ends
            if (!Page.IsPostBack)
            {
                //Added these line for QCs# 839 and 1028
                ChunkComment1.Chunk  = chunk;
                ChunkModifier1.Chunk = chunk;
                //Added this line for QCs# 839 and 1028

                lbResult.Text = string.Empty;
                UpdateDataView();
            }
        }
        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);
            }
        }
Exemple #20
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                containerId = Convert.ToInt32(Request["d"]);
                if (Request["m"] != null)
                {
                    isMandatory = Convert.ToBoolean(Request["m"]);
                }
                culture           = QDEUtils.UpdateCultureCodeFromRequest();
                item              = QDEUtils.GetItemIdFromRequest();
                itemId            = item.Id;
                chunk             = ChunkWindow.GetChunk(itemId, containerId, culture.Code);
                container         = SessionState.QDEContainer;
                uwToolbar.Enabled = Request["ui"] != null;

                //code added on 17th November 2011 for Chunk Edit Validation for XSS Vulnerability Fix - start
                if (SessionState.CacheParams.Exists("XSS_RestrictedHTMLTags"))
                {
                    keyword = SessionState.CacheParams["XSS_RestrictedHTMLTags"].Value.ToString();
                }
                //code added on 17th November 2011 for Chunk Edit Validation for XSS Vulnerability Fix - end

                #region Spell Checker
                string masterLanguage = string.Empty;
                masterLanguage = HyperCatalog.Shared.SessionState.MasterCulture.LanguageCode;
                if (culture.LanguageCode != masterLanguage)
                {
                    UITools.HideToolBarSeparator(uwToolbar, "spellsep");
                    UITools.HideToolBarButton(uwToolbar, "spell");
                }
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "VarsForSpellChecker", "<script>var itemId=" + itemId.ToString() + ";var containerId=" + containerId + ";</script>");
                #endregion

                /*#ACQ10.0 Starts
                 * // Commented to bring out ILB for all catalogue irespective of mandatory status
                 * // Only allow ILB for mandatory chunks and only at sku level for push down
                 * if (!isMandatory  || culture.Type == CultureType.Regionale)
                 * {
                 *  UITools.HideToolBarSeparator(uwToolbar, "ilbSep");
                 *  UITools.HideToolBarButton(uwToolbar, "ilb");
                 * }
                 * #ACQ10.0 Ends
                 */
            }
            catch
            {
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "close", "<script>alert('Chunk not found!');window.close()</script>");
            }

            ChunkComment1.Chunk      = ChunkModifier1.Chunk = ChunkButtonBar.Chunk = chunk;
            ChunkButtonBar.Container = container;
            ChunkButtonBar.User      = SessionState.User;
            ChunkButtonBar.Culture   = culture;
            ChunkButtonBar.Item      = item;
            if (!Page.IsPostBack)
            {
                lbResult.Text = string.Empty;
                WebSpellChecker1.WebSpellCheckerDialogPage += "?i=" + itemId.ToString() + "&c=" + containerId.ToString();
                UpdateDataView();
            }
            #region Spell Checker
            WebSpellChecker1.SpellOptions.AllowCaseInsensitiveSuggestions = true;
            WebSpellChecker1.SpellOptions.AllowMixedCase       = false;
            WebSpellChecker1.SpellOptions.AllowWordsWithDigits = true;
            WebSpellChecker1.SpellOptions.AllowXML             = true;
            WebSpellChecker1.SpellOptions.CheckHyphenatedText  = true;
            WebSpellChecker1.SpellOptions.IncludeUserDictionaryInSuggestions       = true;
            WebSpellChecker1.SpellOptions.PerformanceOptions.AllowCapitalizedWords = true;
            WebSpellChecker1.SpellOptions.PerformanceOptions.CheckCompoundWords    = false;
            WebSpellChecker1.SpellOptions.PerformanceOptions.ConsiderationRange    = -1;
            WebSpellChecker1.SpellOptions.PerformanceOptions.SplitWordThreshold    = 3;
            WebSpellChecker1.SpellOptions.PerformanceOptions.SuggestSplitWords     = true;
            WebSpellChecker1.SpellOptions.SeparateHyphenWords = false;
            #endregion
        }
Exemple #21
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                containerId = Convert.ToInt32(Request["d"]);
                if (Request["m"] != null)
                {
                    isMandatory = Convert.ToBoolean(Request["m"]);
                }
                culture           = QDEUtils.UpdateCultureCodeFromRequest();
                item              = QDEUtils.GetItemIdFromRequest();
                itemId            = item.Id;
                chunk             = ChunkWindow.GetChunk(itemId, containerId, culture.Code);
                uwToolbar.Enabled = Request["ui"] != null;

                if (Request["ifid"] != null)
                {
                    ifContainer = InputFormContainer.GetByKey(Convert.ToInt32(Request["ifid"]));
                }

                /*#ACQ10.0 Starts --Commented
                 * Commented to bring out ILB for all catalogue irespective of mandatory status
                 * if (!isMandatory || culture.Type == CultureType.Regionale)
                 * {
                 * UITools.HideToolBarButton(uwToolbar, "ilb");
                 * }
                 */
                UITools.HideToolBarButton(uwToolbar, "ilb");
                //#ACQ10.0 Ends

                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "blanktext", "<script>ILBText = '" + HyperCatalog.Business.Chunk.BlankText + "';</script>");

                //Modified this line for QCs# 839 and 1028
                ChunkButtonBar.Chunk = chunk;
                //Modified this line for QCs# 839 and 1028

                ChunkButtonBar.Container = SessionState.QDEContainer;
                ChunkButtonBar.User      = SessionState.User;
                ChunkButtonBar.Culture   = culture;
                ChunkButtonBar.Item      = item;
                if (!Page.IsPostBack)
                {
                    //Added these lines for QCs# 839 and 1028
                    ChunkComment1.Chunk  = chunk;
                    ChunkModifier1.Chunk = chunk;
                    //Added these lines for QCs# 839 and 1028

                    lbResult.Text = string.Empty;
                    UpdateDataView();
                }
                else
                {
                    if (Request["__EVENTTARGET"] != null) // Check if user is trying to sort a group
                    {
                        if (Request["__EVENTTARGET"].ToString() == "rowup" || Request["__EVENTTARGET"].ToString() == "rowdown")
                        {
                            SortRow(Request["__EVENTTARGET"].ToString() == "rowup", Convert.ToInt32(Request["__EVENTARGUMENT"]));
                        }
                    }
                }
            }

            catch (Exception ex)
            {
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "close", "<script>alert('" + UITools.CleanJSString(ex.ToString()) + "');top.window.close();</script>");
            }
        }
Exemple #22
0
    private void BuildDocument(string itemIdStr, string cultureCode, string templateName, string preview)
    {
        try
        {
            //Modified the code to add preview functionality for Softroll by Radha S - Start
            if (preview == "original")
            {
                item = QDEUtils.GetItemIdFromRequest();
            }
            if (preview == "softroll")
            {
                item = QDEUtils.GetItemIdFromRequest();
                Database dbObj = new Database(HyperCatalog.Business.ApplicationSettings.Components["Crystal_DB"].ConnectionString);
                DataSet  ds    = new DataSet();
                ds = dbObj.RunSQLReturnDataSet("select NodeOID,ItemId,IsRoll from Items where NodeOID in(select NodeOID  from Items where ItemId =" + item.Id + ")");
                if (ds.Tables[0].Rows.Count > 1)
                {
                    DataRow[] dr1 = ds.Tables[0].Select("IsRoll = true");
                    for (int drVal = 0; drVal < dr1.Length; drVal++)
                    {
                        long itemId = Convert.ToInt64(dr1[drVal]["ItemId"].ToString());
                        item = QDEUtils.GetItemIdFromRequest(itemId);
                    }
                    itemIdStr = Convert.ToString(item.Id);
                }
            }
            //Modified the code to add preview functionality for Softroll by Radha S - End
            HOT objCont = new HOT();

            //XmlDocument xmlProductItem = OpenXmlDocument(WSContentProvider.GetProductContent(itemIdStr, cultureCode));

//      XmlDocument xmlProductItem = OpenXmlDocument(GetProductContent(itemIdStr, cultureCode));
            XmlDocument xmlProductItem = OpenXmlDocument(objCont.GetProductContent(itemIdStr, cultureCode));

            if (xmlProductItem != null)
            {
                try
                {
                    foreach (XmlNode chunkNode in xmlProductItem.SelectNodes("//chunk"))
                    {
                        chunkNode.Attributes["language"].Value = chunkNode.Attributes["language"].Value.Substring(3, 2);
                    }
                }
                catch { }
                #region collaterals
                if (xmlProductItem.SelectSingleNode("//chunk[@xmlname='IsCollateral']") != null)    //CR 4506
                {
                    XmlNode proidlistNode = xmlProductItem.SelectSingleNode("//chunk[@xmlname='w_prodidlist']");
                    if (proidlistNode != null)
                    {
                        XmlNode productNode = xmlProductItem.SelectSingleNode("product");
                        foreach (string prodid in proidlistNode.InnerText.Split(';'))
                        {
                            if (prodid != String.Empty)
                            {
                                //XmlDocument xmlLocalDoc = OpenXmlDocument(WSContentProvider.GetProductContent(prodid, cultureCode));
                                //XmlDocument xmlLocalDoc = OpenXmlDocument(GetProductContent(prodid, cultureCode));
                                XmlDocument xmlLocalDoc = OpenXmlDocument(objCont.GetProductContent(prodid, cultureCode));
                                XmlNode     newNode     = xmlLocalDoc.SelectSingleNode("product");
                                productNode.AppendChild(xmlProductItem.ImportNode(newNode, true));
                            }
                        }
                    }
                }
                #endregion

                #region Handle publication number in preview mode
                // Remove publication number if mode is preview
                if (dlResolutions.SelectedValue.ToLower() == "preview")
                {
                    foreach (XmlNode node in xmlProductItem.SelectNodes(".//chunk[@xmlname='dspubn']"))
                    {
                        node.InnerText = "PREVIEW";
                    }
                    foreach (XmlNode node in xmlProductItem.SelectNodes(".//chunk[@xmlname='icdisplaypubn']"))
                    {
                        node.InnerText = "PREVIEW";
                    }
                    foreach (XmlNode node in xmlProductItem.SelectNodes(".//chunk[@xmlname='icprodpubn']"))
                    {
                        node.InnerText = "PREVIEW";
                    }
                    foreach (XmlNode node in xmlProductItem.SelectNodes(".//chunk[@xmlname='icpricepubn']"))
                    {
                        node.InnerText = "PREVIEW";
                    }
                }
                #endregion

                long   itemId    = Convert.ToInt64(itemIdStr);
                string sessionId = string.Empty;//docFactory.SignOn(
                string feedBack  = string.Empty;

                byte[] templateArray = HyperComponents.IO.Streaming.EmptyByte;
                templateArray = WSDam.ResourceBinaryGetByPath((string)SessionState.CacheParams["PubManager_DAMTemplateLibrary"].Value + "/" + templateName + ".hot");
                string parameters = string.Empty;

                switch (dlColors.SelectedValue)
                {
                case "auto":
                    int index = Convert.ToInt32(itemId % colorParams.Length);
                    dlColors.SelectedValue = dlColors.Items[index + 1].Value;
                    parameters             = getXmlParams(itemId, templateName);
                    break;

                case "default":
                    break;

                default:
                    parameters = getXmlParams(itemId, templateName);
                    break;
                }
                if (templateArray != null && templateArray.Length > 0)
                {
                    DateTime before = DateTime.Now;
                    //          Response.Write("<B>An error occurred during creation of document for this product.</B><BR/>"
                    //            + xmlProductItem.OuterXml.Length + "<BR/><BR/>"
                    //            + templateArray.Length + "<BR/><BR/>"
                    //            + cultureCode + "<BR/><BR/>"
                    //            + parameters + "<BR/><BR/>"
                    //            + dlResolutions.SelectedValue + "<BR/><BR/>"
                    //            );
                    //docFactory.Url = "http://83.145.97.142/HyperCatalog/HyperCatalog.WebServices/DocumentFactory/DocumentFactory.asmx";
                    //WSDocFactory.Url = "http://localhost/DocFactory/DocumentFactory.asmx";
                    //WSDocFactory.Credentials = System.Net.CredentialCache.DefaultCredentials;

                    string languageCode = HyperCatalog.Business.Culture.GetByKey(cultureCode).LanguageCode;
                    byte[] outputArray  = WSDocFactory.CreateDocumentStreamFromBinary(sessionId, xmlProductItem.OuterXml, templateArray, "", languageCode, parameters, dlResolutions.SelectedValue, "", ref feedBack);
                    if (outputArray != null && outputArray.Length > 0)
                    {
                        DateTime after = DateTime.Now;

                        //          HyperCatalog.UI.Main.PublicationWS.Publication pubWS = new HyperCatalog.UI.Main.PublicationWS.Publication();
                        //          pubWS.LogTemplateGeneration(SessionState.User.Id,itemId,templateName,dlResolutions.SelectedValue,cultureCode,((TimeSpan)after.Subtract(before)).Seconds);
                        //          pubWS.Dispose();

                        //Session["pdf"] = outputArray;
                        Response.Expires = 0;
                        Response.Buffer  = true;
                        Response.ClearContent();
                        Response.ClearHeaders();
                        Response.ContentType = "application/octet-stream";
                        Response.AddHeader("content-disposition", "attachment;filename=preview.pdf");
                        Response.AddHeader("content-length", outputArray.Length.ToString());
                        Response.BinaryWrite(outputArray);

                        /*    /*FileStream fs = new FileStream(@"c:\projets\test.pdf", FileMode.CreateNew);
                         *      fs.Write(outputArray, 0, outputArray.Length);
                         *      fs.Close();*/
                    }
                    else
                    {
                        Response.Write("<B>" + item.FullName + "</B> - Content not available");
                        Response.Flush();
                        Response.End();
                    }
                }
                else
                {
                    Response.Write("<B>" + item.FullName + "</B> - Unable to retrieve Template from DAM");
                    Response.Flush();
                    Response.End();
                }
            }
        }
        catch (Exception e)
        {
            //Removed the system exceptiong which was displaying in the UI by Radha S
            Response.Write("<B>" + item.FullName + " - Unable to retrieve Content</B><BR/>");
            Response.Write("<B>An error occurred during creation of document for this product.</B><BR/>");
            Response.Flush();
            Response.End();
        }
    }
        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);
            }
        }
Exemple #24
0
        public static void ExportCartography(System.Int64 entryPointId, Page page)
        {
            WorksheetCell cell;

            using (Database dbObj = Utils.GetMainDB())
            {
                using (DataSet ds = dbObj.RunSPReturnDataSet("dbo._InputForm_Cartography", "",
                                                             new SqlParameter("@ItemId", entryPointId)))
                {
                    dbObj.CloseConnection();
                    if (dbObj.LastError != string.Empty)
                    {
                        page.Response.Write(dbObj.LastError);
                        page.Response.End();
                    }
                    if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                    {
                        #region Rename DataSet Tables
                        HyperCatalog.Business.Item curItem = HyperCatalog.Business.Item.GetByKey(entryPointId);
                        for (int i = 0; i < ds.Tables.Count; i++)
                        {
                            i++;
                            DataRow dr        = ds.Tables[i - 1].Rows[0];
                            string  tableName = "[" + dr["LevelId"].ToString() + "] - " + dr["ItemName"].ToString();
                            if (dr["ItemNumber"].ToString() != string.Empty)
                            {
                                tableName += "[" + dr["ItemNumber"].ToString() + "]";
                            }
                            if (ds.Tables[tableName] == null)
                            {
                                ds.Tables[i].TableName = Utils.CleanFileName(tableName);
                            }
                            else
                            {
                                ds.Tables[i].TableName = Utils.CleanFileName(tableName) + " (doublon!! " + DateTime.UtcNow.Millisecond.ToString() + ")";
                            }
                        }
                        #endregion
                        for (int i = 0; i < ds.Tables.Count; i++)
                        {
                            ds.Tables.Remove(ds.Tables[i]);
                        }
                        for (int i = 0; i < ds.Tables.Count; i++)
                        {
                            foreach (DataRow dr in ds.Tables[i].Rows)
                            {
                                dr[0] = "[" + dr[3].ToString() + "] - " + dr[0].ToString() + dr[1].ToString() + " (#" + dr[2].ToString() + ")";
                                dr[5] = dr[5].ToString() + " (#" + dr[4].ToString() + ")";
                            }
                            ds.Tables[i].Columns.Remove("ItemName");
                            ds.Tables[i].Columns.Remove("ItemId");
                            ds.Tables[i].Columns.Remove("ItemLevelId");
                            ds.Tables[i].Columns.Remove("L0");
                            ds.Tables[i].Columns.Remove("IFShortName");
                            ds.Tables[i].Columns.Remove("InputFormId");
                            ds.Tables[i].Columns.Remove("IsActive");
                            ds.Tables[i].Columns.Remove("Herited");
                            ds.Tables[i].Columns.Remove("MinLevel");
                            ds.Tables[i].Columns["IfLongName"].ColumnName = "Input Form";
                            ds.Tables[i].Columns["ItemPath"].ColumnName   = "Item";
                        }
                        Workbook theWorkBook = ExcelExporter.DataSetToExcel(ds);
                        foreach (Worksheet w in theWorkBook.Worksheets)
                        {
                            int nbRows;
                            int nbCols;
                            for (nbRows = 1; w.Rows[nbRows].Cells[0].Value != null; nbRows++)
                            {
                            }
                            for (nbCols = 1; w.Rows[0].Cells[nbCols].Value != null; nbCols++)
                            {
                            }

                            // Colorize and Format
                            for (int j = 0; j < nbCols; j++)
                            {
                                cell = w.Rows[1].Cells[j];
                                cell.CellFormat.Font.Bold   = ExcelDefaultableBoolean.True;
                                cell.CellFormat.Font.Color  = System.Drawing.Color.White;
                                cell.CellFormat.FillPattern = FillPatternStyle.Gray12percent;
                                cell.CellFormat.FillPatternBackgroundColor = System.Drawing.Color.DarkBlue;
                                for (int i = 0; i < nbRows; i++)
                                {
                                    cell = w.Rows[i].Cells[j];
                                    cell.CellFormat.BottomBorderStyle = CellBorderLineStyle.Thin;
                                    cell.CellFormat.LeftBorderStyle   = CellBorderLineStyle.Thin;
                                    cell.CellFormat.RightBorderStyle  = CellBorderLineStyle.Thin;
                                    cell.CellFormat.TopBorderStyle    = CellBorderLineStyle.Thin;
                                    cell.CellFormat.BottomBorderColor = System.Drawing.Color.Black;
                                    cell.CellFormat.LeftBorderColor   = System.Drawing.Color.Black;
                                    cell.CellFormat.RightBorderColor  = System.Drawing.Color.Black;
                                    cell.CellFormat.TopBorderColor    = System.Drawing.Color.Black;
                                }
                            }
                            w.Columns[0].Width = 12000;
                            w.Columns[1].Width = 10000;
                            for (int i = 2; i < nbCols; i++)
                            {
                                w.Columns[i].Width = 1000;
                                w.Columns[i].CellFormat.Alignment = HorizontalCellAlignment.Center;
                            }
                            // Consider Inherited input forms and put in italic the text
                            // Also put in yellow the boxes where the input forms are attached
                            for (int i = 2; i < nbRows; i++)
                            {
                                int rowLevelId = Convert.ToInt32(w.Rows[i].Cells[0].Value.ToString().Substring(1, 1));
                                if (rowLevelId < curItem.LevelId)
                                {
                                    for (int j = 0; j < nbCols; j++)
                                    {
                                        w.Rows[i].Cells[j].CellFormat.Font.Italic = ExcelDefaultableBoolean.True;
                                        //w.Rows[i].Cells[j].CellFormat.FillPattern = FillPatternStyle.Solid;
                                        //w.Rows[i].Cells[j].CellFormat.FillPatternForegroundColor = System.Drawing.Color.Silver;
                                    }
                                }
                                w.Rows[i].Cells[1 + rowLevelId].CellFormat.FillPattern = FillPatternStyle.Solid;
                                w.Rows[i].Cells[1 + rowLevelId].CellFormat.FillPatternForegroundColor = System.Drawing.Color.Yellow;
                            }
                            w.Columns[2].Hidden = true;
                            #region Add Legend

                            cell       = w.Rows[nbRows + 2].Cells[0];
                            cell.Value = "Legend";
                            cell.CellFormat.Font.Bold   = ExcelDefaultableBoolean.True;
                            cell.CellFormat.Font.Color  = System.Drawing.Color.White;
                            cell.CellFormat.FillPattern = FillPatternStyle.Gray12percent;
                            cell.CellFormat.FillPatternBackgroundColor = System.Drawing.Color.DarkBlue;
                            cell       = w.Rows[nbRows + 3].Cells[0];
                            cell.Value = "Input Forms are attached here";
                            cell.CellFormat.FillPattern = FillPatternStyle.Solid;
                            cell.CellFormat.FillPatternForegroundColor = System.Drawing.Color.Yellow;
                            cell       = w.Rows[nbRows + 4].Cells[0];
                            cell.Value = "X: Input Form applies here";
                            for (int i = nbRows + 2; i < nbRows + 4; i++)
                            {
                                cell = w.Rows[i].Cells[0];
                                cell.CellFormat.BottomBorderStyle = CellBorderLineStyle.Thin;
                                cell.CellFormat.LeftBorderStyle   = CellBorderLineStyle.Thin;
                                cell.CellFormat.RightBorderStyle  = CellBorderLineStyle.Thin;
                                cell.CellFormat.TopBorderStyle    = CellBorderLineStyle.Thin;
                                cell.CellFormat.BottomBorderColor = System.Drawing.Color.Black;
                                cell.CellFormat.LeftBorderColor   = System.Drawing.Color.Black;
                                cell.CellFormat.RightBorderColor  = System.Drawing.Color.Black;
                                cell.CellFormat.TopBorderColor    = System.Drawing.Color.Black;
                            }
                            #endregion
                        }
                        ExcelExporter.WriteToResponse(theWorkBook,
                                                      Utils.CleanFileName("Cartography [" + curItem.FullName + "].xls"),
                                                      page.Response);

                        if (ds != null)
                        {
                            ds.Dispose();
                        }
                    }
                    else
                    {
                        if (ds != null)
                        {
                            ds.Dispose();
                        }

                        page.ClientScript.RegisterClientScriptBlock(page.GetType(), "alert", "<script>alert('No cartography!');</script>");
                    }
                }
            }
        }
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (SessionState.User.HasCapability(CapabilitiesEnum.ATTACH_INPUT_FORMS) ||
                SessionState.User.HasCapability(CapabilitiesEnum.MANAGE_CARTOGRAPHY) ||
                SessionState.User.HasCapability(CapabilitiesEnum.MANAGE_ITEMS) ||
                SessionState.User.HasCapability(CapabilitiesEnum.DISPLAY_ITEMS))
            {
                try
                {
                    itemObj = QDEUtils.GetItemIdFromRequest();
                    itemId  = itemObj.Id;
                }
                catch
                {
                    throw new ArgumentException("Item Id was not provided");
                }

                // List of level
                listLevel = new ItemLevelList();
                using (ItemLevelList itemLevelAll = ItemLevel.GetAll())
                {
                    foreach (ItemLevel i in itemLevelAll)
                    {
                        if (i.Id > 0)
                        {
                            listLevel.Add(i);
                        }
                    }
                }
                levelCount = listLevel.Count;

                if (!Page.IsPostBack)
                {
                    // Get applicable level list
                    ddlLevels.Items.Insert(0, new ListItem("-->Choose a level<--", "0"));
                    int l = 0;
                    for (int i = 1; i <= listLevel.Count - 1; i++)
                    {
                        if (listLevel[i].Id >= itemObj.LevelId)
                        {
                            l++;
                            ddlLevels.Items.Insert(l, new ListItem("[" + listLevel[i].Id.ToString() + "] " + listLevel[i].Name.ToString(), listLevel[i].Id.ToString()));
                        }
                    }
                    ddlLevels.Attributes.Add("onChange", "if (this.value=='0') return false;");

                    // Add Level Columns to grid
                    int totalWidth = 0;
                    foreach (HyperCatalog.Business.ItemLevel lev in listLevel)
                    {
                        Infragistics.WebUI.UltraWebGrid.UltraGridColumn levCol = new UltraGridColumn("L" + lev.Id.ToString(), lev.Id.ToString(), ColumnType.NotSet, null);
                        levCol.Width          = Unit.Pixel(25);
                        levCol.BaseColumnName = levCol.Key;
                        dg.Bands[0].Columns.Add(levCol);
                        totalWidth += 25;
                    }
                    int width = totalWidth;
                    AppLevelTitle.Width = width.ToString();
                    AppLevelTitle.DataBind();

                    // Move column "delete" in last position
                    dg.Bands[0].Columns.FromKey("Action").Move(dg.Bands[0].Columns.Count - 1);

                    // Update Grid
                    UpdateDataView();

                    cbInputForms.Enabled = false;
                    uwToolBar.Items.FromKeyButton("add").Enabled      = false;
                    uwToolBar.Items.FromKeyButton("applyAll").Enabled = false;
                }

                if (!SessionState.User.HasCapability(CapabilitiesEnum.MANAGE_CARTOGRAPHY) && !SessionState.User.HasCapability(CapabilitiesEnum.ATTACH_INPUT_FORMS))
                {
                    ddlLevels.Enabled    = false;
                    cbInputForms.Enabled = false;
                    uwToolBar.Items.FromKeyButton("add").Enabled      = false;
                    uwToolBar.Items.FromKeyButton("applyAll").Enabled = false;
                }
            }
            else
            {
                UITools.DenyAccess(DenyMode.Popup);
            }
        }
Exemple #26
0
 protected void webTree_Load(object sender, System.EventArgs e)
 {
     if (lastVisitedItem >= 0)
     {
         string nodeId = lastVisitedItem.ToString();
         // if the last visited item is roll
         HyperCatalog.Business.Item itemTemp = null;
         try
         {
             itemTemp = SessionState.CurrentItem;
             if ((itemTemp != null) && (itemTemp.IsRoll))
             {
                 nodeId = itemTemp.RefItemId.ToString();
             }
             Node n = Utils.FindNodeInTree(webTree.Nodes, nodeId);
             if (n == null)
             {
                 Trace.Warn("Search parents for itemId: " + lastVisitedItem.ToString());
                 using (DataSet parentsDS = dbObj.RunSPReturnDataSet("dbo.QDE_GetParents", "Parents", new SqlParameter("@ItemId", lastVisitedItem.ToString())))
                 {
                     dbObj.CloseConnection();
                     for (int i = 0; i < parentsDS.Tables["Parents"].Rows.Count; i++)
                     {
                         Trace.Warn("ParentId: " + parentsDS.Tables["Parents"].Rows[i]["ItemId"].ToString());
                         ExpandNode(parentsDS.Tables["Parents"].Rows[i]["ItemId"].ToString());
                     }
                 }
                 n = Utils.FindNodeInTree(webTree.Nodes, nodeId);
             }
             if (n != null)
             {
                 webTree.SelectedNode = n;
                 ExpandNode(nodeId);
                 webTree.SelectedNode.Expand(false);
             }
             else if (webTree.Nodes.Count > 0 && webTree.Nodes[0].Nodes.Count > 0)
             {
                 bool doSave = false;
                 if (SessionState.User.LastVisitedItemReadOnly != Convert.ToInt64(webTree.Nodes[0].Nodes[0].DataKey))
                 {
                     lastVisitedItem = SessionState.User.LastVisitedItemReadOnly = Convert.ToInt64(webTree.Nodes[0].Nodes[0].DataKey);
                 }
                 else
                 {
                     if (SessionState.User.LastVisitedItem != Convert.ToInt64(webTree.Nodes[0].Nodes[0].DataKey))
                     {
                         lastVisitedItem = SessionState.User.LastVisitedItem = Convert.ToInt64(webTree.Nodes[0].Nodes[0].DataKey);
                         doSave          = true;
                     }
                 }
                 if (doSave)
                 {
                     SessionState.User.QuickSave();
                 }
             }
         }
         finally
         {
             if (itemTemp != null)
             {
                 itemTemp.Dispose();
             }
         }
         if (lastVisitedItem == 0)
         {
             webTree.Nodes[0].Expand(true);
         }
     }
 }