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();
            }
        }
        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);
            }
        }
Exemplo n.º 3
0
        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);
        }