/// <summary> /// Sets data to database. /// </summary> protected void btnOK_Click(object sender, EventArgs e) { CheckConfigurationModification(); string errorMessage = new Validator() .NotEmpty(txtInternalStatusDisplayName.Text.Trim(), GetString("InternalStatus_Edit.errorDisplayName")) .NotEmpty(txtInternalStatusName.Text.Trim(), GetString("InternalStatus_Edit.errorCodeName")).Result; if (!ValidationHelper.IsCodeName(txtInternalStatusName.Text.Trim())) { errorMessage = GetString("General.ErrorCodeNameInIdentifierFormat"); } if (errorMessage == "") { // Check unique name for configured site DataSet ds = InternalStatusInfoProvider.GetInternalStatuses("InternalStatusName = '" + txtInternalStatusName.Text.Trim().Replace("'", "''") + "' AND ISNULL(InternalStatusSiteID, 0) = " + ConfiguredSiteID, null); InternalStatusInfo internalStatusObj = null; if (!DataHelper.DataSourceIsEmpty(ds)) { internalStatusObj = new InternalStatusInfo(ds.Tables[0].Rows[0]); } // if internalStatusName value is unique if ((internalStatusObj == null) || (internalStatusObj.InternalStatusID == mStatusId)) { // if internalStatusName value is unique -> determine whether it is update or insert if ((internalStatusObj == null)) { // get InternalStatusInfo object by primary key internalStatusObj = InternalStatusInfoProvider.GetInternalStatusInfo(mStatusId); if (internalStatusObj == null) { // create new item -> insert internalStatusObj = new InternalStatusInfo(); internalStatusObj.InternalStatusSiteID = ConfiguredSiteID; } } internalStatusObj.InternalStatusEnabled = chkInternalStatusEnabled.Checked; internalStatusObj.InternalStatusName = txtInternalStatusName.Text.Trim(); internalStatusObj.InternalStatusDisplayName = txtInternalStatusDisplayName.Text.Trim(); InternalStatusInfoProvider.SetInternalStatusInfo(internalStatusObj); URLHelper.Redirect("InternalStatus_Edit.aspx?statusid=" + Convert.ToString(internalStatusObj.InternalStatusID) + "&saved=1&siteId=" + SiteID); } else { // Show error message ShowError(GetString("InternalStatus_Edit.InternalStatusNameExists")); } } else { // Show error message ShowError(errorMessage); } }
protected void Page_Load(object sender, EventArgs e) { // Init header actions HeaderActions actions = CurrentMaster.HeaderActions; actions.ActionPerformed += new CommandEventHandler(HeaderActions_ActionPerformed); // New item action actions.ActionsList.Add(new HeaderAction() { Text = GetString("InternalStatus_List.NewItemCaption"), RedirectUrl = ResolveUrl("InternalStatus_Edit.aspx?siteId=" + SiteID), ImageUrl = GetImageUrl("Objects/Ecommerce_InternalStatus/add.png"), ControlType = HeaderActionTypeEnum.Hyperlink }); // Show copy from global link when not configuring global statuses. if (ConfiguredSiteID != 0) { // Show "Copy from global" link only if there is at least one global status DataSet ds = InternalStatusInfoProvider.GetInternalStatuses("InternalStatusSiteID IS NULL", null, 1, "InternalStatusSiteID"); if (!DataHelper.DataSourceIsEmpty(ds)) { actions.ActionsList.Add(new HeaderAction() { Text = GetString("general.copyfromglobal"), OnClientClick = "return ConfirmCopyFromGlobal();", ImageUrl = GetImageUrl("Objects/Ecommerce_InternalStatus/fromglobal.png"), CommandName = "copyFromGlobal", ControlType = HeaderActionTypeEnum.LinkButton }); // Register javascript to confirm generate string script = "function ConfirmCopyFromGlobal() {return confirm(" + ScriptHelper.GetString(GetString("com.ConfirmInternalStatusFromGlobal")) + ");}"; ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "ConfirmCopyFromGlobal", ScriptHelper.GetScript(script)); } } gridElem.OnAction += new OnActionEventHandler(gridElem_OnAction); gridElem.OnExternalDataBound += new OnExternalDataBoundEventHandler(gridElem_OnExternalDataBound); gridElem.ZeroRowsText = GetString("general.nodatafound"); // Configuring global records from specific site if ((ConfiguredSiteID == 0) && (SiteID != 0)) { ShowInformation(GetString("com.UsingGlobalSettings")); } // Filter records by site gridElem.WhereCondition = "ISNULL(InternalStatusSiteID, 0) = " + ConfiguredSiteID; }
protected void Page_Load(object sender, EventArgs e) { // Init header actions HeaderActions actions = CurrentMaster.HeaderActions; actions.ActionPerformed += HeaderActions_ActionPerformed; // New item action actions.ActionsList.Add(new HeaderAction { Text = GetString("InternalStatus_List.NewItemCaption"), RedirectUrl = ResolveUrl("InternalStatus_Edit.aspx?siteId=" + SiteID) }); // Show copy from global link when not configuring global statuses. if (ConfiguredSiteID != 0) { // Show "Copy from global" link only if there is at least one global status DataSet ds = InternalStatusInfoProvider.GetInternalStatuses(0).TopN(1); if (!DataHelper.DataSourceIsEmpty(ds)) { actions.ActionsList.Add(new HeaderAction { Text = GetString("general.copyfromglobal"), OnClientClick = "return ConfirmCopyFromGlobal();", CommandName = "copyFromGlobal", ButtonStyle = ButtonStyle.Default }); // Register javascript to confirm generate string script = "function ConfirmCopyFromGlobal() {return confirm(" + ScriptHelper.GetString(GetString("com.ConfirmInternalStatusFromGlobal")) + ");}"; ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "ConfirmCopyFromGlobal", ScriptHelper.GetScript(script)); } } gridElem.OnAction += gridElem_OnAction; // Show information about usage of global objects when used on site HandleGlobalObjectInformation(gridElem.ObjectType); // Filter records by site gridElem.WhereCondition = "ISNULL(InternalStatusSiteID, 0) = " + ConfiguredSiteID; }
protected void Page_Load(object sender, EventArgs e) { // Pagetitle this.CurrentMaster.Title.TitleText = GetString("InternalStatus_List.HeaderCaption"); this.CurrentMaster.Title.TitleImage = GetImageUrl("Objects/Ecommerce_InternalStatus/object.png"); this.CurrentMaster.Title.HelpTopicName = "internal_status_list"; this.CurrentMaster.Title.HelpName = "helpTopic"; // New item link string[,] actions = new string[2, 9]; actions[0, 0] = HeaderActions.TYPE_HYPERLINK; actions[0, 1] = GetString("InternalStatus_List.NewItemCaption"); actions[0, 2] = null; actions[0, 3] = ResolveUrl("InternalStatus_Edit.aspx?siteId=" + SiteID); actions[0, 4] = null; actions[0, 5] = GetImageUrl("Objects/Ecommerce_InternalStatus/add.png"); // Show copy from global link when not configuring global statuses. if (ConfiguredSiteID != 0) { // Show "Copy from global" link only if there is at least one global status DataSet ds = InternalStatusInfoProvider.GetInternalStatuses("InternalStatusSiteID IS NULL", null, 1, "InternalStatusSiteID"); if (!DataHelper.DataSourceIsEmpty(ds)) { actions[1, 0] = HeaderActions.TYPE_SAVEBUTTON; actions[1, 1] = GetString("general.copyfromglobal"); actions[1, 2] = "return ConfirmCopyFromGlobal();"; actions[1, 3] = null; actions[1, 4] = null; actions[1, 5] = GetImageUrl("Objects/Ecommerce_InternalStatus/fromglobal.png"); actions[1, 6] = "copyFromGlobal"; actions[1, 7] = String.Empty; actions[1, 8] = true.ToString(); // Register javascript to confirm generate string script = "function ConfirmCopyFromGlobal() {return confirm(" + ScriptHelper.GetString(GetString("com.ConfirmInternalStatusFromGlobal")) + ");}"; ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "ConfirmCopyFromGlobal", ScriptHelper.GetScript(script)); } } this.CurrentMaster.HeaderActions.Actions = actions; this.CurrentMaster.HeaderActions.ActionPerformed += new CommandEventHandler(HeaderActions_ActionPerformed); gridElem.OnAction += new OnActionEventHandler(gridElem_OnAction); gridElem.OnExternalDataBound += new OnExternalDataBoundEventHandler(gridElem_OnExternalDataBound); gridElem.ZeroRowsText = GetString("general.nodatafound"); // Configuring global records if (ConfiguredSiteID == 0) { // Select only global records gridElem.WhereCondition = "InternalStatusSiteID IS NULL"; // Show "using global settings" info message only if showing global store settings if (SiteID != 0) { lblGlobalInfo.Visible = true; lblGlobalInfo.Text = GetString("com.UsingGlobalSettings"); } } else { // Select only site-specific records gridElem.WhereCondition = "InternalStatusSiteID = " + ConfiguredSiteID; } }