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); } } } } }
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>"); } } }
//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"; }