private void SaveChunk(ChunkStatus status, bool lockTranslations) { string error = string.Empty; string Value = txtValue.Text; if (uwToolbar.Items.FromKeyButton("ilb").Selected) { Value = HyperCatalog.Business.Chunk.BlankValue; } //ACQ10.0 Starts if (Value.Length <= 0) { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", "<script>alert('Please, enter a value!');</script>"); return; } //ACQ10.0 Ends if (chunk != null) // Test if user has made a change that allows database update { if (txtValue.Text != chunk.Text || ChunkComment1.Comment != chunk.Comment || status != chunk.Status) { chunk.Text = Value; chunk.Comment = ChunkComment1.Comment; chunk.Status = status; } } else { chunk = new HyperCatalog.Business.Chunk(itemId, containerId, culture.Code, Value, ChunkComment1.Comment, status, SessionState.User.Id); } if (chunk.Save(SessionState.User.Id)) { lbResult.Text = "<br/>Chunk saved!"; lbResult.CssClass = "hc_success"; if (Value == HyperCatalog.Business.Chunk.BlankValue) { Value = HyperCatalog.Business.Chunk.BlankText; } if (!lockTranslations) { chunk.ForceTranslationsTo(SessionState.User.Id, ChunkStatus.Draft); } SessionState.QDEChunk = chunk; Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "update", "<script>UpdateGrid('" + HyperCatalog.Business.Chunk.GetStatusFromEnum(chunk.Status) + "', '" + UITools.CleanJSString(Value) + "');</script>"); } else { lbResult.Text = "<br/>Error: " + HyperCatalog.Business.Chunk.LastError; lbResult.CssClass = "hc_error"; } lbResult.Visible = true; }
private void SaveChunk(ChunkStatus status, bool lockTranslations) { string error = string.Empty; string Value = txtValue.Text; if (uwToolbar.Items.FromKeyButton("ilb").Selected) { Value = HyperCatalog.Business.Chunk.BlankValue; } if (chunk != null) // Test if user has made a change that allows database update { if (txtValue.Text != chunk.Text || ChunkComment1.Comment != chunk.Comment || status != chunk.Status) { chunk.Text = Value; chunk.Comment = ChunkComment1.Comment; chunk.Status = status; } } else { chunk = new HyperCatalog.Business.Chunk(itemId, containerId, culture.Code, Value, ChunkComment1.Comment, status, SessionState.User.Id); } if (chunk.Save(SessionState.User.Id)) { //Added this line for QCs# 839 and 1028 chunk.ModifyDate = DateTime.UtcNow; //Added this line for QCs# 839 and 1028 lbResult.Text = "<br/>Chunk saved!"; lbResult.CssClass = "hc_success"; if (Value == HyperCatalog.Business.Chunk.BlankValue) { Value = HyperCatalog.Business.Chunk.BlankText; } Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "update", "<script>UpdateGrid('" + HyperCatalog.Business.Chunk.GetStatusFromEnum(chunk.Status) + "', '" + Value.Replace("'", "\\\'") + "');</script>"); if (!lockTranslations) { chunk.ForceTranslationsTo(SessionState.User.Id, ChunkStatus.Draft); SessionState.QDEChunk = chunk; } //Added this line for QCs# 839 and 1028 ChunkModifier1.Chunk = chunk; //Added this line for QCs# 839 and 1028 } else { lbResult.Text = "<br/>Error: " + HyperCatalog.Business.Chunk.LastError; lbResult.CssClass = "hc_error"; } }
public static void ForceTranslationsTo(HyperCatalog.Business.Chunk chunk, int userId, ChunkStatus status) { chunk.ForceTranslationsTo(userId, status); //SessionState.QDEChunk = null; }
private void SaveChunk(ChunkStatus status, bool lockTranslations) { string error = string.Empty; string Value = string.Empty; if (Request["rd"] != null || !dg.Columns.FromKey("InScope").ServerOnly || uwToolbar.Items.FromKeyButton("ilb").Selected) { //#ACQ10.0 Starts if (Request["rd"] == HyperCatalog.Business.Chunk.BlankText) { uwToolbar.Items.FromKeyButton("ilb").Pressed(true); uwToolbar.Items.FromKeyButton("ilb").Selected = true; } //#ACQ10.0 Ends if (uwToolbar.Items.FromKeyButton("ilb").Selected) { Value = HyperCatalog.Business.Chunk.BlankValue; } else if (Request["rd"] != null) // --> radion button (single choice) { if (ViewState["Source"].ToString() == "Lookup") { LookupValue lValue = LookupValue.GetByKey(Convert.ToInt32(Request["rd"])); Value = lValue.Text; } else { InputFormValue lValue = InputFormValue.GetByKey(Convert.ToInt32(Request["rd"])); Value = lValue.Text; } } else // (multi choice) { string separator = "; "; bool success = true; string curText = string.Empty; if (dg != null && dg.Rows != null && dg.Rows.Count > 0) { foreach (UltraGridRow r in dg.Rows) { if (Convert.ToBoolean(r.Cells.FromKey("InScope").Value)) { //#ACQ10.0 Stats Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "scrollview", "<script>rowIndex = " + e.Row.Index.ToString() + ";</script>"); if ((Convert.ToInt32(r.Cells.FromKey("Id").Value) != 0) && (Value.IndexOf(HyperCatalog.Business.Chunk.BlankValue) < 0)) { //#ACQ10.0 Ends if (ViewState["Source"].ToString() == "Lookup") { LookupValue lValue = LookupValue.GetByKey(Convert.ToInt32(r.Cells.FromKey("Id").Value)); curText = lValue.Text; } else { InputFormValue lValue = InputFormValue.GetByKey(Convert.ToInt32(r.Cells.FromKey("Id").Value)); curText = lValue.Text; } if (Value.Length > 0) { Value += separator.ToString(); } Value += curText; } else { Value = HyperCatalog.Business.Chunk.BlankValue; } } } } } //ACQ10.0 Starts //If the value is empty the user will get a message asking the select a value and no value will be saved into application if (Value.Length <= 0) { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", "<script>alert('Please, select a value!');</script>"); return; } //ACQ10.0 Ends if (chunk != null) // Test if user has made a change that allows database update { if (Value != chunk.Text || ChunkComment1.Comment != chunk.Comment || status != chunk.Status) { chunk.Text = Value; chunk.Comment = ChunkComment1.Comment; chunk.Status = status; } } else { chunk = new HyperCatalog.Business.Chunk(itemId, containerId, culture.Code, Value, ChunkComment1.Comment, status, SessionState.User.Id); } if (chunk.Save(SessionState.User.Id)) { //Added this line for QCs# 839 and 1028 chunk.ModifyDate = DateTime.UtcNow; //Added this line for QCs# 839 and 1028 lbResult.Text = "<br/>Chunk saved!"; lbResult.CssClass = "hc_success"; lbResult.Visible = true; if (chunk.Text == HyperCatalog.Business.Chunk.BlankValue) { chunk.Text = HyperCatalog.Business.Chunk.BlankText; } Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "update", "<script>UpdateGrid('" + HyperCatalog.Business.Chunk.GetStatusFromEnum(chunk.Status) + "', '" + UITools.CleanJSString(chunk.Text) + "');</script>"); if (!lockTranslations) { chunk.ForceTranslationsTo(SessionState.User.Id, ChunkStatus.Draft); SessionState.QDEChunk = chunk; } //Added this line for QCs# 839 and 1028 ChunkModifier1.Chunk = chunk; //Added this line for QCs# 839 and 1028 } else { lbResult.Text = "<br/>Error: " + HyperCatalog.Business.Chunk.LastError; lbResult.CssClass = "hc_error"; } } else { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", "<script>alert('Please, select a value!');</script>"); } }
private void SaveChunk(ChunkStatus status, bool lockTranslations) { string error = string.Empty; string imgValue = txtImagePath.Value; if (uwToolbar.Items.FromKeyButton("ilb").Selected) { imgValue = HyperCatalog.Business.Chunk.BlankValue; } //ACQ10.0 Starts if (imgValue.Length <= 0) { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", "<script>alert('Please, enter a value!');</script>"); return; } //ACQ10.0 Ends if (chunk != null) // Test if user has made a change that allows database update { if (imgValue != chunk.Text || ChunkComment1.Comment != chunk.Comment || status != chunk.Status) { chunk.Text = imgValue; chunk.Comment = ChunkComment1.Comment; chunk.Status = status; } } else { chunk = new HyperCatalog.Business.Chunk(itemId, containerId, culture.Code, imgValue, ChunkComment1.Comment, status, SessionState.User.Id); } if (chunk.Save(SessionState.User.Id)) { //Added this line for QCs# 839 and 1028 chunk.ModifyDate = DateTime.UtcNow; //Added this line for QCs# 839 and 1028 lbResult.Text = "<br/>Chunk saved!"; lbResult.CssClass = "hc_success"; if (imgValue == HyperCatalog.Business.Chunk.BlankValue) { imgValue = HyperCatalog.Business.Chunk.BlankText; } else { XmlDocument xmlInfo = new XmlDocument(); xmlInfo.LoadXml(HCPage.WSDam.ResourceGetByPath(imgValue)); System.Xml.XmlNode node = xmlInfo.DocumentElement; string fullPath = node.Attributes["uri"].InnerText; if (fullPath.ToLower().IndexOf("notfound") > 0 || fullPath == string.Empty) { fullPath = "/hc_v4/img/ed_notfound.gif"; } imgValue = "<img src='" + fullPath + "?thumbnail=1&size=40' title='" + imgValue + "' border=0/>"; } Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "update", "<script>UpdateGrid('" + HyperCatalog.Business.Chunk.GetStatusFromEnum(chunk.Status) + "', '" + imgValue.Replace("'", "\\\'") + "');</script>"); if (!lockTranslations) { chunk.ForceTranslationsTo(SessionState.User.Id, ChunkStatus.Draft); SessionState.QDEChunk = chunk; } //Added this line for QCs# 839 and 1028 ChunkModifier1.Chunk = chunk; //Added this line for QCs# 839 and 1028 } else { lbResult.Text = "<br/>Error: " + HyperCatalog.Business.Chunk.LastError; lbResult.CssClass = "hc_error"; } lbResult.Visible = true; }