public ContentControllerMetaData(Type controllerType, string actionName = "Index") { ActionName = actionName; ControllerType = controllerType; ControllerName = controllerType.Name; // remove "Controller" from class name if (ControllerName.EndsWith("Controller", StringComparison.OrdinalIgnoreCase)) { ControllerName = ControllerName.Substring(0, ControllerName.Length - "Controller".Length); } }
/// <summary> /// Create a new <see cref="ViewController"/>. /// </summary> protected ApplicationController(TemplateManager mgr, ILanguageNode language) : base(mgr) { Language = language.GetChild(char.ToUpper(ControllerName[0]) + ControllerName.Substring(1)) ?? language; // fetch validation language. ILanguageNode node = language; while (node.ParentNode != null) { node = language.ParentNode; } _validationLanguage = node.GetChild("Validation"); }
public ActionDescriptor(MethodInfo methodInfo, RouteInfo routeInfo) { MethodInfo = methodInfo; RouteInfo = routeInfo; ActionName = methodInfo.Name; if (ActionName.EndsWith("Async")) { ActionName = ActionName.Substring(0, ActionName.Length - "Async".Length); } ControllerName = methodInfo.DeclaringType.Name; ControllerName = ControllerName.Substring(0, ControllerName.Length - "Controller".Length); }
public void DownloadExcelTemplateExecute() { VistaFolderBrowserDialog dialog = new VistaFolderBrowserDialog(); dialog.Description = "选择存储的文件夹"; dialog.UseDescriptionForTitle = true; // This applies to the Vista style dialog only, not the old dialog. dialog.ShowDialog(); string strFilePath = dialog.SelectedPath; FileService fileService = new FileService(); if (DefaultTemplateState) { ControllerOperation8001 operation = new ControllerOperation8001(); operation.DownloadDefaultEXCELTemplate(strFilePath + "//" + "默认(" + SelectedControllerType.ToString() + ")模板文件.xls", fileService, null); } else if (CustomizedTemplateState) { ExcelTemplateCustomizedInfo customizedInfo = new ExcelTemplateCustomizedInfo(); customizedInfo.ControllerType = SelectedControllerType; customizedInfo.ControllerName = ControllerName;//应该限制此控制器名称的长度 customizedInfo.MachineNumber = MachineNumber; customizedInfo.SelectedDeviceCodeLength = SelectedDeviceCodeLength; customizedInfo.SerialPortNumber = SerialPortNumber; customizedInfo.LoopAmount = LoopAmount; customizedInfo.LoopGroupAmount = LoopGroupAmount; customizedInfo.StandardLinkageFlag = StandardLinkageFlag; customizedInfo.MixedLinkageFlag = MixedLinkageFlag; customizedInfo.GeneralLinkageFlag = GeneralLinkageFlag; customizedInfo.ManualControlBoardFlag = ManualControlBoardFlag; ControllerOperation8001 operation = new ControllerOperation8001(); string fileName = ""; if (ControllerName.Length > 10) { fileName = fileName + ControllerName.Substring(0, 10) + "控制器(" + SelectedControllerType.ToString() + ")模板文件.xls"; } else { fileName = fileName + ControllerName + "控制器(" + SelectedControllerType.ToString() + ")模板文件.xls"; } operation.DownloadDefaultEXCELTemplate(strFilePath + "//" + fileName, fileService, customizedInfo); } }
public void DownloadExcelTemplateExecute() { VistaFolderBrowserDialog dialog = new VistaFolderBrowserDialog(); dialog.Description = "选择存储的文件夹"; dialog.UseDescriptionForTitle = true; // This applies to the Vista style dialog only, not the old dialog. bool?blnResult = dialog.ShowDialog(); if (blnResult != null) { if ((bool)blnResult) { string strFilePath = dialog.SelectedPath; FileService fileService = new FileService(); string suffixString = ""; if (ExcelVersionForTemplate == EXCELVersion.EXCEL2003) { suffixString = ")模板文件.xls"; } else { suffixString = ")模板文件.xlsx"; } ControllerManager controllerManager = new ControllerManager(); controllerManager.InitializeAllControllerOperation(null); IControllerOperation operation = controllerManager.GetController(SelectedControllerType); if (DefaultTemplateState) { //ControllerOperation8001 operation = new ControllerOperation8001(); // operation.DownloadDefaultEXCELTemplate(strFilePath + "//" + "默认(" + SelectedControllerType.ToString() + suffixString, fileService, null); operation.DownloadDefaultEXCELTemplate(strFilePath + "//" + "默认(" + SelectedControllerType.ToString() + suffixString, fileService, null, SelectedControllerType); } else if (CustomizedTemplateState) { ExcelTemplateCustomizedInfo customizedInfo = new ExcelTemplateCustomizedInfo(); customizedInfo.ControllerType = SelectedControllerType; customizedInfo.ControllerName = ControllerName;//应该限制此控制器名称的长度 customizedInfo.MachineNumber = MachineNumber; customizedInfo.SelectedDeviceCodeLength = SelectedDeviceCodeLength; customizedInfo.SerialPortNumber = SerialPortNumber; customizedInfo.LoopAmount = LoopAmount; customizedInfo.LoopGroupAmount = LoopGroupAmount; customizedInfo.StandardLinkageFlag = StandardLinkageFlag; customizedInfo.MixedLinkageFlag = MixedLinkageFlag; customizedInfo.GeneralLinkageFlag = GeneralLinkageFlag; customizedInfo.ManualControlBoardFlag = ManualControlBoardFlag; customizedInfo.DefaultDeviceTypeCode = SelectedDeviceTypeCode; // ControllerOperation8001 operation = new ControllerOperation8001(); //暂时写为8001,后续需要改为各控制器通用代码 string fileName = ""; if (ControllerName.Length > 10) { fileName = fileName + ControllerName.Substring(0, 10) + "控制器(" + SelectedControllerType.ToString() + suffixString; } else { fileName = fileName + ControllerName + "控制器(" + SelectedControllerType.ToString() + suffixString; } // operation.DownloadDefaultEXCELTemplate(strFilePath + "//" +fileName , fileService, customizedInfo); operation.DownloadDefaultEXCELTemplate(strFilePath + "//" + fileName, fileService, customizedInfo, SelectedControllerType); } } } }