protected void btn_Move_Click(object sender, EventArgs e) { if (Page.IsValid) { for (int i = 0; i < ListView_ItemList.Items.Count; i++) { CheckBox chk_Selected = (CheckBox)ListView_ItemList.Items[i].FindControl("chk_Selected"); if (chk_Selected.Checked) { HiddenField hidden_ItemID = (HiddenField)ListView_ItemList.Items[i].FindControl("Hidden_ItemID"); Lib.ScriptMgr myScriptMgr = new Lib.ScriptMgr(); Lib.Script myScript = myScriptMgr.Get_Script_Content(hidden_ItemID.Value); if (myScript.CategoryID != CategoryTree_MoveTo.Selected_CategoryID) { e2Data[] UpdateData = { new e2Data("ScriptID", myScript.ScriptID), new e2Data("CategoryID", CategoryTree_MoveTo.Selected_CategoryID) }; myScriptMgr.Edit_Script_Content(UpdateData); // Switch Category CategoryMgr myCategoryMgr = new CategoryMgr(); myCategoryMgr.Move_ComponentInCategory_Item(myScript.CategoryID, CategoryTree_MoveTo.Selected_CategoryID, "076A591E-1BFE-47A7-8B40-D6621C7D3DF9"); } } } Control_Init(); } }
private void Control_Init() { if (DataEval.IsEmptyQuery(_scriptid)) { MultiView_Content.SetActiveView(View_New); } else { MultiView_Content.SetActiveView(View_Show); if (_isshared) { Lib.ScriptMgr myScriptMgr = new Lib.ScriptMgr(); Lib.Script myScript = myScriptMgr.Get_Script_Content(_contentid); _script_type = StringEnum.GetStringValue(myScript.Script_Type); _script_content = myScript.Script_Content; } string myCodeBlock_Script = ""; myCodeBlock_Script = "<script type=" + DataEval.QuoteText(_script_type) + " >" + "\n" + _script_content + "\n" + "</script>" + "\n"; Literal_TextContent.Text = string.Format("<Pre>{0}</Pre>", Server.HtmlEncode(myCodeBlock_Script)); } }
protected void btn_Delete_Click(object sender, EventArgs e) { if (Page.IsValid) { for (int i = 0; i < ListView_ItemList.Items.Count; i++) { CheckBox chk_Selected = (CheckBox)ListView_ItemList.Items[i].FindControl("chk_Selected"); if (chk_Selected.Checked) { HiddenField hidden_ItemID = (HiddenField)ListView_ItemList.Items[i].FindControl("Hidden_ItemID"); Lib.ScriptMgr myScriptMgr = new Lib.ScriptMgr(); Lib.Script myScript = myScriptMgr.Get_Script_Content(hidden_ItemID.Value); // Remove from Database myScriptMgr.Remove_Script_Content(hidden_ItemID.Value); // Remove Item from Category CategoryMgr myCategoryMgr = new CategoryMgr(); myCategoryMgr.Delete_ComponentInCategory_Item(myScript.CategoryID, "076A591E-1BFE-47A7-8B40-D6621C7D3DF9"); } } Control_Init(); } }
protected void btn_Update_Click(object sender, EventArgs e) { if (Page.IsValid) { Lib.ScriptMgr myScriptMgr = new Lib.ScriptMgr(); e2Data[] UpdateData = { new e2Data("ScriptID", _itemid), new e2Data("CategoryID", CategoryTree_Menu.Selected_CategoryID), new e2Data("Display_Name", tbx_DisplayName.Text), new e2Data("Script_Type", droplist_Script_Type.SelectedValue), new e2Data("Script_Content", tbx_TextContent.Text), new e2Data("LastUpdate_Date", DateTime.Now.ToString()), new e2Data("LastUpdate_UserID", Security.Users.UserStatus.Current_UserID(this.Page)) }; myScriptMgr.Edit_Script_Content(UpdateData); // Switch Category CategoryMgr myCategoryMgr = new CategoryMgr(); myCategoryMgr.Move_ComponentInCategory_Item(_source_categoryid, CategoryTree_Menu.Selected_CategoryID, "076A591E-1BFE-47A7-8B40-D6621C7D3DF9"); // Finish Update Close Window string _finishupdate_script = string.Format("CloseAndRebind({0});", DataEval.QuoteText("Module_ControlPanel")); ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "myScript", _finishupdate_script, true); } }
protected void btn_Update_Click(object sender, EventArgs e) { if (Page.IsValid) { Lib.ScriptMgr myScriptMgr = new Lib.ScriptMgr(); DateTime nowTime = DateTime.Now; string ScriptID = Nexus.Core.Tools.IDGenerator.Get_New_GUID(); e2Data[] UpdateData = { new e2Data("ScriptID", ScriptID), new e2Data("CategoryID", CategoryTree_Menu.Selected_CategoryID), new e2Data("Display_Name", tbx_DisplayName.Text), new e2Data("Script_Type", droplist_Script_Type.SelectedValue), new e2Data("Script_Content", tbx_TextContent.Text), new e2Data("Create_Date", nowTime.ToString()), new e2Data("LastUpdate_Date", nowTime.ToString()), new e2Data("LastUpdate_UserID", Security.Users.UserStatus.Current_UserID(this.Page)) }; myScriptMgr.Add_Script_Content(UpdateData); // Add Item to Category CategoryMgr myCategoryMgr = new CategoryMgr(); myCategoryMgr.Add_ComponentInCategory_Item(CategoryTree_Menu.Selected_CategoryID, "076A591E-1BFE-47A7-8B40-D6621C7D3DF9"); _iscreated = true; Control_Init(); } }
protected void CategoryTree_Menu_CategorySelected(object sender, RadTreeNodeEventArgs e) { if (CategoryTree_Menu.Selected_CategoryID != "-1") { Lib.ScriptMgr myScriptMgr = new Lib.ScriptMgr(); GridView_Items.DataSource = myScriptMgr.Get_Scripts(CategoryTree_Menu.Selected_CategoryID, null); GridView_Items.DataBind(); } }
private void ItemList_DataBind() { if (!DataEval.IsEmptyQuery(_category_selected)) { RadTabStrip_Commands.Visible = true; Lib.ScriptMgr myScriptMgr = new Lib.ScriptMgr(); ListView_ItemList.DataSource = myScriptMgr.Get_Scripts(_category_selected, null); ListView_ItemList.DataKeyNames = new string[] { "ScriptID" }; ListView_ItemList.DataBind(); CheckBox chk_SelectAll = (CheckBox)ListView_ItemList.FindControl("chk_SelectAll"); if (chk_SelectAll != null) { chk_SelectAll.Checked = false; } } }
private void Control_Init() { if (!DataEval.IsEmptyQuery(Request["ItemID"])) { Lib.ScriptMgr myScriptMgr = new Lib.ScriptMgr(); Lib.Script myScript = myScriptMgr.Get_Script_Content(Request["ItemID"]); tbx_DisplayName.Text = myScript.Display_Name; droplist_Script_Type.SelectedValue = myScript.Script_Type.ToString(); tbx_TextContent.Text = myScript.Script_Content; CategoryTree_Menu.Selected_CategoryID = myScript.CategoryID; _itemid = myScript.ScriptID; ViewState["ItemID"] = _itemid; _source_categoryid = myScript.CategoryID; ViewState["Source_CategoryID"] = _source_categoryid; } else { btn_Update.Enabled = false; } }
private void Control_Init() { if (_isshared) { Lib.ScriptMgr myScriptMgr = new Lib.ScriptMgr(); Lib.Script myScript = myScriptMgr.Get_Script_Content(_contentid); _script_type = StringEnum.GetStringValue(myScript.Script_Type); _script_content = myScript.Script_Content; } HtmlGenericControl myCodeBlock_ScriptTag = new HtmlGenericControl("script"); myCodeBlock_ScriptTag.Attributes.Add("type", _script_type); Literal myCodeBlock_ScriptText = new Literal(); myCodeBlock_ScriptText.Text = _script_content; myCodeBlock_ScriptTag.Controls.Add(myCodeBlock_ScriptText); PlaceHolder_Content.Controls.Add(myCodeBlock_ScriptTag); }
protected void btn_Update_Click(object sender, EventArgs e) { Lib.ScriptMgr myScriptMgr = new Lib.ScriptMgr(); DateTime nowTime = DateTime.Now; // Create New string ScriptID = Nexus.Core.Tools.IDGenerator.Get_New_GUID(); Control_Property[] Update_Properties = { }; #region Update for Control Data // Update Extra Database if (_isshared) { e2Data[] UpdateData = { new e2Data("ScriptID", _contentid), new e2Data("Script_Type", droplist_Script_Type.SelectedValue), new e2Data("Script_Content", tbx_TextContent.Text), new e2Data("LastUpdate_Date", nowTime.ToString()), new e2Data("LastUpdate_UserID", Security.Users.UserStatus.Current_UserID(this.Page)) }; myScriptMgr.Edit_Script_Content(UpdateData); } // Check Control is New if (DataEval.IsEmptyQuery(_scriptid)) { // Create Control Property Control_Property[] PropertieData = { new Control_Property(_page_controlid, "ScriptID", ScriptID), new Control_Property(_page_controlid, "Script_Type", droplist_Script_Type.SelectedValue), new Control_Property(_page_controlid, "Script_Content", tbx_TextContent.Text), new Control_Property(_page_controlid, "IsShared", _isshared.ToString()), new Control_Property(_page_controlid, "ContentID", _contentid) }; Update_Properties = PropertieData; } else { // Update Control Property Control_Property[] PropertieData = { new Control_Property(_page_controlid, "ScriptID", _scriptid), new Control_Property(_page_controlid, "Script_Type", droplist_Script_Type.SelectedValue), new Control_Property(_page_controlid, "Script_Content", tbx_TextContent.Text), new Control_Property(_page_controlid, "IsShared", _isshared.ToString()), new Control_Property(_page_controlid, "ContentID", _contentid) }; Update_Properties = PropertieData; } #endregion #region Update for Control Properties ControlMgr myControlMgr = new ControlMgr(); myControlMgr.Update_Control_Properties(_editmode, _scriptid, _page_controlid, Update_Properties); #endregion // Finish Update Close Window //OnFinishUpdate(this, EventArgs.Empty); string _finishupdate_script = string.Format("CloseAndRebind({0});", _page_controlid); ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "myScript", _finishupdate_script, true); }
private void Control_Init() { #region Default setting //Gets your enum names and adds it to a string array Array enumNames = Enum.GetValues(typeof(Lib.Script_Type)); //Creates an ArrayList ArrayList myScriptTypes = new ArrayList(); //Loop through your string array and poppulates the ArrayList foreach (Lib.Script_Type myScriptType in enumNames) { myScriptTypes.Add(new { Value = StringEnum.GetStringValue(myScriptType), Name = myScriptType.ToString() }); } //Bind the ArrayList to your DropDownList droplist_Script_Type.DataSource = myScriptTypes; droplist_Script_Type.DataTextField = "Name"; droplist_Script_Type.DataValueField = "Value"; droplist_Script_Type.DataBind(); tbx_TextContent.Text = ""; #endregion if (!DataEval.IsEmptyQuery(_scriptid)) { if (_isshared) { Lib.ScriptMgr myScriptMgr = new Lib.ScriptMgr(); Lib.Script myScript = myScriptMgr.Get_Script_Content(_contentid); _script_type = StringEnum.GetStringValue(myScript.Script_Type); ViewState["Script_Type"] = _script_type; _script_content = myScript.Script_Content; ViewState["Script_Content"] = _script_content; } droplist_Script_Type.SelectedValue = _script_type; tbx_TextContent.Text = _script_content; } else { if (_isshared) { Lib.ScriptMgr myScriptMgr = new Lib.ScriptMgr(); Lib.Script myScript = myScriptMgr.Get_Script_Content(_contentid); _script_type = StringEnum.GetStringValue(myScript.Script_Type); ViewState["Script_Type"] = _script_type; _script_content = myScript.Script_Content; ViewState["Script_Content"] = _script_content; droplist_Script_Type.SelectedValue = _script_type; tbx_TextContent.Text = _script_content; } } Reset_Buttons(); MultiView_Editor.SetActiveView(View_Editor); }