void DeleteCurrentSelectedControl(string controlName) { if (_XamlTemplate.CanvasTemplate.Children.ContainsKey(controlName)) { _XamlTemplate.CanvasTemplate.Children.Remove(controlName); } _XmlTemplate.ControlItem.Remove("Name", controlName); _XmlTemplate.EventLinkItem.Remove("ControlName", controlName); _XmlTemplate.EventBindItem.Remove("ControlName", controlName); _XmlTemplate.PageLoadingItem.Remove("ControlName", controlName); //-->还要就是删除数据库里与之相关的记录 //-->如果是最后一个控件了,请空MetaData里的信息 if (0 == _XamlTemplate.CanvasTemplate.Children.Count || 0 == _XmlTemplate.ControlItem.Count) { _XmlTemplate.Clear(); } cmd = new CtrlPlatformCommandInfo(); cmd.CommandName = ConstantCollection.CommandName_MixedCommand; cmd.ExecSql = new List <CtrlExecSQLCmd>(); string deleteSql = string.Format(" delete from EventDesigner where PageGuid = '{0}' and ControlName = '{1}'", this.PageInfo.PageGuid, controlName); var exec = new CtrlExecSQLCmd(CtrlExecSqlCmdType.ExecuteNonQuery, deleteSql, "EventDesigner", this.Name, "DeleteCurrentSelectedControl"); cmd.ExecSql.Add(exec); cmd.TempValue = Wrapper.SetXmlValue("EventDesigner", "DeleteCurrentSelectedControl"); this.SendToService(cmd, this); }
/// <summary> /// /// </summary> /// <returns></returns> public CtrlPlatformCommandInfo OutputParameter() { var _value = string.Format("BETWEEN '{0}' and '{1}'", ((DateTime)dpBegin.SelectedDate).ToString("yyyy-MM-dd"), ((DateTime)dpEnd.SelectedDate).ToString("yyyy-MM-dd")); if (_value.IsNullOrEmpty()) { return(null); } //-->这个说是用户从控件上添加进来的,所以没有列。 if (_MetaDataInfo.Item.Count == 0) { _MetaDataInfo.Item = new List <MetaDataColumnInfo>(); var col = new MetaDataColumnInfo(); col.column_value = _value; col.column_comment = string.Format("{0}", TextContent); col.column_name = DataSource.Split(',')[1]; col.table_name = DataSource.Split(',')[0]; _MetaDataInfo.Item.Add(col); } else { var mdci = _MetaDataInfo.Item[0]; mdci.column_value = _value; } CtrlPlatformCommandInfo cmd = new CtrlPlatformCommandInfo(); cmd.ParamCollection = _MetaDataInfo.ToXElement(); cmd.MetaDataInfo = new MetaDataInfo(); cmd.MetaDataInfo = _MetaDataInfo; cmd.ControlInfo = _ControlInfo; return(cmd); }
/// <summary> /// 保存到数据库 /// </summary> bool SaveXmlToDB() { var item = this.xtnEvents.SelectedItem; if (null == item) { Wrapper.ShowDialog("请选择事件。"); return(false); } if (null != _EventDesigner && item.ID.Equals(_EventDesigner.ContentID)) { return(true); } cmd = new CtrlPlatformCommandInfo(); cmd.CommandName = ConstantCollection.CommandName_SaveEventDesigner; EventDesigner edi = new EventDesigner(); edi.PageGuid = IDesignFramework.GetCurrentXmlTemplate().BaseInfo.PageGUID; edi.ControlName = _GetControlName(); edi.EventName = this.EventName; edi.ContentID = item.ID; cmd.ParamCollection = edi.ToXElement(); cmd.TempValue = Wrapper.SetXmlValue("Save", "SaveXmlToDB"); this.SendToService(cmd, this); return(true); }
void ProcessBatchSendCommand(CtrlPlatformCommandInfo cmd) { var _DictCtrlCmd = new Dictionary <string, CtrlPlatformCommandInfo>(); foreach (var exec in cmd.ExecSql) { string key = exec.CtrlName; if (_DictCtrlCmd.ContainsKey(key)) { _DictCtrlCmd[key].ExecSql.Add(exec); } else { var ctrlCmd = new CtrlPlatformCommandInfo(); ctrlCmd.CompositeControlName = exec.CtrlName; ctrlCmd.TempValue = new XElement("ctrl", new XAttribute(ConstantCollection.METHOD_NAME, exec.MethodName)); ctrlCmd.ExecSql = new List <CtrlExecSQLCmd>(); ctrlCmd.ExecSql.Add(exec); _DictCtrlCmd.Add(exec.CtrlName, ctrlCmd); } } //--> DoAction foreach (var child in _DictCtrlCmd) { var icc = this.FindControl(child.Key) as ICompositeCtrl; if (null == icc) { continue; } icc.DoAction(child.Value); } }
/// <summary> /// 输出参数 /// </summary> /// <returns></returns> public CtrlPlatformCommandInfo OutputParameter() { try { CtrlPlatformCommandInfo cmd = new CtrlPlatformCommandInfo(); foreach (var mdci in _MetaDataInfo.Item) { string controlName = string.Format("{0}_{1}", this.Name, mdci.column_name); var icc = this._IPageRuntime.FindControl(controlName) as ICompositeCtrl; if (null == icc) { continue; } var op = icc.OutputParameter(); if (null == op || null == op.MetaDataInfo || null == op.MetaDataInfo.Item || 0 == op.MetaDataInfo.Item.Count) { continue; } mdci.column_value = op.MetaDataInfo.Item[0].column_value; } cmd.MetaDataInfo = _MetaDataInfo; cmd.ControlInfo = this._ControlInfo; return(cmd); } finally { this._NotifyRuntimePage(ConstantCollection.COMPOSITE_CONTROL_OUTPUT_PARAMETER); } }
public void ProcessSwitchForm(CtrlPlatformCommandInfo cmd) { //-->开始进行解析信息了 var pds = Wrapper.ConvertToModel <PageDirectorySub>(cmd.ExecSql[0].Result); if (null == pds) { return; } var old_page_guid = cmd.TempValue.GetAttributeValue("PageGuid"); if (dictTabItem.ContainsKey(old_page_guid)) { var ti = dictTabItem[old_page_guid]; var ipr = ti.Content as IPageRuntime; ipr.Dispose(); RuntimePage rp = new RuntimePage(); rp.PageInfo = pds; rp.IRuntimePageManager = this as IRuntimeManagerPage; ti.IsSelected = true; ti.Content = rp; ti.Header = pds.PageName; dictTabItem.Add(pds.PageGuid, ti); rp.Redraw(); dictTabItem.Remove(old_page_guid); } }
/// <summary> /// /// </summary> /// <returns></returns> public CtrlPlatformCommandInfo OutputParameter() { var _value = string.Format("{0}", this.cbbDropDownList.SelectedItem.GetPropertyValue(this.SourceInfo.SaveField.ToLower())); if (_value.IsNullOrEmpty()) { return(null); } //-->这个说是用户从控件上添加进来的,所以没有列。 if (_MetaDataInfo.Item.Count == 0) { _MetaDataInfo.Item = new List <MetaDataColumnInfo>(); var col = new MetaDataColumnInfo(); col.column_value = _value; col.column_comment = string.Format("{0}", TextContent); col.column_name = SourceInfo.SaveField; col.table_name = SourceInfo.TableName; _MetaDataInfo.Item.Add(col); } else { var mdci = _MetaDataInfo.Item[0]; mdci.column_value = _value; } CtrlPlatformCommandInfo cmd = new CtrlPlatformCommandInfo(); cmd.ParamCollection = _MetaDataInfo.ToXElement(); cmd.MetaDataInfo = new MetaDataInfo(); cmd.MetaDataInfo = _MetaDataInfo; cmd.ControlInfo = _ControlInfo; return(cmd); }
/// <summary> /// 初始化操作 /// </summary> /// <param name="cmd">复合控件命令对象类</param> public void InitLoad(CtrlPlatformCommandInfo cmd) { _InitLoadParameter = cmd; if (IsSendCommand) { return; } string sqlSentence = GetSqlSentence(cmd); if (sqlSentence.IsNullOrEmpty()) { return; } var newCmd = new CtrlPlatformCommandInfo(); newCmd.CompositeControlName = this.Name; newCmd.CommandName = ConstantCollection.CommandName_MixedCommand; newCmd.ExecSql = new List <CtrlExecSQLCmd>(); var exec = new CtrlExecSQLCmd(CtrlExecSqlCmdType.Query, sqlSentence, this.SourceInfo.TableName, this.Name, "InitLoadData"); newCmd.ExecSql.Add(exec); newCmd.TempValue = new XElement("Query", new XAttribute(ConstantCollection.METHOD_NAME, "InitLoadData")); this._IPageRuntime.SendCommand(newCmd); IsSendCommand = true; }
/// <summary> /// 加载事件 /// </summary> /// <param name="cmd"></param> public void ProcessLoadingEventDesingerContent(CtrlPlatformCommandInfo cmd) { _ItemsSource = Wrapper.ConvertToList <EventDesignerContent>(cmd.ExecSql[0].Result);//, "EventContent"); if (null == _ItemsSource) { return; } int index = 1; this.lbEventContentItem.Items.Clear(); foreach (var edc in _ItemsSource) { ListBoxItem item = new ListBoxItem(); item.Content = string.Format("{0}、{1}", index++, edc.EventName); if (edc.Description.IsNotEmpty()) { ToolTipService.SetToolTip(item, edc.Description); } item.Tag = edc; this.lbEventContentItem.Items.Add(item); } if (!_IsSetSelectedItem) { SetSelectedItem(_EventID); } }
/// <summary> /// /// </summary> /// <param name="cmd"></param> internal void DoAction(CtrlPlatformCommandInfo cmd) { //-->判断是否是复合控件了。 if (cmd.CommandType == CtrlCommandDirectionType.CompositeControl) { var compositeControlName = cmd.TempValue.GetAttributeValue(ConstantCollection.COMPOSITE_CONTROL_NAME); var icc = this.FindControl(compositeControlName) as ICompositeCtrl; if (null == icc) { return; } icc.DoAction(cmd); } else { //-->当前 try { string mn = cmd.TempValue.GetAttributeValue(ConstantCollection.METHOD_NAME); string _MethodName = string.Format("Process{0}", mn); var mi = this.GetType().GetMethod(_MethodName, BindingFlags.Instance | BindingFlags.NonPublic); if (null == mi) { AlertMessage("没有找着【" + _MethodName + "】"); return; } mi.Invoke(this, new object[] { cmd }); } catch (Exception ee) { AlertMessage(ee); } } }
/// <summary> /// /// </summary> /// <param name="cmd"></param> public void ProcessOpenPage(CtrlPlatformCommandInfo cmd) { try { //--> 当前页面的索引号 var indexValue = cmd.TempValue.GetAttributeValue("SelectedIndex").ConvertTo <int>(); if ((indexValue - 1) > this.tc_Manager.Items.Count) { return; } //-->找到当前的索引号 TabItem selectContent = this.tc_Manager.Items[indexValue] as TabItem; if (null == selectContent) { return; } RuntimePage rp = selectContent.Content as RuntimePage; if (null == rp) { return; } rp.DoAction(cmd); } catch { } }
/// <summary> /// 返回保存页面是否成功 /// </summary> /// <param name="cmd"></param> public void ProcessSavePage(CtrlPlatformCommandInfo cmd) { var resultItem = cmd.ParamCollection.Elements("PageInfo"); List <String> errorItem = new List <string>(); foreach (var v in resultItem) { string controlName = v.GetAttributeValue("ControlName"); string result = v.GetAttributeValue("Result"); string ErrorMessage = v.GetAttributeValue("ErrorMessage"); TabItem ti = this.tcCollection.FindName(controlName) as TabItem; PageWorkArea pwa = ti.Content as PageWorkArea; if (result.Equals("0")) { pwa.PageInfo.PageContent = v.Value.ToString(); //-->更新header pwa.IsUpdate = false; } else { errorItem.Add(string.Format("{0} {1}", pwa.PageInfo.PageName, ErrorMessage)); } } if (0 < errorItem.Count) { Wrapper.ShowDialog(string.Join("\r\n", errorItem)); } this.bi.IsBusy = false; }
/// <summary> /// 处理删除当前选中控件 /// </summary> /// <param name="cmd"></param> public void ProcessDeleteCurrentSelectedControl(CtrlPlatformCommandInfo cmd) { if (!cmd.ExecuteNonQueryResult.IsNullOrEmpty()) { Wrapper.ShowDialog(cmd.ExecuteNonQueryResult.ToString()); return; } }
/// <summary> /// 填充数据 /// </summary> /// <param name="cmd"></param> void ProcessInitLoadData(CtrlPlatformCommandInfo cmd) { _ItemsSource = DynamicallyGeneratedClass.ToList(cmd.ExecSql[0].Result); UpdateComboBoxItemsSource(cmd); if (null != _ConditionByWhere) { UpdateComboBoxItemsSource(_ConditionByWhere); } }
/// <summary> /// 处理加载控件事件设置 /// </summary> /// <param name="cmd"></param> public void ProcessLoadingControlEventDesinger(CtrlPlatformCommandInfo cmd) { _EventDesigner = Wrapper.ConvertToModel <EventDesigner>(cmd.ExecSql[0].Result);//, "EventDesigner"); if (null == _EventDesigner) { return; } this.xtnEvents.SetSelectedItem(_EventDesigner.ContentID); }
/// <summary> /// /// </summary> /// <param name="cmd">复合控件命令对象类</param> public void InitTitle(CtrlPlatformCommandInfo cmd) { _ControlInfo = cmd.ControlInfo; _MetaDataInfo = cmd.MetaDataInfo; if (!_ControlInfo.Comment.IsNullOrEmpty()) { this.TextContent = _ControlInfo.Comment; } }
void ExecuteInvoke(EventLinkInfo eli, string controlName) { if (null == eli || null == eli.Item || 0 == eli.Item.Count) { return; } foreach (var child in eli.Item) { var _cpci = new CtrlPlatformCommandInfo(); switch (child.EventName.ToLower()) { case "popupform": _cpci.CompositeControlName = controlName; _cpci.PageGuid = child.PageGuid; PopupForm(_cpci); break; case "closeform": _cpci.CompositeControlName = controlName; _cpci.PageGuid = child.PageGuid; CloseForm(_cpci); break; case "switchform": _cpci.CompositeControlName = controlName; _cpci.PageGuid = child.PageGuid; SwitchForm(_cpci); break; case "refreshform": RefreshForm(); break; default: var icc = this.FindControl(child.ControlName); if (null == icc) { break; } var mi = icc.GetType().GetMethod(child.EventName); if (null == mi) { break; } if (mi.GetParameters().Length > 0) { _cpci = GetCtrlPlatformCommandInfo(child, controlName); mi.Invoke(icc, new object[] { _cpci }); } else { mi.Invoke(icc, null); } break; } } }
public void RefreshForm(CtrlPlatformCommandInfo cmd) { if (dictTabItem.ContainsKey(cmd.PageGuid)) { var ti = dictTabItem[cmd.PageGuid]; var ipr = ti.Content as IApiRuntimePage; ipr.RefreshForm(); } }
public void RefreshAllForm(CtrlPlatformCommandInfo cmd) { foreach (var child in dictTabItem) { var ti = dictTabItem[child.Key]; var ipr = ti.Content as IApiRuntimePage; ipr.RefreshForm(); } }
void btnConnection_Click(object sender, RoutedEventArgs e) { if (null != client && client.State == CommunicationState.Opened) { LogonName = CtrlPlatformCommandInfo.GetGlobalVariable(ConstantCollection.GlobalVariable_LogonName).Value; client.LogonAsync(LogonName); } this.btnConnection.IsEnabled = false; this.btnDisConnection.IsEnabled = true; }
/// <summary> /// 联动更改下拉框数据 /// </summary> /// <param name="cmd">复合控件命令对象类</param> public void ChangeComboBoxValue(CtrlPlatformCommandInfo cmd) { if (null == _ItemsSource || 0 == _ItemsSource.Count) { _ConditionByWhere = cmd; InitLoad(new CtrlPlatformCommandInfo()); return; } UpdateComboBoxItemsSource(cmd); }
/// <summary> /// /// </summary> /// <param name="cmd"></param> public void InitTitle(CtrlPlatformCommandInfo cmd) { _ControlInfo = cmd.ControlInfo; _MetaDataInfo = cmd.MetaDataInfo; this.TextContent = _ControlInfo.Comment; if (null == _MetaDataInfo || null == _MetaDataInfo.Item || 0 == _MetaDataInfo.Item.Count) { return; } }
/// <summary> /// 处理加载控件事件设置 /// </summary> /// <param name="cmd"></param> public void ProcessLoadingControlEventDesinger(CtrlPlatformCommandInfo cmd) { var edi = Wrapper.ConvertToModel <EventDesignerContent>(cmd.ExecSql[0].Result);//, "EventDesigner"); if (null == edi) { return; } ImportWorkFlow(edi.EventContent); }
/// <summary> /// /// </summary> /// <param name="cmd"></param> public override void InputParameter(CtrlPlatformCommandInfo cmd) { var mdci = cmd.MetaDataInfo.Item[0]; if (null == mdci) { return; } TextValue = string.Format("{0}", mdci.column_value); this._NotifyRuntimePage("InputParameter"); }
/// <summary> /// /// </summary> /// <param name="cmd"></param> public override void InputParameter(CtrlPlatformCommandInfo cmd) { var mdci = cmd.MetaDataInfo.Item[0]; if (null == mdci) { return; } TextValue = string.Format("{0}", mdci.column_value); this._NotifyRuntimePage(ConstantCollection.COMPOSITE_CONTROL_INPUT_PARAMETER); }
/// <summary> /// 初始化操作 /// </summary> /// <param name="cmd"></param> public void InitLoad(CtrlPlatformCommandInfo cmd) { _InitLoadParameter = cmd; if (IsSendCommand) { return; } SendQueryCommand(cmd, ConstantCollection.COMPOSITE_CONTROL_INIT_LOAD); IsSendCommand = true; }
/// <summary> /// /// </summary> /// <param name="cmd"></param> public void ProcessOpenBizPageInNewTab(CtrlPlatformCommandInfo cmd) { //-->开始进行解析信息了 List <PageDirectorySub> dirItem = Wrapper.ConvertToList <PageDirectorySub>(cmd.ExecSql[0].Result);//, "PageDirectorySub"); //-->创建多个TabItem页签 foreach (var child in dirItem) { OpenNewPage(child); } }
/// <summary> /// 条件查询 /// </summary> /// <param name="cmd"></param> public void InitLoadByCondition(CtrlPlatformCommandInfo cmd) { //-->条件查询 if (null == cmd) { return; } _ConditionQueryParam = cmd; this.xtn_CurrentIndex.Text = "1"; SendQueryCommand(cmd, ConstantCollection.COMPOSITE_CONTROL_INIT_LOAD_BY_CONDITION); }
/// <summary> /// 弹出窗体 /// </summary> /// <param name="cmd"></param> public void PopupForm(CtrlPlatformCommandInfo cmd) { XtnChildRunPage child = new XtnChildRunPage(); RuntimePageManager rp = new RuntimePageManager(); rp.OpenBizPageInNewTab(cmd.PageGuid); child.LayoutRoot.Children.Clear(); child.LayoutRoot.Children.Add(rp); child.Closed += child_Closed; child.Show(); }
/// <summary> /// 初始化标题 /// </summary> /// <param name="cmd"></param> public virtual void InitTitle(CtrlPlatformCommandInfo cmd) { _ControlInfo = cmd.ControlInfo; _MetaDataInfo = cmd.MetaDataInfo; this.TextContent = _ControlInfo.Comment; if (null == _MetaDataInfo || null == _MetaDataInfo.Item || 0 == _MetaDataInfo.Item.Count) { return; } this.FieldLength = _MetaDataInfo.Item[0].character_maximum_length; }