private async Task RefreshModule(int modulenumber) { try { ModuleInformation moduleInformation = await _moduleManager.ReadModuleInformation(_deviceSpecification, Convert.ToByte(_deviceNumberTextBox.Text), modulenumber); if (_deviceSpecification.ControlType == ControlType.MRTYPE) { MrModuleControl control = _panelControl.Controls[modulenumber] as MrModuleControl; control.Information = moduleInformation; } else { ModuleControl control = _panelControl.Controls[modulenumber] as ModuleControl; control.Information = moduleInformation; } } catch (Exception e) { MessageErrorBox message = new MessageErrorBox(e.Message, "Не удалось прочитать информацию о модуле"); message.ShowErrorMessageForm(); _panelControl.Controls.Remove(_panelControl.Controls[modulenumber]); } }
public static void DecompressSDKAndTools() { //将额外工具移至工程目录 ModuleControl.MoveToolsToProject(); //将SDK移至工程目录备份 ModuleControl.MoveSDKToTemp(); }
/// <inheritdoc cref="IViewManager.SaveModuleControlAsync(ModuleControlInfo)" /> public async Task <bool> SaveModuleControlAsync(ModuleControlInfo moduleControlInfo) { if (moduleControlInfo is null) { return(false); } ModuleControl moduleControl = await _dbContext.KastraModuleControls .SingleOrDefaultAsync(mc => mc.ModuleControlId == moduleControlInfo.ModuleControlId); ModuleDefinitionInfo moduleDef = await GetModuleDefAsync(moduleControlInfo.ModuleDefId); if (moduleDef is null) { return(false); } moduleControl = moduleControlInfo.ToModuleControl(); if (moduleControl.ModuleControlId > 0) { _dbContext.KastraModuleControls.Update(moduleControl); } else { _dbContext.KastraModuleControls.Add(moduleControl); } await _dbContext.SaveChangesAsync(); // Clear cache _cacheEngine.ClearCacheContains("Module"); return(true); }
static void Main(string[] args) { ModuleControl moduleControl = new ModuleControl(); //затримка Console.ReadKey(); }
/// <summary> /// 由一行数据得到一个实体 /// </summary> /// <param name="dr">SqlDataReader对象</param> /// <returns>实体对象</returns> private ModuleControl GetModel(SqlDataReader dr) { ModuleControl model = new ModuleControl(); model.ID = dbHelper.GetInt(dr["ID"]); model.ControlName = dbHelper.GetString(dr["ControlName"]); model.ModuleID = dbHelper.GetInt(dr["ModuleID"]); model.ControlValue = dbHelper.GetInt(dr["ControlValue"]); model.OrderID = dbHelper.GetInt(dr["OrderID"]); return(model); }
public MainWindow() { InitializeComponent(); StationManager.Initialize(2); var owner = new InitializationNavigationModel(this); NavigationManager.Instance.Initialize(owner); var process = new ProcessControl(); var model = new ModuleControl(); owner.ViewsDictionary.Add(ViewType.Processes, process); owner.ViewsDictionary.Add(ViewType.Modules, model); StationManager.ViewsNavigatable[0] = process; StationManager.ViewsNavigatable[1] = model; NavigationManager.Instance.Navigate(ViewType.Processes); }
/// <summary> /// Convert ModuleControl to ModuleControleInfo. /// </summary> /// <param name="moduleControl">Module control</param> /// <returns>Module control info</returns> public static ModuleControlInfo ToModuleControlInfo(this ModuleControl moduleControl) { if (moduleControl is null) { return(null); } return(new ModuleControlInfo() { ModuleControlId = moduleControl.ModuleControlId, KeyName = moduleControl.KeyName, ModuleDefId = moduleControl.ModuleDefinitionId, Path = moduleControl.Path, ModuleDefinition = moduleControl.ModuleDefinition.ToModuleDefinitionInfo() }); }
private async void SetModuleControl() { _panelControl.Controls.Clear(); ModuleControl control = new ModuleControl(); ModuleInformation moduleInformation = await _moduleManager.ReadModuleInformation(_deviceSpecification, Convert.ToByte(_deviceNumberTextBox.Text), 0); control.Information = moduleInformation; control.Anchor = (AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top); control.Dock = DockStyle.Top; control.TypeModule = _deviceSpecification.ModuleTypes[0]; (control as IModuleControlInerface).NeedRefreshAction += (i) => { RefreshModule(i); }; _panelControl.Controls.Add(control); }
/// <summary> /// 相同地标的AGV地图上分开距离 /// </summary> private static void InitAgvMapSpan() { foreach (AGV agv in AGVS) { if (agv.IsAlive && agv.IsAgvDev) {//在线停止中 ModuleControl.AddAgvToMapNew(agv.IsAlive, agv.Name, agv.Site, agv.Point, GetRate(agv.Site + "")); } if (ConstBA.IsShow_OffLineAGV && !agv.IsAlive && agv.IsAgvDev) {//显示离线AGV ModuleControl.AddAgvToMapNew(agv.IsAlive, agv.Name, agv.Site, agv.Point, GetRate(agv.Site + "")); } } ConstBA.Init_ShowLineAGV = false; }
/// <summary> /// 增加一条数据 /// </summary> /// <param name="ID">编号ID</param> /// <returns>返回影响行数</returns> public int Add(ModuleControl model) { StringBuilder strSql = new StringBuilder(); strSql.Append("INSERT INTO " + tablePrefix + "ModuleControl("); strSql.Append("ControlName,ModuleID,ControlValue,OrderID)"); strSql.Append(" VALUES ("); strSql.Append("@ControlName,@ModuleID,@ControlValue,@OrderID)"); SqlParameter[] cmdParms = { AddInParameter("@ControlName", SqlDbType.NVarChar, 20, model.ControlName), AddInParameter("@ModuleID", SqlDbType.Int, 4, model.ModuleID), AddInParameter("@ControlValue", SqlDbType.Int, 4, model.ControlValue), AddInParameter("@OrderID", SqlDbType.Int, 4, model.OrderID) }; return(dbHelper.ExecuteNonQuery(CommandType.Text, strSql.ToString(), cmdParms)); }
private void LoadChilds(IList<Clay.Logic.Modules.Control> controls, BControl bc) { foreach (Clay.Logic.Modules.Control item in controls) { BControl child = null; switch (item.Type) { case Enums.ControlType.Div: child = new Div { ID = item.ID, Float = item.Float, Clear = item.Clear, Width = item.Width, IsViewItem = item.IsViewItem, IsPanel = item.IsPanel }; break; case Enums.ControlType.Module: child = new ModuleControl { ID = item.ID, ModuleName = item.ModuleName }; break; } bc.Controls.Add(child); LoadChilds(item.Controls, child); } }
public JsonResult SaveModuleCopy(int idModule) { var msg = new JsonMessage { Erros = false, Message = "Thêm mới thành công." }; try { var idPage = Request["sl-sysPage"]; var model = _dl.GetModuleControl(idModule); var item = new ModuleControl { PageID = int.Parse(idPage), Action = model.Action, Module = model.Module, Section = model.Section, Sort = model.Sort }; _dl.Add(item); _dl.Save(); if (model.Action.ToLower().Equals(("ModuleHTML").ToLower())) { var html = _dl.GetHtmlMapById(idModule).FirstOrDefault(); var htmlnew = new HtmlMap { IdHtml = html.IdHtml, IdModule = item.Id }; _dl.Add(htmlnew); _dl.Save(); } } catch (Exception) { msg.Erros = true; msg.Message = "Có lỗi xảy ra"; } return(Json(msg)); }
/// <summary> /// 更新一条数据 /// </summary> /// <param name="model">实体对象</param> /// <returns>返回影响行数</returns> public int Update(ModuleControl model) { StringBuilder strSql = new StringBuilder(); strSql.Append("UPDATE " + tablePrefix + "ModuleControl SET "); strSql.Append("ControlName=@ControlName,"); strSql.Append("ModuleID=@ModuleID,"); strSql.Append("ControlValue=@ControlValue,"); strSql.Append("OrderID=@OrderID"); strSql.Append(" WHERE ID=@ID"); SqlParameter[] cmdParms = { AddInParameter("@ControlName", SqlDbType.NVarChar, 20, model.ControlName), AddInParameter("@ModuleID", SqlDbType.Int, 4, model.ModuleID), AddInParameter("@ControlValue", SqlDbType.Int, 4, model.ControlValue), AddInParameter("@OrderID", SqlDbType.Int, 4, model.OrderID), AddInParameter("@ID", SqlDbType.Int, 4, model.ID) }; return(dbHelper.ExecuteNonQuery(CommandType.Text, strSql.ToString(), cmdParms)); }
public static void UpdateAgvMap() { foreach (AGV agv in AGVS) { if (agv.IsAlive && agv.IsAgvDev && agv.IsRunning) { //在线运动中 ModuleControl.UpdateAgvSiteNew(agv.IsAlive, agv.Name, agv.Site, agv.Point); //走动 } else if (agv.IsAlive && agv.IsAgvDev && !agv.IsRunning) {//在线停止中 ModuleControl.AddAgvToMapNew(agv.IsAlive, agv.Name, agv.Site, agv.Point, 0); } else if (ConstBA.IsShow_OffLineAGV && !agv.IsAlive && agv.IsAgvDev) {//显示离线AGV ModuleControl.AddAgvToMapNew(agv.IsAlive, agv.Name, agv.Site, agv.Point, 0); } else if (!ConstBA.IsShow_OffLineAGV && !agv.IsAlive && agv.IsAgvDev) {//移除离线AGV ModuleControl.RemoveAgvModule(agv.Name); } } }
private void UserControl_Loaded_1(object sender, RoutedEventArgs e) { dhModule objMod = new dhModule(); //objMod.IModuleID = MuduleID; // if (objUser != null) // { //#region "Allowed Menu" objMod.AllowdModule = Globalized.objAppPreference.VEnableModules; objMod.IModuleParentID = 0; dsGeneral.dtPosModuleDataTable dtm = iFacede.GetModule(Globalized.ObjDbName, objMod); ObservableCollection <dhModule> sequence = ReflectionUtility.DataTableToObservableCollection <dhModule>(dtm); List <string> Ids = Globalized.ObjCurrentUser.VAllowdModule.Split(',').ToList <string>(); ModuleControl objModuleToadd = new ModuleControl(); MControls.Children.Clear(); foreach (dhModule item in sequence) { string Contian = Ids.Distinct <string>().Cast <string>().Where(i => i.Equals(item.IModuleID.ToString())).SingleOrDefault(); if ((Contian == null) || (item.IModuleParentID != 0)) { continue; } else { MControls.Children.Add(objModuleToadd = new ModuleControl(item.IModuleID)); } } //int length = 7; ////MControls //ModuleControl Test = new ModuleControl(); //for (int i = 0; i < length; i++) //{ //} }
/// <inheritdoc cref="IViewManager.DeleteModuleControlAsync(int)" /> public async Task <bool> DeleteModuleControlAsync(int moduleControlId) { if (moduleControlId < 1) { return(false); } ModuleControl moduleControl = await _dbContext.KastraModuleControls .SingleOrDefaultAsync(p => p.ModuleControlId == moduleControlId); if (moduleControl is null) { return(false); } _dbContext.KastraModuleControls.Remove(moduleControl); await _dbContext.SaveChangesAsync(); // Clear cache _cacheEngine.ClearCacheContains("Module"); return(true); }
public ModuleBuilder SetControl(ModuleControl control) { _control = control; return(this); }
public bool SaveModule(string doAction) { try { var sys = new ModuleControl(); var ctrId = Request["ctrId"]; switch (doAction) { case "add": UpdateModel(sys); sys.CreateDate = DateTime.Now; sys.LanguageID = Fdisystem.LanguageId; _da.Add(sys); _da.Save(); break; case "edit": sys = _da.GetItemModule(int.Parse(ctrId)); UpdateModel(sys); _da.Save(); break; case "copy": var cp = _da.GetItemModule(int.Parse(ctrId)); UpdateModel(sys); sys.Module = cp.Module; sys.Action = cp.Action; sys.Sort = cp.Sort; sys.CreateDate = DateTime.Now; _da.Add(sys); _da.Save(); if (cp.Module == "Html") { var itemHtml = _da.GetHtmlMap(int.Parse(ctrId)); var newhtml = new HtmlMap { IdCopy = int.Parse(ctrId), IdHtml = itemHtml.IdHtml, IdModule = sys.Id, LanguageId = Utility.Getcookie("LanguageId") }; _da.Add(newhtml); _da.Save(); } break; case "delete": sys = _da.GetItemModule(int.Parse(ctrId)); if (sys.Module == "Html") { var idhtml = sys.HtmlMaps.FirstOrDefault().IdHtml; var count = _da.GetCountHtmlMap(idhtml ?? 0); if (count <= 1) { var htmlcontent = _da.GetHtmlContent(idhtml ?? 0); _da.Delete(htmlcontent); } } _da.Delete(sys); _da.Save(); break; case "layout": var pageId = Request["pageId"]; var layout = Request["LayoutNew"]; var page = _pageDa.Get(int.Parse(pageId)); page.Layout = layout; _pageDa.Save(); break; } return(true); } catch { return(false); } }
private void BindUserSpace() { spanSpace.Visible = false; pnlViewSpace.Visible = false; pnlEditSpace.Visible = false; lnkCurrentPage.Text = PortalUtils.GetLocalizedPageName(PortalUtils.GetCurrentPageId()); if (PanelSecurity.PackageId > 0) { // space PackageInfo package = ES.Services.Packages.GetPackage(PanelSecurity.PackageId); if (package != null) { spanSpace.Visible = true; pnlViewSpace.Visible = true; lnkSpace.Text = PortalAntiXSS.EncodeOld(package.PackageName); lnkSpace.NavigateUrl = PortalUtils.GetSpaceHomePageUrl(package.PackageId); cmdSpaceName.Text = PortalAntiXSS.EncodeOld(package.PackageName); lblSpaceDescription.Text = PortalAntiXSS.EncodeOld(package.PackageComments); UserInfo user = UsersHelper.GetUser(PanelSecurity.SelectedUserId); if (user != null) { lblUserAccountName.Text = PortalAntiXSS.EncodeOld(string.Format("{0} -", user.Username)); } lnkCurrentPage.NavigateUrl = PortalUtils.NavigatePageURL( PortalUtils.GetCurrentPageId(), "SpaceID", PanelSecurity.PackageId.ToString()); } } else { pnlViewUser.Visible = true; // user UserInfo user = UsersHelper.GetUser(PanelSecurity.SelectedUserId); if (user != null) { lblUsername.Text = user.Username; lnkCurrentPage.NavigateUrl = PortalUtils.NavigatePageURL( PortalUtils.GetCurrentPageId(), "UserID", PanelSecurity.SelectedUserId.ToString()); } } // organization bool orgVisible = (PanelRequest.ItemID > 0 && Request[DefaultPage.PAGE_ID_PARAM].Equals(PID_SPACE_EXCHANGE_SERVER, StringComparison.InvariantCultureIgnoreCase)); spanOrgn.Visible = orgVisible; if (orgVisible) { // load organization details Organization org = ES.Services.Organizations.GetOrganization(PanelRequest.ItemID); lnkOrgn.NavigateUrl = PortalUtils.EditUrl( "ItemID", PanelRequest.ItemID.ToString(), ORGANIZATION_CONTROL_KEY, "SpaceID=" + PanelSecurity.PackageId.ToString()); lnkOrgn.Text = org.Name; string curCtrlKey = PanelRequest.Ctl.ToLower(); string ctrlKey = PortalUtils.GetGeneralESControlKey(Request[DefaultPage.CONTROL_ID_PARAM].ToLower(System.Globalization.CultureInfo.InvariantCulture)); if (curCtrlKey == "edit_user") { ctrlKey = PanelRequest.Context.ToLower() == "user" ? "users" : "mailboxes"; } ModuleDefinition definition = PortalConfiguration.ModuleDefinitions[EXCHANGE_SERVER_MODULE_DEFINTION_ID]; ModuleControl control = null; if (!String.IsNullOrEmpty(ctrlKey) && definition.Controls.ContainsKey(ctrlKey)) { control = definition.Controls[ctrlKey]; } if (control != null) { if (!String.IsNullOrEmpty(control.Src)) { lnkOrgCurPage.Text = PortalUtils.GetLocalizedString(DM_FOLDER_VIRTUAL_PATH + control.Src, PAGE_NANE_KEY); lnkOrgCurPage.NavigateUrl = PortalUtils.EditUrl( "ItemID", PanelRequest.ItemID.ToString(), ctrlKey, "SpaceID=" + PanelSecurity.PackageId.ToString()); } } } }
private void Create() { //Create new Folder string folderMapPath = Server.MapPath(string.Format("~/DesktopModules/RazorModules/{0}", txtFolder.Text)); if (Directory.Exists(folderMapPath)) { UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("FolderExists", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError); return; } else { //Create folder Directory.CreateDirectory(folderMapPath); } //Create new Module Control string moduleControlMapPath = folderMapPath + "/" + ModuleControl; try { using (var moduleControlWriter = new StreamWriter(moduleControlMapPath)) { moduleControlWriter.Write(Localization.GetString("ModuleControlText.Text", LocalResourceFile)); moduleControlWriter.Flush(); } } catch (Exception ex) { Exceptions.LogException(ex); UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("ModuleControlCreationError", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError); return; } //Copy Script to new Folder string scriptSourceFile = Server.MapPath(string.Format(razorScriptFileFormatString, scriptList.SelectedValue)); string scriptTargetFile = folderMapPath + "/" + scriptList.SelectedValue; try { File.Copy(scriptSourceFile, scriptTargetFile); } catch (Exception ex) { Exceptions.LogException(ex); UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("ScriptCopyError", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError); return; } //Create new Manifest in target folder string manifestMapPath = folderMapPath + "/" + ModuleControl.Replace(".ascx", ".dnn"); try { using (var manifestWriter = new StreamWriter(manifestMapPath)) { string manifestTemplate = Localization.GetString("ManifestText.Text", LocalResourceFile); string manifest = string.Format(manifestTemplate, txtName.Text, txtDescription.Text, txtFolder.Text, ModuleControl, scriptList.SelectedValue); manifestWriter.Write(manifest); manifestWriter.Flush(); } } catch (Exception ex) { Exceptions.LogException(ex); UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("ManifestCreationError", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError); return; } //Register Module ModuleDefinitionInfo moduleDefinition = ImportManifest(manifestMapPath); //Optionally goto new Page if (chkAddPage.Checked) { string tabName = "Test " + txtName.Text + " Page"; string tabPath = Globals.GenerateTabPath(Null.NullInteger, tabName); int tabID = TabController.GetTabByTabPath(ModuleContext.PortalId, tabPath, ModuleContext.PortalSettings.CultureCode); if (tabID == Null.NullInteger) { //Create a new page var newTab = new TabInfo(); newTab.TabName = "Test " + txtName.Text + " Page"; newTab.ParentId = Null.NullInteger; newTab.PortalID = ModuleContext.PortalId; newTab.IsVisible = true; newTab.TabID = new TabController().AddTabBefore(newTab, ModuleContext.PortalSettings.AdminTabId); var objModule = new ModuleInfo(); objModule.Initialize(ModuleContext.PortalId); objModule.PortalID = ModuleContext.PortalId; objModule.TabID = newTab.TabID; objModule.ModuleOrder = Null.NullInteger; objModule.ModuleTitle = moduleDefinition.FriendlyName; objModule.PaneName = Globals.glbDefaultPane; objModule.ModuleDefID = moduleDefinition.ModuleDefID; objModule.InheritViewPermissions = true; objModule.AllTabs = false; var moduleCtl = new ModuleController(); moduleCtl.AddModule(objModule); Response.Redirect(Globals.NavigateURL(newTab.TabID), true); } else { UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("TabExists", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError); } } else { //Redirect to main extensions page Response.Redirect(Globals.NavigateURL(), true); } }
/// <summary> /// 更新一条数据 /// </summary> /// <param name="model">实体对象</param> /// <returns>返回影响行数</returns> public int Update(ModuleControl model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> /// <param name="model">实体对象</param> /// <returns>返回影响行数</returns> public int Add(ModuleControl model) { return(dal.Add(model)); }
public int SaveModule(string key) { try { if (key != Keyapi) { return(0); } var doAction = Request["DoAction"]; var ctrId = Convert.ToInt32(Request["ctrId"]); var pageId = Convert.ToInt32(Request["PageID"]); var action = Request["Action"]; var module = Request["Module"]; var section = Request["Section"]; var sort = Convert.ToInt32(Request["Sort"]); var sys = new ModuleControl(); switch (doAction) { case "add": UpdateModel(sys); sys.CreateDate = DateTime.Now; sys.Action = action; sys.AgencyID = Agencyid(); sys.PageID = pageId; sys.LanguageID = "vi"; _dl.Add(sys); _dl.Save(); break; case "edit": sys = _dl.GetItemModule(ctrId); sys.Action = action; sys.Module = module; sys.Section = section; sys.Sort = sort; _dl.Save(); break; case "copy": var cp = _dl.GetItemModule(ctrId); UpdateModel(sys); sys.Module = cp.Module; sys.Action = cp.Action; sys.AgencyID = Agencyid(); sys.LanguageID = "vi"; sys.Sort = cp.Sort; sys.CreateDate = DateTime.Now; _dl.Add(sys); _dl.Save(); if (cp.Module == "Html") { var itemHtml = _dl.GetHtmlMap(ctrId); var newhtml = new HtmlMap { IdCopy = ctrId, IdHtml = itemHtml.IdHtml, IdModule = sys.Id, LanguageId = Utility.Getcookie("LanguageId") }; _dl.Add(newhtml); _dl.Save(); } break; case "delete": sys = _dl.GetItemModule(ctrId); if (sys.Module == "Html") { var idhtml = sys.HtmlMaps.FirstOrDefault().IdHtml; var count = _dl.GetCountHtmlMap(idhtml ?? 0); if (count <= 1) { var htmlcontent = _dl.GetHtmlContent(idhtml ?? 0); _dl.Delete(htmlcontent); } } _dl.Delete(sys); _dl.Save(); break; case "layout": var layout = Request["LayoutNew"]; var page = _pageDa.Get(pageId); page.Layout = layout; _pageDa.Save(); break; } return(1); } catch { return(0); } }
public void Add(ModuleControl obj) { FDIDB.ModuleControls.Add(obj); }
public void Delete(ModuleControl item) { FDIDB.ModuleControls.Remove(item); }
public override PaFolderCollection ReadDnn() { //This is a very long subroutine and should probably be broken down //into a couple of smaller routines. That would make it easier to //maintain. InstallerInfo.Log.StartJob(DNN_Reading); //Determine if XML conforms to designated schema ArrayList DnnErrors = ValidateDnn(); if (DnnErrors.Count == 0) { InstallerInfo.Log.AddInfo(DNN_ValidSkinObject); PaFolderCollection Folders = new PaFolderCollection(); XmlDocument doc = new XmlDocument(); MemoryStream buffer = new MemoryStream(InstallerInfo.DnnFile.Buffer, false); doc.Load(buffer); InstallerInfo.Log.AddInfo(XML_Loaded); XmlNode dnnRoot = doc.DocumentElement; int TempModuleDefinitionID = 0; XmlElement FolderElement; foreach (XmlElement tempLoopVar_FolderElement in dnnRoot.SelectNodes("folders/folder")) { FolderElement = tempLoopVar_FolderElement; //We will process each folder individually. So we don't need to keep //as much in memory. //As we loop through each folder, we will save the data PaFolder Folder = new PaFolder(); //The folder/name node is a required node. If empty, this will throw //an exception. try { Folder.Name = FolderElement.SelectSingleNode("name").InnerText.Trim(); } catch (Exception) { throw (new Exception(EXCEPTION_FolderName)); } // in V2 the FriendlyName/FolderName/ModuleName attributes were not supported in the *.dnn file, // so set them to the Folder Name Folder.FriendlyName = Folder.Name; Folder.FolderName = Folder.Name; Folder.ModuleName = Folder.Name; XmlElement resourcefileElement = (XmlElement)FolderElement.SelectSingleNode("resourcefile"); if (resourcefileElement != null) { if (resourcefileElement.InnerText.Trim() != "") { Folder.ResourceFile = resourcefileElement.InnerText.Trim(); PaFile paRF = (PaFile)InstallerInfo.FileTable[Folder.ResourceFile.ToLower()]; if (paRF == null) { InstallerInfo.Log.AddFailure(EXCEPTION_MissingResource + Folder.ResourceFile); } else { paRF.Path = Folder.ResourceFile; } } } // loading files InstallerInfo.Log.AddInfo(FILES_Loading); XmlElement file; foreach (XmlElement tempLoopVar_file in FolderElement.SelectNodes("files/file")) { file = tempLoopVar_file; //The file/name node is a required node. If empty, this will throw //an exception. string name; try { name = file.SelectSingleNode("name").InnerText.Trim(); } catch (Exception) { throw (new Exception(EXCEPTION_FileName)); } PaFile paf = (PaFile)InstallerInfo.FileTable[name.ToLower()]; if (paf == null) { InstallerInfo.Log.AddFailure(FILE_NotFound + name); } else { //A file path may or may not exist XmlElement pathElement = (XmlElement)file.SelectSingleNode("path"); if (!(pathElement == null)) { string filepath = pathElement.InnerText.Trim(); InstallerInfo.Log.AddInfo(string.Format(FILE_Found, filepath, name)); paf.Path = filepath; } Folder.Files.Add(paf); } } // add dnn file to collection ( if it does not exist already ) if (Folder.Files.Contains(InstallerInfo.DnnFile) == false) { Folder.Files.Add(InstallerInfo.DnnFile); } InstallerInfo.Log.AddInfo(MODULES_Loading); XmlElement DNNModule; foreach (XmlElement tempLoopVar_DNNModule in FolderElement.SelectNodes("modules/module")) { DNNModule = tempLoopVar_DNNModule; ModuleDefinitionInfo ModuleDef = new ModuleDefinitionInfo(); ModuleDef.TempModuleID = TempModuleDefinitionID; //We need to ensure that admin order is null for "User" modules TempModuleDefinitionID++; Folder.Modules.Add(ModuleDef); InstallerInfo.Log.AddInfo(string.Format(MODULES_ControlInfo, ModuleDef.FriendlyName)); XmlElement ModuleControl; foreach (XmlElement tempLoopVar_ModuleControl in DNNModule.SelectNodes("controls/control")) { ModuleControl = tempLoopVar_ModuleControl; ModuleControlInfo ModuleControlDef = new ModuleControlInfo(); XmlElement keyElement = (XmlElement)ModuleControl.SelectSingleNode("key"); if (keyElement != null) { ModuleControlDef.ControlKey = keyElement.InnerText.Trim(); } XmlElement titleElement = (XmlElement)ModuleControl.SelectSingleNode("title"); if (titleElement != null) { ModuleControlDef.ControlTitle = titleElement.InnerText.Trim(); } try { ModuleControlDef.ControlSrc = Path.Combine("DesktopModules", Path.Combine(Folder.Name, ModuleControl.SelectSingleNode("src").InnerText.Trim()).Replace('\\', '/')).Replace(@"\", "/"); } catch (Exception) { throw (new Exception(EXCEPTION_Src)); } XmlElement iconFileElement = (XmlElement)ModuleControl.SelectSingleNode("iconfile"); if (iconFileElement != null) { ModuleControlDef.IconFile = iconFileElement.InnerText.Trim(); } try { ModuleControlDef.ControlType = (SecurityAccessLevel)TypeDescriptor.GetConverter(typeof(SecurityAccessLevel)).ConvertFromString(ModuleControl.SelectSingleNode("type").InnerText.Trim()); //ModuleControlDef.ControlType = CType(ModuleControl.SelectSingleNode("type").InnerText.Trim, SecurityAccessLevel) } catch (Exception) { throw (new Exception(EXCEPTION_Type)); } XmlElement orderElement = (XmlElement)ModuleControl.SelectSingleNode("vieworder"); if (orderElement != null) { ModuleControlDef.ViewOrder = Convert.ToInt32(orderElement.InnerText.Trim()); } else { ModuleControlDef.ViewOrder = Null.NullInteger; } //This is a temporary relationship since the ModuleDef has not been saved to the db //it does not have a valid ModuleDefID. Once it is saved then we can update the //ModuleControlDef with the correct value. ModuleControlDef.ModuleDefID = ModuleDef.TempModuleID; Folder.Controls.Add(ModuleControlDef); } } Folders.Add(Folder); } if (!InstallerInfo.Log.Valid) { throw (new Exception(EXCEPTION_LoadFailed)); } InstallerInfo.Log.EndJob(DNN_Success); return(Folders); } else { string err; foreach (string tempLoopVar_err in DnnErrors) { err = tempLoopVar_err; InstallerInfo.Log.AddFailure(err); } throw (new Exception(EXCEPTION_Format)); } }
public ActionResult Actions() { var msg = new JsonMessage(false, ""); var model = new ModuleControl(); List <ModuleControl> lst; switch (DoAction) { case ActionType.Add: try { UpdateModel(model); model.LanguageID = Fdisystem.LanguageId; _da.Add(model); _da.Save(); msg.Message = "Thêm mới dữ liệu thành công."; } catch (Exception ex) { msg.Erros = false; msg.Message = "Thêm mới dữ liệu thất bại."; } break; case ActionType.Edit: try { model = _da.GetById(ArrId.FirstOrDefault()); UpdateModel(model); //model.LanguageID = Fdisystem.LanguageId; _da.Add(model); _da.Save(); msg.Message = "Cập nhật dữ liệu thành công."; } catch (Exception ex) { msg.Erros = false; msg.Message = "Cập nhật dữ liệu thât bại."; } break; case ActionType.Delete: try { lst = _da.GetByArrId(ArrId); foreach (var item in lst) { _da.Delete(item); } _da.Save(); msg.Message = "Xóa dữ liệu thành công."; } catch (Exception ex) { msg.Erros = false; msg.Message = "Xóa dữ liệu thât bại."; } break; default: msg.Message = "Không có hành động nào được thực hiện."; msg.Erros = true; break; } return(Json(msg, JsonRequestBehavior.AllowGet)); }
public void Add(ModuleControl item) { FDIDB.ModuleControls.Add(item); }
private void Awake() { Instance = this; }