private void PageQuery_Click(object sender, RoutedEventArgs e) { try { FunctionCatalog catalogFunctionQuery = new FunctionCatalog(); catalogFunctionQuery.FunctionCode = txtQueryFunctionCode.Text; catalogFunctionQuery.FunctionName = txtQueryFunctionName.Text; if (ddlParentFunctionQuery.SelectedIndex > 0) { FunctionCatalogView navigationCatalog = ddlParentFunctionQuery.SelectedItem as FunctionCatalogView; catalogFunctionQuery.PFCID = navigationCatalog.PFCID; } if (ddlFormPageQuery.SelectedIndex > 0) { FormPageView formPage = ddlFormPageQuery.SelectedItem as FormPageView; catalogFunctionQuery.FPID = formPage.FPID; } List <FunctionCatalogView> lstFunctionCatalogQuery = GlobalFacade.ConfigurationFacade.GetFunctionCatalogList(catalogFunctionQuery).ToList(); dgQuery.ItemsSource = lstFunctionCatalogQuery; } catch (Exception ex) { //LogHelper.LogMsg("btnLogin_Click>>" + ex.Message, true); } }
public void PluginLoader(List <classStepDataInfor> lstInput, string strFolderSearchName) { int intRet = 0; intRet = this.ExtensionLoader(strFolderSearchName); if (intRet != 0) { MessageBox.Show("ExtensionLoader() fail. Cannot load Plugin. Error return: " + intRet.ToString(), "PluginLoader() Error"); Environment.Exit(0); } //For ini MEF parts this.IPluginLoader.PluginEnumerateCommon(); this.IFunctionCatalog = this.IPluginLoader.IFunctionCatalog; this.lstPluginCollection = this.IPluginLoader.lstPluginCollection; //Create new list of function catalog correspond to each step this.lstFuncCatalogAllStep = new List <FunctionCatalog>(); int i, j; for (i = 0; i < lstInput.Count; i++) { FunctionCatalog CataTemp = new FunctionCatalog(); bool blFlagFound = false; //Looking in all function catalog for (j = 0; j < this.IFunctionCatalog.Count; j++) { int intJigID = lstInput[i].intJigId; int intHardID = lstInput[i].intHardwareId; int intFuncID = lstInput[i].intFunctionId; if ((intJigID == this.IFunctionCatalog[j].intJigID) && (intHardID == this.IFunctionCatalog[j].intHardID) && (intFuncID == this.IFunctionCatalog[j].intFuncID)) { blFlagFound = true; CataTemp = this.IFunctionCatalog[j]; this.lstFuncCatalogAllStep.Add(CataTemp); break; } } //End for loop if (blFlagFound == false) //output error message { MessageBox.Show("Program List Error: we cannot find Function ID of step number " + lstInput[i].intStepNumber.ToString() + " in Function Catalog!", " Extension Loader"); } } //End for Loop }
private void btnSubmitEdit_Click(object sender, RoutedEventArgs e) { try { functionCatalogEdit = VerifyData(OperationType.Edit); if (functionCatalogEdit == null) { return; } bool blAddResult = GlobalFacade.ConfigurationFacade.UpdateSingleFunctionCatalog(functionCatalogEdit); } catch (Exception excp) { } }
private void btnSubmitAdd_Click(object sender, RoutedEventArgs e) { try { FunctionCatalog functionCatalogAdd = new FunctionCatalog(); functionCatalogAdd = VerifyData(OperationType.Add); if (functionCatalogAdd == null) { return; } bool blAddResult = GlobalFacade.ConfigurationFacade.InsertSingleFunctionCatalog(functionCatalogAdd); } catch (Exception excp) { } }
private void DataGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e) { if (this.dgQuery.SelectedIndex == -1) { return; } FunctionCatalogView functionCatalogSelect = dgQuery.Items[dgQuery.SelectedIndex] as FunctionCatalogView; if (functionCatalogSelect == null) { return; } functionCatalogEdit = new FunctionCatalog(); functionCatalogEdit.FCID = functionCatalogSelect.FCID; functionCatalogEdit.FunctionCode = functionCatalogSelect.FunctionCode; functionCatalogEdit.FunctionName = functionCatalogSelect.FunctionName; functionCatalogEdit.CatalogIcon = functionCatalogSelect.CatalogIcon; functionCatalogEdit.Sequence = functionCatalogSelect.Sequence; functionCatalogEdit.Description = functionCatalogSelect.Description; functionCatalogEdit.CreatedUser = functionCatalogSelect.CreatedUserGuid; functionCatalogEdit.CreatedTime = functionCatalogSelect.CreatedTime; functionCatalogEdit.Disable = functionCatalogSelect.Disable; //tbMainContent.SelectedItem = tbiEdit; txtFunctionCodeEdit.Text = functionCatalogEdit.FunctionCode; txtFunctionNameEdit.Text = functionCatalogEdit.FunctionName; txtCatalogIconEdit.Text = functionCatalogEdit.CatalogIcon; ddlParentFunctionEdit.SelectedValue = functionCatalogSelect.PFCID; ddlFormPageEdit.SelectedValue = functionCatalogSelect.FPID; txtSequenceEdit.Text = functionCatalogEdit.Sequence.ToString(); txtDescriptionEdit.Text = functionCatalogEdit.Description; cbDisableEdit.IsChecked = functionCatalogEdit.Disable; tbMainContent.SelectedItem = tbiEdit; }
public List <FunctionCatalog> IFunctionCatalog; //Contain all function info of all plugin //For normal function ID register public void PluginEnumerateCommon() { if (lstPluginCollection == null) { MessageBox.Show("Error: lstPluginCollection not yet initialized!", "PluginEnumerate() Error"); return; } this.IFunctionCatalog = new List <FunctionCatalog>(); int i = 0; for (i = 0; i < lstPluginCollection.Count; i++) { //Looking for information from plugin List <List <object> > lstlstInput = new List <List <object> >(); List <List <object> > lstlstOutput = new List <List <object> >(); List <string> lstTemp = new List <string>(); lstPluginCollection[i].Value.IGetPluginInfo(lstlstInput, out lstlstOutput); if (lstlstOutput.Count == 0) { continue; } //Analyze received info foreach (string strTest in lstlstOutput[0]) //Get the list object return { lstTemp = new List <string>(strTest.Split(',')); //Check valid condition if (lstTemp.Count < 3) { continue; //Not satify minimum data (JigID-HardID-FuncID) } int intJigID = 0; int intHardID = 0; if (int.TryParse(lstTemp[0], out intJigID) == false) { continue; //JigID is not numeric } if (int.TryParse(lstTemp[1], out intHardID) == false) { continue; //JigID is not numeric } //Looking in Function Catalog, if function is not Exist, then we create new one int j = 0; for (j = 2; j < lstTemp.Count; j++) { int intFuncID = 0; if (int.TryParse(lstTemp[j], out intFuncID) == false) { continue; //No care if FunID is not numeric } //Looking in all catalog, if not exist, then we create a new item bool blNewFunc = true; foreach (FunctionCatalog catalogTemp in this.IFunctionCatalog) { if ((catalogTemp.intJigID == intJigID) && (catalogTemp.intHardID == intHardID) && (catalogTemp.intFuncID == intFuncID)) { blNewFunc = false; MessageBox.Show("Error: Duplicated Function ID happen with Jig ID = " + intJigID.ToString() + " , Hard ID = " + intHardID.ToString() + " Func ID = " + intFuncID.ToString(), "PluginEnumerate: Duplicating Function ID warning"); } } //If not yet exist in catalog, then create new one if (blNewFunc == true) { var FuncTemp = new FunctionCatalog(); FuncTemp.intPartID = i; FuncTemp.strPartDesc = lstPluginCollection[i].Metadata.IPluginInfo.ToString(); FuncTemp.intJigID = intJigID; FuncTemp.intHardID = intHardID; FuncTemp.intFuncID = intFuncID; //Add to catalog this.IFunctionCatalog.Add(FuncTemp); } } //End for j } //End Foreach lststrOutput } //End for loop i }
//For special control function name register public void PluginEnumerateSpecialControl() { if (lstPluginCollection == null) { MessageBox.Show("Error: PluginEnumerateSpecialControl not yet initialized!", "PluginEnumerateSpecialControl() Error"); return; } this.IFunctionCatalog = new List <FunctionCatalog>(); int i = 0; int j = 0; int k = 0; for (i = 0; i < lstPluginCollection.Count; i++) { //Looking for information from plugin List <List <object> > lstlstInput = new List <List <object> >(); List <List <object> > lstlstOutput = new List <List <object> >(); List <string> lstTemp = new List <string>(); //Get info from plug-in lstPluginCollection[i].Value.IGetPluginInfo(lstlstInput, out lstlstOutput); if (lstlstOutput.Count == 0) { continue; } //Analyze received info for (j = 0; j < lstlstOutput.Count; j++) { if (lstlstOutput[j].Count == 0) { continue; } lstTemp = new List <string>(lstlstOutput[j][0].ToString().ToUpper().Trim().Split(',')); if (lstTemp.Count == 0) { continue; } if (lstTemp[0] != "SPECIAL") { continue; } //Looking in all catalog, if not exist, then we create a new item for (k = 1; k < lstTemp.Count; k++) { string strTemp = lstTemp[k]; if (strTemp.Trim() == "") { continue; } bool blNewFunc = true; foreach (FunctionCatalog catalogTemp in this.IFunctionCatalog) { if (catalogTemp.strSpecialCmdCode == strTemp) { blNewFunc = false; MessageBox.Show("Error: Duplicated Special control function name [" + strTemp + "]", "PluginEnumerateSpecialControl: Duplicating Special control function name warning"); } } //If not yet exist in catalog, then create new one if (blNewFunc == true) { var FuncTemp = new FunctionCatalog(); FuncTemp.intPartID = i; FuncTemp.strPartDesc = lstPluginCollection[i].Metadata.IPluginInfo.ToString(); FuncTemp.strSpecialCmdCode = strTemp; //Add to catalog this.IFunctionCatalog.Add(FuncTemp); } } } } //End for loop i }
/// <summary> /// 删除功能目录 /// </summary> /// <returns></returns> public bool DeleteSingleFunctionCatalog(FunctionCatalog entity) { return(permissionRepository.DeleteSingleFunctionCatalog(entity)); }
/// <summary> /// 新增功能目录 /// </summary> /// <returns></returns> public bool InsertSingleFunctionCatalog(FunctionCatalog entity) { return(permissionRepository.InsertSingleFunctionCatalog(entity)); }
/// <summary> /// 查询单个功能目录 /// </summary> /// <returns></returns> public Domain.Configuration.FunctionCatalog GetSingleFunctionCatalog(FunctionCatalog entity) { return(permissionRepository.GetSingleFunctionCatalog(entity)); }
/// <summary> /// 查询功能目录 /// </summary> /// <returns></returns> public List <Domain.Configuration.FunctionCatalogView> GetFunctionCatalogList(FunctionCatalog entity) { return(permissionRepository.GetFunctionCatalogList(entity)); }
private FunctionCatalog VerifyData(OperationType operationType) { FunctionCatalog catalogFunction = new FunctionCatalog(); if (operationType == OperationType.Add) { if (txtFunctionCodeAdd.Text.IsNullOrEmptyOrWhiteSpace()) { return(null); } if (txtFunctionNameAdd.Text.IsNullOrEmptyOrWhiteSpace()) { return(null); } //if (txtFunctionRouteAdd.Text.IsNullOrEmptyOrWhiteSpace()) //{ // return null; //} //if (txtPageParameterAdd.Text.IsNullOrEmptyOrWhiteSpace()) //{ //return; //} if (txtSequenceAdd.Text.IsNullOrEmptyOrWhiteSpace()) { return(null); } catalogFunction.FCID = Guid.NewGuid(); catalogFunction.FunctionCode = txtFunctionCodeAdd.Text; catalogFunction.FunctionName = txtFunctionNameAdd.Text; catalogFunction.CatalogIcon = txtCatalogIconAdd.Text; if (ddlFormPageAdd.SelectedIndex > 0) { catalogFunction.FPID = Guid.Parse(ddlFormPageAdd.SelectedValue.ToString()); } if (ddlParentFunctionAdd.SelectedIndex > 0) { catalogFunction.PFCID = Guid.Parse(ddlParentFunctionAdd.SelectedValue.ToString()); } catalogFunction.Sequence = Int32.Parse(txtSequenceAdd.Text); catalogFunction.Description = txtDescriptionAdd.Text; catalogFunction.Disable = cbDisableAdd.IsChecked == null ? false : (bool)cbDisableAdd.IsChecked; catalogFunction.CreatedUser = GlobalVariable.UserEntity.UID; catalogFunction.CreatedTime = DateTime.Now; } else { if (functionCatalogEdit == null) { return(null); } if (txtFunctionCodeEdit.Text.IsNullOrEmptyOrWhiteSpace()) { return(null); } if (txtFunctionNameEdit.Text.IsNullOrEmptyOrWhiteSpace()) { return(null); } //if (txtFunctionRouteEdit.Text.IsNullOrEmptyOrWhiteSpace()) //{ // return null; //} //if (txtPageParameterEdit.Text.IsNullOrEmptyOrWhiteSpace()) //{ //return; //} if (txtSequenceEdit.Text.IsNullOrEmptyOrWhiteSpace()) { return(null); } catalogFunction.FCID = functionCatalogEdit.FCID; catalogFunction.FunctionCode = txtFunctionCodeEdit.Text; catalogFunction.FunctionName = txtFunctionNameEdit.Text; catalogFunction.CatalogIcon = txtCatalogIconEdit.Text; if (ddlFormPageEdit.SelectedIndex > 0) { catalogFunction.FPID = Guid.Parse(ddlFormPageEdit.SelectedValue.ToString()); } if (ddlParentFunctionEdit.SelectedIndex > 0) { catalogFunction.PFCID = Guid.Parse(ddlParentFunctionEdit.SelectedValue.ToString()); } //catalogFunction.FPID = Guid.Parse(ddlFormPageEdit.SelectedValue.ToString()); //catalogFunction.PFCID = Guid.Parse(ddlParentFunctionEdit.SelectedValue.ToString()); catalogFunction.Sequence = Int32.Parse(txtSequenceEdit.Text); catalogFunction.Description = txtDescriptionEdit.Text; catalogFunction.Disable = cbDisableEdit.IsChecked == null ? false : (bool)cbDisableEdit.IsChecked; catalogFunction.CreatedUser = functionCatalogEdit.CreatedUser; catalogFunction.CreatedTime = functionCatalogEdit.CreatedTime; catalogFunction.ModifiedUser = GlobalVariable.UserEntity.UID; catalogFunction.ModifiedTime = DateTime.Now; } return(catalogFunction); }