예제 #1
0
 private void FillBox()
 {
     ItemListSort = -1;
     lstBoxSiblingItems.Items.Clear();
     if (Item != null)
     {
         using (HyperComponents.Data.dbAccess.Database dbObj = Utils.GetMainDB())
         {
             using (DataTable siblingItems = dbObj.RunSPReturnDataSet("_Item_GetSiblingItems", new System.Data.SqlClient.SqlParameter("@ItemId", Item.Id)).Tables[0])
             {
                 dbObj.CloseConnection();
                 if (siblingItems != null && siblingItems.Rows.Count > 0)
                 {
                     lstBoxSiblingItems.Size = siblingItems.Rows.Count + 1;
                 }
                 if (siblingItems.Rows.Count > 14)
                 {
                     lstBoxSiblingItems.Size = 15;
                 }
                 for (int i = 0; i < siblingItems.Rows.Count; i++)
                 {
                     string itemName   = siblingItems.Rows[i]["ItemName"].ToString();
                     string itemNumber = siblingItems.Rows[i]["ItemNumber"].ToString();
                     itemName = itemNumber.Length > 0 ? "[" + itemNumber + "] - " + itemName : itemName;
                     ListItem newItem = new ListItem("[" + siblingItems.Rows[i]["LevelId"].ToString() + "] - " + itemName, siblingItems.Rows[i]["ItemId"].ToString().ToString());
                     if (newItem.Text.Length > 80)
                     {
                         newItem.Text = newItem.Text.Substring(0, 49) + "...";
                     }
                     lstBoxSiblingItems.Items.Add(newItem);
                 }
             }
         }
     }
 }
예제 #2
0
        /// <summary>
        /// Display the selected term properties
        /// </summary>
        /// <param name="selTermId">TermId</param>
        void UpdateDataEdit(string selTermId)
        {
            Session["PageIndexTerm"] = dg.DisplayLayout.Pager.CurrentPageIndex;
            Session["TermType"]      = DDL_TermTypeList.SelectedValue;
            Session["FilterTerm"]    = txtFilter.Text;
            panelGrid.Visible        = false;
            webTab.EnableViewState   = false;
            webTab.Tabs.GetTab(0).ContentPane.TargetUrl = "./Termbase/Term_Properties.aspx?t=" + selTermId;

            if (selTermId == "-1")
            {
                #region New Term
                webTab.Tabs.GetTab(1).ContentPane.TargetUrl = "";
                webTab.Tabs[1].Visible = false;
                webTab.Tabs.GetTab(2).ContentPane.TargetUrl = "";
                webTab.Tabs[2].Visible = false;
                lbTitle.Text           = "Term: New";
                #endregion
            }
            else
            {
                #region Term selected
                using (Term HCTerm = Term.GetByKey(Convert.ToInt32(selTermId)))
                {
                    string termValue = HCTerm.Value.ToString();
                    if (termValue.Length > 50)
                    {
                        termValue = termValue.Substring(0, 50) + "...";
                    }
                    lbTitle.Text = "Term: " + termValue;
                    webTab.Tabs.GetTab(1).ContentPane.TargetUrl = "./Termbase/Term_Translations.aspx?t=" + selTermId;
                    webTab.Tabs.GetTab(2).ContentPane.TargetUrl = "./Termbase/Term_Containers.aspx?t=" + selTermId;
                    HyperComponents.Data.dbAccess.Database dbObj = new HyperComponents.Data.dbAccess.Database(SessionState.CacheComponents["Crystal_DB"].ConnectionString);
                    #region Translations Count
                    TermTranslationList tlist;
                    int TranslationsCount;
                    using (tlist = TermTranslation.GetAll(Convert.ToInt32(selTermId), "TermTypeCode='" + HCTerm.TermTypeCode + "'"))
                    {
                        TranslationsCount = tlist.Count - HCTerm.TranslationsMissingCount;
                    }
                    #endregion
                    webTab.Tabs.GetTab(1).Text = "Translations (" + TranslationsCount.ToString() + "/" + tlist.Count.ToString() + ")";
                    #region Containers Count
                    webTab.Tabs.GetTab(2).Visible = false;
                    using (ContainerList clist = HyperCatalog.Business.Container.GetAll("LabelId=" + selTermId))
                    {
                        if (clist.Count > 0)
                        {
                            webTab.Tabs.GetTab(2).Text    = "Containers (" + clist.Count + ")";
                            webTab.Tabs.GetTab(2).Visible = true;
                        }
                    }
                    #endregion
                }
                #endregion
            }
            panelTabTerm.Visible    = true;
            webTab.SelectedTabIndex = 0;
        }
예제 #3
0
 protected DataSet GetSearchResults()
 {
     if (Session["SearchResult"] == null)
     {
         using (HyperComponents.Data.dbAccess.Database dbObj = Utils.GetMainDB())
         {
             Session["SearchResult"] = dbObj.RunSPReturnDataSet("_Item_Search", new SqlParameter("@SearchString", searchString),
                                                                new SqlParameter("@UserId", SessionState.User.Id), new SqlParameter("@CultureCode", SessionState.Culture.Code),
                                                                new SqlParameter("@CompanyName", SessionState.CompanyName));
         }
     }
     return((DataSet)Session["SearchResult"]);
 }
예제 #4
0
        protected void advancedToolBar_ButtonClicked(object sender, Infragistics.WebUI.UltraWebToolbar.ButtonEvent be)
        {
            advancedToolBar.ClientSideEvents.InitializeToolbar = "";
            uwToolbar.Items.FromKeyButton("Export").Pressed(true);
            switch (be.Button.Key)
            {
            case "TotalExport":
                using (HyperComponents.Data.dbAccess.Database dbObj = new HyperComponents.Data.dbAccess.Database(SessionState.CacheComponents["CRYSTAL_DB"].ConnectionString))
                {
                    string code = DDL_TermTypeList.SelectedIndex > 0 ? DDL_TermTypeList.SelectedValue.ToString() : string.Empty;
                    using (DataSet ds = dbObj.RunSPReturnDataSet("_Term_Export", new System.Data.SqlClient.SqlParameter("@TermTypeCode", code)))
                    {
                        code = code == string.Empty ? " " : code;                     // assigning the code to have empty space if it is empty
                        using (TermType tt = TermType.GetByKey(Convert.ToChar(code))) // If the code value is " ", then tt would be null
                        {
                            code = code != " " ? tt.Name : "All terms";
                        }
                        HyperCatalog.UI.Tools.Export.ExportTermReport(ds, code, this.Page);
                    }
                }
                break;

            case "RunValidationReport":
                using (HyperComponents.Data.dbAccess.Database dbObj = new HyperComponents.Data.dbAccess.Database(SessionState.CacheComponents["CRYSTAL_DB"].ConnectionString))
                {
                    Infragistics.WebUI.WebSchedule.WebDateChooser startDate = (Infragistics.WebUI.WebSchedule.WebDateChooser)advancedToolBar.Items.FromKeyCustom("startDate").FindControl("startDate");
                    if (startDate != null)
                    {
                        using (DataSet ds = dbObj.RunSPReturnDataSet("_Term_GetChoicesValidationReport", new System.Data.SqlClient.SqlParameter("@DayNew", startDate.Value)))
                        {
                            if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                            {
                                HyperCatalog.UI.Tools.Export.ExportTermValidationReport(ds, (DateTime)startDate.Value, Page);
                            }
                            else
                            {
                                errorMsg.Text    = "No activity since this date.";
                                errorMsg.Visible = true;
                            }
                        }
                    }
                }
                break;

            default:
                Response.Write("coucou");
                break;
            }
        }
예제 #5
0
        private void UpdateDataView()
        {
            //***************************************
            // Retrieve Item info
            //***************************************
            dg.Visible       = false;
            lbResult.Visible = false;
            if (item != null && culture != null)
            {
                // Update label for item name
                lbItemName.Text = item.Name + " (" + item.Level.Name + ")";
                if (item.Sku != string.Empty)
                {
                    lbItemName.Text = item.Sku + "-" + lbItemName.Text;
                }

                //using (ChunkList itemChunks = item.Chunks(culture.Code))
                using (HyperComponents.Data.dbAccess.Database dbObj = Utils.GetMainDB())
                {
                    string sSql = "EXECUTE dbo.QDE_GetItemCountryView " + item.Id + ", '" + culture.Code + "', 0 , 0";
                    using (DataSet ds = dbObj.RunSQLReturnDataSet(sSql, "chunks"))
                    {
                        if (ds != null)
                        {
                            dg.DataSource = ds.Tables[0];
                            Utils.InitGridSort(ref dg, false);
                            dg.DataBind();
                            lbcultureName.Text = culture.Name;
                            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "cultureCode", "<script>l='" + culture.Name + "';</script>");
                        }
                    }
                }
            }

            if (dg != null && dg.Rows != null && dg.Rows.Count > 0)
            {
                dg.Visible = true;
            }
            else
            {
                lbResult.Visible = true;
            }
        }
예제 #6
0
파일: TM.aspx.cs 프로젝트: GitJayanth/test3
        /// <summary>
        /// Display TM expressions
        /// </summary>
        private void UpdateDataView()
        {
            string            search = txtFilter.Text;
            TMExpressionsList _tm;
            string            sSql = String.Empty;

            #region Definition Search
            if (search != string.Empty) // Search on all expressions
            {
                string cleanSearch = search.Replace("'", "''").ToLower();
                cleanSearch = search.Replace("[", "[[]");
                cleanSearch = search.Replace("_", "[_]");
                cleanSearch = search.Replace("%", "[%]");
                if (cbMatch.Checked)
                {
                    sSql += " Lower(TMExpressionValue) = '" + cleanSearch.ToLower() + "' ";
                }
                else
                {
                    sSql += " Lower(TMExpressionValue) like '%" + cleanSearch.ToLower() + "%' ";
                }
            }
            #endregion
            using (HyperComponents.Data.dbAccess.Database dbObj = new HyperComponents.Data.dbAccess.Database(SessionState.CacheComponents["CRYSTAL_DB"].ConnectionString))
            {
                using (System.Data.SqlClient.SqlDataReader rs = dbObj.RunSPReturnRS("_TM_GetAll",
                                                                                    new System.Data.SqlClient.SqlParameter("@Filter", sSql),
                                                                                    new System.Data.SqlClient.SqlParameter("@Mode", 1),
                                                                                    new System.Data.SqlClient.SqlParameter("@Company", SessionState.CompanyName)))
                {
                    #region No result
                    rs.Read();
                    int c = Convert.ToInt32(rs["ResultCount"]);
                    if (c == 0)
                    {
                        lbNoresults.Text    = "No record match your search (" + txtFilter.Text + ")";
                        lbNoresults.Visible = lbMessage.Visible = true;
                        dg.Visible          = false;
                    }
                    #endregion
                    #region Results
                    else
                    {
                        #region Too much results
                        if (c > Convert.ToInt32(SessionState.CacheParams["TMMaxRows"].Value))
                        {
                            lbNoresults.Text    = "There are " + c.ToString() + " expressions found over " + SessionState.CacheParams["TMMaxRows"].Value + ", please refine your search.";
                            lbNoresults.Visible = lbMessage.Visible = true;
                            dg.Visible          = false;
                        }
                        #endregion
                        #region Display results
                        else
                        {
                            using (_tm = TMExpression.GetAll(sSql))
                            {
                                dg.DataSource                 = _tm;
                                dg.Columns[1].HeaderText      = "TM [" + _tm.Count.ToString() + " item(s) found]";
                                dg.Bands[0].ColHeadersVisible = Infragistics.WebUI.UltraWebGrid.ShowMarginInfo.Yes;
                                lbNoresults.Visible           = lbMessage.Visible = false;
                                Utils.InitGridSort(ref dg);
                                dg.DataBind();
                                dg.Visible = true;
                                #region PageIndex session
                                if (SessionState.tmPageIndexExpression != string.Empty)
                                {
                                    dg.DisplayLayout.Pager.CurrentPageIndex = Convert.ToInt32(SessionState.tmPageIndexExpression);
                                }
                                else
                                {
                                    dg.DisplayLayout.Pager.CurrentPageIndex = 1;
                                    SessionState.tmPageIndexExpression      = string.Empty;
                                }
                                #endregion
                            }
                        }
                        #endregion
                    }
                    dg.Columns.FromKey("ModifyDate").Format = SessionState.User.FormatDate + ' ' + SessionState.User.FormatTime;
                    rs.Close();
                    #endregion
                }
            }
        }
예제 #7
0
        private bool SavePassiveApproval()
        {
            string countryCode = txtCountryCodeValue.Text;
            bool   success     = true;

            if (dgPVGrid != null && dgPVGrid.Rows != null && dgPVGrid.Rows.Count > 0)
            {
                using (HyperComponents.Data.dbAccess.Database dbObj = Utils.GetMainDB())
                {
                    System.Text.StringBuilder sbSQL = new System.Text.StringBuilder(string.Empty);
                    string classId            = string.Empty;
                    string PLCode             = string.Empty;
                    bool   isActive           = false;
                    int    PassiveApprovalDay = 0;
                    bool   ActiveApproval     = false;

                    UltraGridRowsEnumerator ub = dgPVGrid.Bands[1].GetRowsEnumerator();
                    while (ub.MoveNext())
                    {
                        UltraGridRow dr = (UltraGridRow)ub.Current;
                        classId = dr.Cells.FromKey("ClassId").ToString();
                        if (dr.Cells.FromKey("Trigger").Value != null)
                        {
                            PassiveApprovalDay = (int)dr.Cells.FromKey("Trigger").Value;
                        }
                        else
                        {
                            PassiveApprovalDay = 0;
                        }

                        if (dr.Cells.FromKey("IsActive") != null)
                        {
                            ActiveApproval = (bool)dr.Cells.FromKey("IsActive").Value;

                            //Included for the QC 6660 for chardonnay release
                            if (ActiveApproval == true)
                            {
                                dr.Cells.FromKey("Trigger").Reset();
                            }
                        }
                        else
                        {
                            ActiveApproval = false;
                        }
                        PLCode = dr.Cells.FromKey("PLCode").ToString();
                        //Modified the below code to eliminate the null data in the passive trigger
                        //if (ActiveApproval == false && (PassiveApprovalDay == 0 || PassiveApprovalDay == null))
                        if (ActiveApproval == false && PassiveApprovalDay == null)
                        {
                            sbSQL.Append("DELETE FROM CountryApprovalTrigger WHERE CountryCode = '");
                            sbSQL.Append(countryCode);
                            sbSQL.Append("' AND ClassId = '");
                            sbSQL.Append(classId);
                            sbSQL.Append("' AND PLCode = '");
                            sbSQL.Append(PLCode);
                            sbSQL.Append("';");
                        }
                        else //if (ActiveApproval != false || PassiveApprovalDay != 0) Commented since this condition is of no use
                        {
                            if (ActiveApproval == true)
                            {
                                PassiveApprovalDay = 0;
                            }
                            sbSQL.Append("DELETE FROM CountryApprovalTrigger WHERE CountryCode = '");
                            sbSQL.Append(countryCode);
                            sbSQL.Append("' AND ClassId = '");
                            sbSQL.Append(classId);
                            sbSQL.Append("' AND PLCode = '");
                            sbSQL.Append(PLCode);
                            sbSQL.Append("';");
                            sbSQL.Append("INSERT INTO CountryApprovalTrigger VALUES('");
                            sbSQL.Append(countryCode);
                            sbSQL.Append("', ");
                            sbSQL.Append(classId);
                            sbSQL.Append(", ");
                            sbSQL.Append(PassiveApprovalDay);
                            sbSQL.Append(",");
                            sbSQL.Append(Convert.ToByte(ActiveApproval).ToString());
                            sbSQL.Append(",'");
                            sbSQL.Append(PLCode);
                            sbSQL.Append("');");
                        }
                    }


                    if (sbSQL != null && sbSQL.Length > 0)
                    {
                        Debug.Trace("Update CountryApprovalTrigger [" + sbSQL.ToString() + "]", DebugSeverity.Low);
                        dbObj.RunSQLQuery(sbSQL.ToString());
                        if (dbObj.LastError != null && dbObj.LastError.Length > 0)
                        {
                            Tools.UITools.SetMessage(mainMsgLbl, "Country \"" + txtCountryCodeValue.Text + "\" error when updating CountryApprovalTrigger [" + dbObj.LastError + "]", Tools.UITools.MessageLevel.Error);
                            return(false);
                        }
                    }
                }
            }
            return(true);
        }
예제 #8
0
        private void UpdateDataEdit(string countryCode)
        {
            if (countryCode != string.Empty)
            {
                currentCountry = Business.Country.GetByKey(countryCode);
            }
            else
            {
                currentCountry = null;
            }

            txtRegionCodeValue.ClearSelection();
            //using (ItemList classes = Item.GetAll("LevelId=1"))
            //{

            //  classes.Sort("Sort");
            //  dgPVGrid.DataSource = classes;
            using (HyperComponents.Data.dbAccess.Database dbObj = Utils.GetMainDB())
            {
                //using (ds = dbObj.RunSQLReturnDataSet("SELECT * From CountryApprovalTrigger WHERE CountryCode = @CountryCode", HyperComponents.Data.dbAccess.Database.NewSqlParameter("@CountryCode", System.Data.SqlDbType.NVarChar, 50, countryCode)))
                //{
                string sql = "select I.ItemId as ClassId, dbo.GetItemName(I.ItemId) as [PRODUCT TYPE NAME] from  Items I where I.LevelId = 1    ";
                //sql += "SELECT * From CountryApprovalTrigger WHERE CountryCode = '" + countryCode + "'";
                sql += "SELECT W.ItemId AS ClassId, W.PLCode AS PLCode, W.PLCode +' [' + BP.PLName + ']' AS ProductLine, CA.PassiveApprovalDay as [Trigger],CA.ActiveApproval as IsActive FROM Work_Item_ProductLines W ";
                sql += "INNER JOIN Items I ON I.ItemId = W.ItemId AND I.LevelId = 1 ";
                sql += "LEFT OUTER JOIN [CountryApprovalTrigger] CA ON CA.ClassId = W.ItemId AND CA.PLCode = W.PLCode AND CA.CountryCode = '" + countryCode + "' ";
                sql += "INNER JOIN BPL BP ON BP.PLCode = W.PLCode";

                //using (ds = dbObj.RunSQLReturnDataSet(sql.ToString()))
                //{
                //dbObj.CloseConnection();
                ds = dbObj.RunSQLReturnDataSet(sql.ToString());
                if (ds.Tables[0].Rows.Count > 0)
                {
                    DataColumn   parentColumn;
                    DataColumn   childColumn;
                    DataRelation relation;
                    parentColumn = ds.Tables[0].Columns["ClassId"];

                    childColumn = ds.Tables[1].Columns["ClassId"];


                    relation = new System.Data.DataRelation("ClassId", parentColumn, childColumn);
                    ds.Relations.Add(relation);
                }
            }
            if (currentCountry != null)
            {
                Debug.Trace("<br>txtCountryNameValue.Text=" + currentCountry.Name + ", txtRegionCodeValue.SelectedValue = " + currentCountry.RegionCode, DebugSeverity.Low);

                txtCountryNameValue.Text         = currentCountry.Name;
                txtCountryCodeValue.Text         = currentCountry.Code;
                cbEditContent.Checked            = currentCountry.CanLocalizeContent;
                cbEditCP.Checked                 = currentCountry.CanCreateProductInLocalLanguage;
                cbEditPLC.Checked                = currentCountry.CanLocalizePLC;
                cbEditMS.Checked                 = currentCountry.CanLocalizeMarketSegments;
                cbEditCS.Checked                 = currentCountry.CanLocalizeCrossSells;
                cbEditPublishers.Checked         = currentCountry.CanLocalizePublishers;
                cbTranslationPLC.Checked         = currentCountry.PLCDrivenTranslation;
                cbIsActive.Checked               = currentCountry.IsActive;
                cbPublishable.Checked            = currentCountry.Publishable;
                cbFallBackToEnglish.Checked      = currentCountry.FallBackToEnglish;
                txtRegionCodeValue.SelectedValue = currentCountry.RegionCode;
                _countries = Business.Region.GetByKey(currentCountry.RegionCode).Countries;
                txtCountryCodeValue.Enabled = false;

                UITools.ShowToolBarButton(propertiesToolBar, "Delete");
                UITools.ShowToolBarSeparator(propertiesToolBar, "DeleteSep");
            }
            else
            {
                cbIsActive.Checked       = true;
                txtCountryNameValue.Text = null;
                txtCountryCodeValue.Text = null;
                UITools.HideToolBarButton(propertiesToolBar, "Delete");
                UITools.HideToolBarSeparator(propertiesToolBar, "DeleteSep");
                if (regionList.SelectedValue != string.Empty)
                {
                    txtRegionCodeValue.SelectedValue = regionList.SelectedValue;
                }
                txtCountryCodeValue.Enabled = true;
            }
            dgPVGrid.DataSource = ds.Tables[0].DefaultView;
            //dgPVGrid.DataSource = ds;
            dgPVGrid.DataBind();
            dgPVGrid.Height = Unit.Empty;
            dgPVGrid.Width  = Unit.Empty;
            Utils.InitGridSort(ref dgPVGrid, false);
            foreach (UltraGridColumn use1 in dgPVGrid.Bands[1].Columns)
            {
                Response.Write(use1.Header.Title);
            }
            //}
            dgPVGrid.Bands[0].Columns[2].Hidden = true;
            dgPVGrid.Bands[1].Columns[5].Hidden = true;
            setPropertiesVisible(true);
        }
예제 #9
0
        protected void BtnDeleteTR_Click(object sender, EventArgs e)
        {
            //if (txtTRId.Text == string.Empty)
            //{
            //  txtTRMessage.Text = "Please provide a TR id.";
            //  txtTRMessage.CssClass = "hc_error";
            //  txtTRMessage.Visible = true;
            //  return;
            //}
            System.Int64 TRId = -1;
            UserList     usersList;

            try
            {
                TRId = Convert.ToInt64(ddlCurrentTRs.SelectedValue);
                #region Retrieve TR Users
                usersList = HyperCatalog.Business.User.GetTRNotificationUsers(TRId, SessionState.User.Id);
                #endregion
            }
            catch
            {
                txtTRMessage.Text     = "The TR id you provided is not valid.";
                txtTRMessage.CssClass = "hc_error";
                txtTRMessage.Visible  = true;
                return;
            }
            //HyperComponents.Data.dbAccess.Database dbObj = new HyperComponents.Data.dbAccess.Database(SessionState.CacheComponents["Crystal_DB"].ConnectionString);
            // QC 1232 CRYS : Issue when deleting TR (Increased the time-out parameter to 15 mins)
            HyperComponents.Data.dbAccess.Database dbObj = new HyperComponents.Data.dbAccess.Database(SessionState.CacheComponents["Crystal_DB"].ConnectionString, 900);
            dbObj.RunSPReturnInteger("_TR_Del",
                                     new System.Data.SqlClient.SqlParameter("@TRId", TRId.ToString()),
                                     new System.Data.SqlClient.SqlParameter("@UserId", SessionState.User.Id.ToString()),
                                     new System.Data.SqlClient.SqlParameter("@DeleteChunks", 1));
            if (dbObj.LastError != string.Empty)
            {
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "errTr", "<script>alert('An error occurred: " + dbObj.LastError + "');</script>");
            }
            else
            {
                #region Send mail
                if (usersList != null)
                {
                    string appName             = SessionState.CacheParams["AppName"].Value.ToString();
                    string supportInfo         = SessionState.CacheParams["SupportInfo"].Value.ToString();
                    string smtpServer          = SessionState.CacheParams["TREmailSmtpServer"].Value.ToString();
                    string fromEmail           = SessionState.CacheParams["TREmailFrom"].Value.ToString();
                    string mailConfidentiality = SessionState.CacheParams["MailConfidentiality"].Value.ToString();
                    string trPath = SessionState.CacheParams["TRPhysicalPath"].Value.ToString();
                    HyperComponents.Net.SMTP.EmailUtil m = new HyperComponents.Net.SMTP.EmailUtil();
                    m.FromEmail     = fromEmail;
                    m.strBody       = "The tr [" + TRId.ToString() + "] has been deleted by " + SessionState.User.FullName + ".\n<br>" + txtDeleteComment.Text + "\n<br>";
                    m.SmtpServer    = smtpServer;
                    m.Subject       = "[" + appName + "] - TR [" + TRId.ToString() + "] removed";
                    m.strWelcome    = "Dear user,\n<br><br>\n";
                    m.strSignature  = "<br>Your " + appName + " system administrator<br>\n";
                    m.strSignature += supportInfo.Replace(@"\n", @"<br/>");
                    m.strSignature += "<hr/>\n";
                    m.strSignature += "<FONT face='arial, helvetica, sans-serif' color=#5a7173 size=1>" + mailConfidentiality.Replace("\n", "<br>") + "</font>";
                    foreach (User u in usersList)
                    {
                        m.SendEmail(u.FullName, u.Email);
                    }
                }
                #endregion
                txtTRMessage.Text     = "TR [" + TRId.ToString() + "] deleted successfully.";
                txtTRMessage.CssClass = "hc_success";
                txtTRMessage.Visible  = true;
                LoadCurrentTRsToDelete();
            }
        }
예제 #10
0
        private void Save()
        {
            using (HyperComponents.Data.dbAccess.Database dbObj = Utils.GetMainDB())
            {
                // Default value
                lbError.Visible = false;
                lbError.Text    = string.Empty;

                if (pnlMasterPublishing.Visible)
                {
                    cbMasterPublishing.Visible = false;
                }

                bool   isClosed = false;
                string s        = string.Empty;
                if (rbDraft.Checked)
                {
                    s = HyperCatalog.Business.ChunkStatus.Draft.ToString();
                }
                else if (rbFinal.Checked)
                {
                    s = HyperCatalog.Business.ChunkStatus.Final.ToString();
                }

                Item curItem = item;
                curItem.RegionCode = culture.Code;

                if (item.GetRoll() != null && rdSoftRoll.Checked)
                {
                    curItem = item.GetRoll();
                }

                if (s.Length > 0)
                {
                    #region "Save Master publishing date if necessary"
                    if (cbMasterPublishing.Checked)
                    {
                        if (wdMasterPublishing.Value != null)
                        {
                            #region "Save Master Publishing Date Chunk"
                            if (SessionState.Culture.Type == HyperCatalog.Business.CultureType.Master)
                            {
                                // 69605 issue fix
                                // Use a SP to directly add/update the MPD chunk is ALL childs
                                DateTime d   = (DateTime)wdMasterPublishing.Value;
                                string   mpd = d.Month.ToString() + '/' + d.Day.ToString() + '/' + d.Year.ToString();
                                dbObj.RunSPReturnInteger("_Item_MPDAddUpd", new SqlParameter("@ItemId", curItem.Id), new SqlParameter("@IncludeChildren", cbWithChildren.Checked), new SqlParameter("@MasterPublishingDate", mpd), new SqlParameter("@UserId", SessionState.User.Id));
                            }
                            #endregion
                        }
                        else
                        {
                            // Error: missing Master Publishing Date
                            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "MissingMasterPublishingDate", "<script>alert('Please provide a valid [master publishing date]');</script>");
                            return;
                        }
                    }
                    #endregion

                    //// Modified by Prabhu for ACQ 3.0 (PCF1: Regional Project Management)-- 18/May/09
                    //// Comment out as not needed after Regional Project Management
                    //// You cannot override a region project date from master.
                    #region "Save Project Dates"

                    /*
                     * // if item is already a project
                     * curItem.Milestones.ItemId = curItem.Id;
                     * curItem.Milestones.RegionCode = culture.Code;
                     * if (curItem.Milestones != null && culture.Type == CultureType.Regionale && inputFormId < 0)
                     * {
                     *  if (!curItem.Milestones.Inherited)
                     *  {
                     *      bool updateProjectDate = false;
                     *      // Force Master Acquisition Date to be NOW since the validation is done
                     *      // The product can now be visibile at regional level
                     *      if (curItem.Milestones.BeginningOfRegionalization == null)
                     *      {
                     *          curItem.Milestones.BeginningOfRegionalization = DateTime.UtcNow;
                     *          updateProjectDate = true;
                     *      }
                     *      if ((curItem.Milestones.EndOfRegionalization.HasValue && curItem.Milestones.EndOfRegionalization > DateTime.UtcNow) || curItem.Milestones.EndOfRegionalization == null)
                     *      {
                     *          curItem.Milestones.EndOfRegionalization = DateTime.UtcNow;
                     *          updateProjectDate = true;
                     *      }
                     *      if(updateProjectDate)
                     *      {
                     *          if (!curItem.Milestones.Save(user.Id))
                     *          {
                     *              lbError.CssClass = "hc_error";
                     *              lbError.Text = HyperCatalog.Business.ItemDates.LastError;
                     *              lbError.Visible = true;
                     *              return;
                     *          }
                     *      }
                     *  }
                     * }
                     */
                    #endregion

                    //#region "Move status Draft, Rejected --> Final or Final, Rejected --> Draft, if possible" --Alternate for CR 5096
                    #region "Move status Draft --> Final or Final --> Draft, if possible"
                    HyperCatalog.Business.ChunkStatus status = (HyperCatalog.Business.ChunkStatus)Enum.Parse(typeof(HyperCatalog.Business.ChunkStatus), s);
                    if (!curItem.MoveContentToStatus(culture.Code, status, user.Id, cbWithChildren.Checked, inputFormId, containerMATFList))
                    {
                        lbError.CssClass = "hc_error";
                        lbError.Text     = HyperCatalog.Business.Item.LastError;
                        lbError.Visible  = true;
                        return;
                    }
                    else
                    {
                        if (culture.Code == SessionState.MasterCulture.Code && inputFormId < 0)
                        {
                            string includeChildren = cbWithChildren.Checked?"1":"0";
                            using (DataSet ds = dbObj.RunSQLReturnDataSet("NOTIFICATION_NotifyRegionalUsersMasterValidationOnMATF " + item.Id + ", " + includeChildren))
                            {
                                dbObj.CloseConnection();
                                if (dbObj.LastError != string.Empty)
                                {
                                    lbError.CssClass = "hc_error";
                                    lbError.Text     = "System was not able to notify regional users [" + dbObj.LastError + "]";
                                    lbError.Visible  = true;
                                }
                                else
                                {
                                    if (ds != null && ds.Tables.Count == 1)
                                    {
                                        string message = "New products are available at regional level, you can click <a href='";
                                        message += HyperCatalog.Business.ApplicationSettings.Components["Crystal_UI"].URI;
                                        message += "/UI/Collaborate/NPIReport.aspx'>here</a> to access the full list.";

                                        foreach (DataRow dr in ds.Tables[0].Rows)
                                        {
                                            Utils.SendMail(dr["Email"].ToString(), dr["FirstName"].ToString() + " " + dr["LastName"].ToString(), "New products in region notification", message, false);
                                        }
                                    }
                                }
                            }
                        }
                    }
                    #endregion

                    // ds contains all content
                    using (DataSet ds = dbObj.RunSPReturnDataSet("dbo._Item_GetAllContent", "Content",
                                                                 new SqlParameter("@ItemId", curItem.Id),
                                                                 new SqlParameter("@CultureCode", culture.Code),
                                                                 new SqlParameter("@InputFormId", inputFormId),
                                                                 new SqlParameter("@WithChildren", cbWithChildren.Checked),
                                                                 new SqlParameter("@MoveStatus", 1)))
                    {
                        dbObj.CloseConnection();
                        if (dbObj.LastError.Length > 0)
                        {
                            lbError.CssClass = "hc_error";
                            lbError.Text     = HyperCatalog.Business.Item.LastError;
                            lbError.Visible  = true;
                        }
                        else
                        {
                            #region "Force translation to draft"
                            if (cbForceTranslation.Checked && ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                            {
                                string containerList = string.Empty;
                                foreach (DataRow dr in ds.Tables[0].Rows)
                                {
                                    if (dr["ContainerId"] != null)
                                    {
                                        if (containerList.Length > 0)
                                        {
                                            containerList += ",";
                                        }
                                        containerList += dr["ContainerId"].ToString();
                                    }
                                }

                                if (containerList.Length > 0)
                                {
                                    if (!curItem.ForceTranslationsToDraft(culture.Code, containerList, user.Id))
                                    {
                                        lbError.CssClass = "hc_error";
                                        lbError.Text     = HyperCatalog.Business.Item.LastError;
                                        lbError.Visible  = true;
                                        return;
                                    }
                                }
                            }
                            #endregion

                            #region "Generate report"
                            if (cbReport.Checked && ds != null)
                            {
                                // Create report
                                GenerateReport(ds, curItem.Id);


                                // Refresh frame content and close window
                                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "closePopup", "<script>window.close();</script>");
                            }
                        }
                        #endregion
                    }

                    SessionState.CurrentItem = null;

                    // Refresh frame content and close window
                    if (SessionState.CurrentItem != null && SessionState.User.LastVisitedItem != SessionState.CurrentItem.Id)
                    {
                        SessionState.User.LastVisitedItem = curItem.Id;
                        SessionState.User.QuickSave();
                    }
                    if (SessionState.QDEChunk != null)
                    {
                        SessionState.QDEChunk.Dispose();
                    }
                    if (SessionState.QDEContainer != null)
                    {
                        SessionState.QDEContainer.Dispose();
                    }
                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "updateGrid", "<script>UpdateAndClose(1, " + inputFormId.ToString() + ");</script>");
                }
                else
                {
                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "MissingStatus", "<script>alert('Select the status (Draft or Final)');</script>");
                }
            }
        }
예제 #11
0
    //private int timeout = MIN_TIMEOUT;
    protected void Page_Load(object sender, EventArgs e)
    {
        string reportId, reportName;

        //BossLink.NavigateUrl = string.Empty;

        //AccessLink.ForeColor = System.Drawing.Color.Blue;
        reportId   = Request.QueryString["reportId"];
        reportName = Request.QueryString["reportName"];
        DataSet ds = new DataSet();

        dbObj = Utils.GetMainDB();
        dbObj.OpenConnection();
        dbQuery = dbObj.CreateSPQuery("Report_GetBossReports", new SqlParameter("@ReportName", reportName));
        ds      = dbQuery.RunAndReturnDataSet();
        dbObj.CloseConnection();
        if (ds != null && ds.Tables[0].Rows.Count > 0)
        {
            string tablestring = "";
            string header      = "";
            string _sCompany   = "";
            //Commeneted by Vidya 21/03/2016
            //int hpiReport = 0;
            //End
            int hpeReport = 0;
            tablestring = tablestring + "<table>";
            _sCompany   = ApplicationSettings.Parameters["BossReports"].Value.ToString();


            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                if (dr["BossDescription"].ToString().Contains(_sCompany))
                {
                    string strUrl = (string)HyperCatalog.Shared.SessionState.CacheParams["Boss_Link_HPI"].Value;
                    strUrl = strUrl + "&iDocID=" + dr["BossId"].ToString() + "&sDoc=" + dr["BossDescription"].ToString() + "&sType=wid&sRefresh=Y";
                    header = "<tr><th style='font-size:80%';height='20%'; Font-Names:'Arial'; Font-Size:'Small'>HPI Reports</tr></th>";
                    //Commeneted by Vidya 21/03/2016
                    //if (hpiReport ==0)
                    //tablestring = tablestring + header + "<tr><td style='font-size:80%';height='20%'; Font-Names:'Arial'; Font-Size:'Small'><a href=" + strUrl + " target='_blank'>" + dr["BossDescription"].ToString() + "</a></td></tr>";
                    //else
                    //tablestring = tablestring + "<tr><td style='font-size:80%';height='20%'; Font-Names:'Arial'; Font-Size:'Small'><a href=" + strUrl + " target='_blank'>" + dr["BossDescription"].ToString() + "</a></td></tr>";
                    //hpiReport = hpiReport + 1;
                }
                else
                {
                    string strUrl = (string)HyperCatalog.Shared.SessionState.CacheParams["BOSS_Link"].Value;
                    strUrl = strUrl + "&iDocID=" + dr["BossId"].ToString() + "&sDoc=" + dr["BossDescription"].ToString() + "&sType=wid&sRefresh=Y";
                    header = "<tr><th style='font-size:80%';height='20%'; Font-Names:'Arial'; Font-Size:'Small'>HPE Reports</tr></th>";
                    if (hpeReport == 0)
                    {
                        tablestring = tablestring + header + "<tr><td style='font-size:80%';height='20%'; Font-Names:'Arial'; Font-Size:'Small'><a href=" + strUrl + " target='_blank'>" + dr["BossDescription"].ToString() + "</a></td></tr>";
                    }
                    else
                    {
                        tablestring = tablestring + "<tr><td style='font-size:80%';height='20%'; Font-Names:'Arial'; Font-Size:'Small'><a href=" + strUrl + " target='_blank'>" + dr["BossDescription"].ToString() + "</a></td></tr>";
                    }
                    hpeReport = hpeReport + 1;
                }
            }
            tablestring        = tablestring + "</table>";
            divTable.InnerHtml = tablestring;
        }
        //BossLink.NavigateUrl = (strihow ng)HyperCatalog.Shared.SessionState.CacheParams["BOSS_Link"].Value;
        //BossLink.NavigateUrl = "http://bosspro-ci.atlanta.hp.com/OpenDocument/opendoc/openDocument.jsp?sIDType=CUID";
        //BossLink.NavigateUrl =  BossLink.NavigateUrl + "&reportId=" + reportId + "&reportName=" + reportName + "&sType=wid&sRefresh=Y";
    }