コード例 #1
0
        /// <summary>
        /// 初始化Page文件
        /// </summary>
        /// <param name="cmd"></param>
        /// <param name="item"></param>
        void PropertyInitDirectoryByPageFile(CtrlExecSQLCmd cmd, TreeViewItem item)
        {
            if (null == item)
            {
                return;
            }
            //-->加载文件
            //-->判断文件在哪个目录下
            List <PageDirectorySub> dirItem = Wrapper.ConvertToList <PageDirectorySub>(cmd.Result);

            if (null == dirItem || 0 == dirItem.Count)
            {
                return;
            }
            foreach (var sub in dirItem)
            {
                TreeViewItem tvi = new TreeViewItem();
                tvi.Name        = string.Format("tvi_{0}_{1}", sub.PageDirectoryId, sub.ID);
                tvi.Header      = sub.PageName;
                sub.PageContent = sub.PageContent;
                tvi.Tag         = sub;
                tvi.Expanded   += tvi_Expanded;
                tvi.Collapsed  += tvi_Expanded;
                item.Items.Add(tvi);
            }
        }
コード例 #2
0
        /// <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;
        }
コード例 #3
0
        /// <summary>
        /// 初始化目录
        /// </summary>
        /// <param name="cmd"></param>
        /// <param name="parentItem"></param>
        void PropertyInitDirectoryByDirectory(CtrlExecSQLCmd cmd, TreeViewItem parentItem)
        {
            List <PageDirectory> dirItem = Wrapper.ConvertToList <PageDirectory>(cmd.Result);

            if (null == dirItem || 0 == dirItem.Count)
            {
                return;
            }
            foreach (PageDirectory pd in dirItem)
            {
                TreeViewItem tvi = new TreeViewItem();
                tvi.Name       = string.Format("tvi_{0}", pd.ID);
                tvi.Header     = pd.NodeName;
                tvi.Tag        = pd;
                tvi.Expanded  += tvi_Expanded;
                tvi.Collapsed += tvi_Expanded;

                //-->加一个子节点
                TreeViewItem chidren = new TreeViewItem();
                chidren.Header = "正在加载...";
                chidren.Name   = string.Format("tvi_{0}_loading", pd.ID);
                tvi.Items.Add(chidren);

                parentItem.Items.Add(tvi);
            }
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        void _FillTrunPage(CtrlExecSQLCmd cmd)
        {
            if (null == cmd.Result)
            {
                return;
            }
            int total = cmd.Result.Value.ConvertTo <int>();
            //-->PageCount
            var _p = total % PageSize;

            _PageCount             = total / PageSize + (_p > 0 ? 1 : 0);
            this.txtPageCount.Text = _PageCount.ToString();
        }
コード例 #6
0
        /// <summary>
        /// 修改操作
        /// </summary>
        /// <param name="name"></param>
        void ModifyOperator(string name)
        {
            TreeViewItem item = this.tvPageManager.SelectedItem as TreeViewItem;
            var          cmd  = new CtrlPlatformCommandInfo();

            cmd.CommandName = ConstantCollection.CommandName_MixedCommand;
            cmd.ExecSql     = new List <CtrlExecSQLCmd>();
            Dictionary <String, Object> dict = new Dictionary <string, Object>();

            if (item.Tag is PageDirectory)
            {
                PageDirectory pd = item.Tag as PageDirectory;
                pd.NodeName = name;
                //-->修改当前选中目录
                string sql  = string.Format("update PageDirectory  set NodeName = '{0}' where ID = {1}", pd.NodeName, pd.ID);
                var    exec = new CtrlExecSQLCmd(CtrlExecSqlCmdType.ExecuteNonQuery, sql, "PageDirectory", this.Name, "ModifyOperator");
                cmd.ExecSql.Add(exec);

                cmd.TempValue = Wrapper.SetXmlValue("PageDirectory", "ModifyOperator",
                                                    new KeyValuePair <String, Object>[]
                {
                    new KeyValuePair <String, Object>("IsDirectory", true),
                    new KeyValuePair <String, Object>("ControlName", item.Name),
                    new KeyValuePair <String, Object>("ID", pd.ID),
                    new KeyValuePair <String, Object>("NewValue", name)
                });
            }
            else if (item.Tag is PageDirectorySub)
            {
                //-->修改当前选中的页面
                PageDirectorySub pds = item.Tag as PageDirectorySub;
                pds.PageName = name;
                string sql = string.Format("update PageDirectorySub set PageName = '{0}' where id = {1}", pds.PageName, pds.ID);

                var exec = new CtrlExecSQLCmd(CtrlExecSqlCmdType.ExecuteNonQuery, sql, "PageDirectorySub", this.Name, "ModifyOperator");
                cmd.ExecSql.Add(exec);

                dict.Add("IsDirectory", false);
                dict.Add("ID", pds.ID);
                cmd.TempValue = Wrapper.SetXmlValue("PageDirectorySub", "ModifyOperator",
                                                    new KeyValuePair <String, Object>[]
                {
                    new KeyValuePair <String, Object>("IsDirectory", false),
                    new KeyValuePair <String, Object>("ControlName", item.Name),
                    new KeyValuePair <String, Object>("ID", pds.ID),
                    new KeyValuePair <String, Object>("NewValue", name)
                });
            }
            this.SendToService(cmd, this);
        }
コード例 #7
0
        /// <summary>
        /// 获取初始化值
        /// </summary>
        /// <param name="methodName"></param>
        void GetInitValue(string methodName)
        {
            string SqlSentence          = _BuilderSqlSentence();
            CtrlPlatformCommandInfo cmd = new CtrlPlatformCommandInfo();

            cmd.CommandName          = ConstantCollection.CommandName_MixedCommand;
            cmd.CompositeControlName = this.Name;
            cmd.ExecSql = new List <CtrlExecSQLCmd>();
            var exec = new CtrlExecSQLCmd(CtrlExecSqlCmdType.Query, SqlSentence, _MetaDataInfo.table_name, this.Name, methodName);

            cmd.ExecSql.Add(exec);
            cmd.TempValue = new XElement("query", new XAttribute(ConstantCollection.METHOD_NAME, methodName));
            _IPageRuntime.SendCommand(cmd);
        }
コード例 #8
0
        void LoadingEventDesingerContent()
        {
            cmd             = new CtrlPlatformCommandInfo();
            cmd.CommandName = ConstantCollection.CommandName_MixedCommand;
            string sql = string.Format("select t.* from {0} t order by EventName", _TableName);

            cmd.ExecSql = new List <CtrlExecSQLCmd>();
            var exec = new CtrlExecSQLCmd(CtrlExecSqlCmdType.Query, sql, _TableName, this.Name, "LoadingEventDesingerContent");

            cmd.ExecSql.Add(exec);

            cmd.TempValue = Wrapper.SetXmlValue("Query", "LoadingEventDesingerContent");
            this.SendToService(cmd, this);
        }
コード例 #9
0
        /// <summary>
        /// 加载控件事件设置器
        /// </summary>
        void LoadingControlEventDesinger()
        {
            cmd             = new CtrlPlatformCommandInfo();
            cmd.CommandName = ConstantCollection.CommandName_MixedCommand;
            string sql = string.Format("select t.* from EventDesigner t where t.PageGuid = '{0}' ", IDesignFramework.GetCurrentXmlTemplate().BaseInfo.PageGUID);

            sql        += string.Format(" and t.ControlName = '{0}' ", _GetControlName());
            sql        += string.Format(" and t.EventName = '{0}'", this.EventName);
            cmd.ExecSql = new List <CtrlExecSQLCmd>();
            var exec = new CtrlExecSQLCmd(CtrlExecSqlCmdType.Query, sql, "EventDesigner", this.Name, "LoadingControlEventDesinger");

            cmd.ExecSql.Add(exec);
            cmd.TempValue = Wrapper.SetXmlValue("Query", "LoadingControlEventDesinger");
            this.SendToService(cmd, this);
        }
コード例 #10
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="bizPageGUID"></param>
        public void OpenBizPageInNewTab(string bizPageGUID)
        {
            cmd             = new CtrlPlatformCommandInfo();
            cmd.CommandName = "GetDataTable";
            string[] sqlItem = bizPageGUID.Split(',');
            string   sql     = string.Format("select t.* from PageDirectorySub t where t.PageGuid in ('{0}')", string.Join("','", sqlItem));

            cmd.ExecSql = new List <CtrlExecSQLCmd>();
            var exec = new CtrlExecSQLCmd(CtrlExecSqlCmdType.Query, sql, "PageDirectorySub", this.Name, "OpenBizPageInNewTab");

            cmd.ExecSql.Add(exec);

            cmd.TempValue = new XElement("query", new XAttribute(ConstantCollection.FUNCTION_NAME, "OpenBizPageInNewTab"));
            this.SendToService(cmd, this);
        }
コード例 #11
0
        /// <summary>
        /// 删除操作
        /// </summary>
        /// <param name="name"></param>
        void DeleteOperator(string name)
        {
            TreeViewItem item = this.tvPageManager.SelectedItem as TreeViewItem;
            var          cmd  = new CtrlPlatformCommandInfo();

            cmd.CommandName = ConstantCollection.CommandName_MixedCommand;
            cmd.ExecSql     = new List <CtrlExecSQLCmd>();

            if (item.Tag is PageDirectory)
            {
                //-->判断是否还有子项
                //-->有子项不让其删除
                if (0 < item.Items.Count)
                {
                    Wrapper.ShowDialog("此目录下还有子项,请先删除子项");
                    return;
                }
                PageDirectory pd = item.Tag as PageDirectory;
                //-->删除当前选中目录
                string sql = string.Format("delete from PageDirectory where ID = {0}", pd.ID);
                //cmd.SqlSentence.Add(sql);

                var exec = new CtrlExecSQLCmd(CtrlExecSqlCmdType.ExecuteNonQuery, sql, "PageDirectory", this.Name, "DeleteOperator");
                cmd.ExecSql.Add(exec);

                cmd.TempValue = Wrapper.SetXmlValue("PageDirectory", "DeleteOperator",
                                                    new KeyValuePair <String, Object>[]
                {
                    new KeyValuePair <String, Object>("ControlName", item.Name)
                });
            }
            else if (item.Tag is PageDirectorySub)
            {
                //-->删除当前选中的页面
                PageDirectorySub pds = item.Tag as PageDirectorySub;
                string           sql = string.Format("delete from PageDirectorySub where ID= '{0}'", pds.ID);

                var exec = new CtrlExecSQLCmd(CtrlExecSqlCmdType.ExecuteNonQuery, sql, "PageDirectorySub", this.Name, "DeleteOperator");
                cmd.ExecSql.Add(exec);

                cmd.TempValue = Wrapper.SetXmlValue("PageDirectorySub", "DeleteOperator",
                                                    new KeyValuePair <String, Object>[]
                {
                    new KeyValuePair <String, Object>("ControlName", item.Name)
                });
            }
            this.SendToService(cmd, this);
        }
コード例 #12
0
        /// <summary>
        /// 删除操作
        /// </summary>
        /// <param name="cmd"></param>
        public void Delete(CtrlPlatformCommandInfo cmd)
        {
            //-->在这里生成Sql语句。
            string tableName = _MetaDataInfo.table_name;
            var    op        = this.OutputParameter();
            //-->找出PK来。
            var pkItem = op.MetaDataInfo.Item.Where(p =>
                                                    !p.column_key.IsNullOrEmpty() &&
                                                    p.column_key.Equals(ConstantCollection.TABLE_KEY)
                                                    ).GetTList <MetaDataColumnInfo>();
            List <String> whereItem = new List <string>();

            if (pkItem.Count > 0)
            {
                foreach (var pk in pkItem)
                {
                    string where = string.Format(" {0} {1} ", pk.column_name, Wrapper.ConvertToDBTypeWhereUsing(pk));
                    whereItem.Add(where);
                }
            }
            else
            {
                foreach (var pk in op.MetaDataInfo.Item)
                {
                    string where = string.Format(" {0} {1} ", pk.column_name, Wrapper.ConvertToDBTypeWhereUsing(pk));
                    whereItem.Add(where);
                }
            }
            if (whereItem.Count == 0)
            {
                return;
            }
            string deleteSql = string.Format("delete from {0} where {1}", tableName, string.Join(" and ", whereItem));

            cmd                      = new CtrlPlatformCommandInfo();
            cmd.CommandName          = ConstantCollection.CommandName_MixedCommand;
            cmd.CompositeControlName = this.Name;

            cmd.ExecSql = new List <CtrlExecSQLCmd>();
            var exec = new CtrlExecSQLCmd(CtrlExecSqlCmdType.ExecuteNonQuery, deleteSql, tableName, this.Name, ConstantCollection.COMPOSITE_CONTROL_DELETE);

            cmd.ExecSql.Add(exec);
            cmd.TempValue = new XElement("execute", new XAttribute(ConstantCollection.METHOD_NAME, ConstantCollection.COMPOSITE_CONTROL_DELETE));

            this._IPageRuntime.SendCommand(cmd);
            this._NotifyRuntimePage(ConstantCollection.COMPOSITE_CONTROL_DELETE);
        }
コード例 #13
0
        /// <summary>
        /// 增加页面
        /// </summary>
        /// <param name="name"></param>
        void AddPage(string name)
        {
            TreeViewItem item = this.tvPageManager.SelectedItem as TreeViewItem;

            if (null == item)
            {
                Wrapper.ShowDialog("请选择目录");
                return;
            }
            PageDirectory pd = item.Tag as PageDirectory;

            if (null == pd)
            {
                Wrapper.ShowDialog("请选择目录");
                return;
            }
            var cmd = new CtrlPlatformCommandInfo();

            cmd.CommandName = ConstantCollection.CommandName_MixedCommand;
            cmd.ExecSql     = new List <CtrlExecSQLCmd>();

            PageDirectorySub sds = new PageDirectorySub();

            sds.PageDirectoryId = pd.ID;
            sds.PageName        = name;
            sds.PageGuid        = Wrapper.GuidValue;

            string sql = string.Format("insert into PageDirectorySub(PageDirectoryId,PageGuid,PageName,CreateDate)values(");

            sql += string.Format("{0},", sds.PageDirectoryId);
            sql += string.Format("'{0}',", sds.PageGuid);
            sql += string.Format("'{0}',", sds.PageName);
            sql += string.Format("NOW())");
            var exec = new CtrlExecSQLCmd(CtrlExecSqlCmdType.ExecuteNonQuery, sql, "PageDirectorySub", this.Name, "AddPage");

            cmd.ExecSql.Add(exec);
            sql  = string.Format("select * from PageDirectorySub t where t.PageGuid = '{0}'", sds.PageGuid);
            exec = new CtrlExecSQLCmd(CtrlExecSqlCmdType.Query, sql, "PageDirectorySub", this.Name, "AddPage");
            cmd.ExecSql.Add(exec);
            cmd.ParamCollection = sds.ToXElement();
            cmd.TempValue       = Wrapper.SetXmlValue("AddPage", "AddPage",
                                                      new KeyValuePair <String, Object>[] {
                new  KeyValuePair <String, Object>("ParentID", pd.ID),
                new KeyValuePair <String, Object>("ControlName", item.Name)
            });
            this.SendToService(cmd, this);
        }
コード例 #14
0
        /// <summary>
        /// 用户登录操作
        /// </summary>
        void _UserLogonOperator()
        {
            //-->判断验证码
            if (this.IsAuthenticode)
            {
                if (this.txtAuthenticode.Text.IsNullOrEmpty())
                {
                    this._IPageRuntime.AlertMessage("请输入验证码");
                    return;
                }
                if (!this.txtAuthenticode.Text.Trim().ToLower().Equals(_Authenticode.ToLower()))
                {
                    this._IPageRuntime.AlertMessage("验证码输入不正确");
                    return;
                }
            }
            //-->判断用户名密码不能为空
            if (this.txtUserName.Text.IsNullOrEmpty())
            {
                this._IPageRuntime.AlertMessage("用户名不能为空");
                return;
            }
            if (this.txtPassword.Password.IsNullOrEmpty())
            {
                this._IPageRuntime.AlertMessage("密码不能为空");
                return;
            }

            //-->获取加密密码
            var password = this._Encrypt();

            var newCmd = new CtrlPlatformCommandInfo();

            newCmd.CompositeControlName = this.Name;
            newCmd.CommandName          = ConstantCollection.CommandName_MixedCommand;

            string sqlSentence = string.Format("select * from {0} where {1} = '{2}' and {3} = '{4}'", _TableName, _UsernameField, this.txtUserName.Text.Trim(), _PasswordField, password);

            newCmd.ExecSql = new List <CtrlExecSQLCmd>();
            var exec = new CtrlExecSQLCmd(CtrlExecSqlCmdType.Query, sqlSentence, _TableName, this.Name, "UserLogon");

            newCmd.ExecSql.Add(exec);

            newCmd.TempValue = new XElement("Query", new XAttribute(ConstantCollection.METHOD_NAME, "Logon"));
            this._IPageRuntime.SendCommand(newCmd);
        }
コード例 #15
0
        public void SwitchForm(CtrlPlatformCommandInfo ctrlCmd)
        {
            cmd             = new CtrlPlatformCommandInfo();
            cmd.CommandName = ConstantCollection.CommandName_MixedCommand;
            string sql = string.Format("select t.* from PageDirectorySub t where t.PageGuid = '{0}' ", ctrlCmd.PageGuid.Split(',')[0]);

            cmd.ExecSql = new List <CtrlExecSQLCmd>();
            var exec = new CtrlExecSQLCmd(CtrlExecSqlCmdType.Query, sql, "PageDirectorySub", this.Name, "OpenBizPageInNewTab");

            cmd.ExecSql.Add(exec);

            cmd.TempValue = new XElement("query",
                                         new XAttribute(ConstantCollection.FUNCTION_NAME, "SwitchForm"),
                                         new XAttribute("PageGuid", ctrlCmd.PageGuid.Split(',')[1])
                                         );
            this.SendToService(cmd, this);
        }
コード例 #16
0
        void _FillDataGrid(CtrlExecSQLCmd ctrlExecSQLCmd)
        {
            var _columns = DynamicallyGeneratedClass.GetDataTableColumnCollection(ctrlExecSQLCmd.Result);

            if (null == _columns)
            {
                this.xtn_Data.ItemsSource = null;
                return;
            }
            if (_columns.Count != _Columns.Count && _columns.Count != this.xtn_Data.Columns.Count)
            {
                //-->这里要进行转换
                int i = 0;
                Dictionary <int, MetaDataColumnInfo> _DictData = new Dictionary <int, MetaDataColumnInfo>();
                foreach (var xtnCol in this.xtn_Data.Columns)
                {
                    var dgCol  = xtnCol as DataGridTextColumn;
                    var path   = dgCol.Binding.Path.Path;
                    var conver = _InitLoadParameter.ControlInfo.Convert.Where(p => p.ColumnName.ToLower().Equals(path.ToLower())).GetFirst <ColumnDBConvertInfo>();
                    i++;
                    if (null == conver)
                    {
                        continue;
                    }
                    dgCol.Visibility = System.Windows.Visibility.Collapsed;
                    MetaDataColumnInfo col = new MetaDataColumnInfo();
                    col.column_name    = string.Format("{0}_{1}", conver.RelationField, conver.ColumnName).ToLower();// conver.DisplayField;
                    col.column_comment = dgCol.Header.ToString();
                    col.data_type      = "varchar";
                    _DictData.Add(i, col);
                    i++;
                }
                foreach (var dict in _DictData)
                {
                    var test = this.GetDataGridTextColumn(dict.Value);
                    if (null == test)
                    {
                        continue;
                    }
                    this.xtn_Data.Columns.Insert(dict.Key, test);
                }
            }
            var items = DynamicallyGeneratedClass.ToList(ctrlExecSQLCmd.Result, _columns);

            this.xtn_Data.ItemsSource = items;
        }
コード例 #17
0
        /// <summary>
        /// 获取命令对象
        /// </summary>
        /// <param name="parentID">父节点ID</param>
        /// <param name="methodName">方法名称</param>
        /// <returns></returns>
        CtrlPlatformCommandInfo GetInitPlatformCommandInfo(int parentID, string methodName)
        {
            var cmd = new CtrlPlatformCommandInfo();

            cmd.CommandName = ConstantCollection.CommandName_MixedCommand;

            //-->目录
            cmd.ExecSql = new List <CtrlExecSQLCmd>();
            string sql  = string.Format("select * from PageDirectory t where t.parentID = {0} order by t.createDate ", parentID);
            var    exec = new CtrlExecSQLCmd(CtrlExecSqlCmdType.Query, sql, "PageDirectory", this.Name, methodName);

            cmd.ExecSql.Add(exec);
            //-->PageFile
            sql  = string.Format("select * from PageDirectorySub t where t.PageDirectoryId = {0} ", parentID);
            exec = new CtrlExecSQLCmd(CtrlExecSqlCmdType.Query, sql, "PageDirectorySub", this.Name, methodName);
            cmd.ExecSql.Add(exec);
            return(cmd);
        }
コード例 #18
0
        /// <summary>
        /// 删除操作
        /// </summary>
        /// <param name="cmd"></param>
        public void Delete(CtrlPlatformCommandInfo cmd)
        {
            var op = this.OutputParameter();

            if (null == op)
            {
                return;
            }

            List <String> _condition = new List <String>();
            string        insertSql  = string.Empty;
            //-->获取出主键来
            var columns = op.MetaDataInfo.Item.Where(p => p.column_key.IsNotEmpty() && p.column_key.Equals(ConstantCollection.TABLE_KEY)).GetTList <MetaDataColumnInfo>();

            if (null != columns || 0 < columns.Count)
            {
                foreach (var mdci in columns)
                {
                    _condition.Add(string.Format("{0} {1}", mdci.column_name, Wrapper.ConvertToDBTypeWhereUsing(mdci)));
                }
            }
            else
            {
                foreach (var mdci in op.MetaDataInfo.Item)
                {
                    _condition.Add(string.Format("{0} {1}", mdci.column_name, Wrapper.ConvertToDBTypeWhereUsing(mdci)));
                }
            }
            insertSql = string.Format("delete from {0} where {1} ", _TableName, string.Join(" and ", _condition));

            cmd                      = new CtrlPlatformCommandInfo();
            cmd.CommandName          = ConstantCollection.CommandName_MixedCommand;
            cmd.CompositeControlName = this.Name;
            cmd.ExecSql              = new List <CtrlExecSQLCmd>();
            var exec = new CtrlExecSQLCmd(CtrlExecSqlCmdType.ExecuteNonQuery, insertSql, _TableName, this.Name, ConstantCollection.COMPOSITE_CONTROL_DELETE);

            cmd.ExecSql.Add(exec);

            cmd.TempValue = new XElement("Execute", new XAttribute(ConstantCollection.METHOD_NAME, ConstantCollection.COMPOSITE_CONTROL_DELETE));
            this._IPageRuntime.SendCommand(cmd);
            this._NotifyRuntimePage(ConstantCollection.COMPOSITE_CONTROL_DELETE);
        }
コード例 #19
0
        /// <summary>
        /// 保存数据操作
        /// </summary>
        /// <param name="cmd"></param>
        public void SaveToDB(CtrlPlatformCommandInfo cmd)
        {
            string deleteSql = string.Empty;
            string insertSql = GetSaveToDBSqlSentence(ref deleteSql);

            cmd                      = new CtrlPlatformCommandInfo();
            cmd.CommandName          = ConstantCollection.CommandName_MixedCommand;
            cmd.CompositeControlName = this.Name;

            cmd.ExecSql = new List <CtrlExecSQLCmd>();
            var exec = new CtrlExecSQLCmd(CtrlExecSqlCmdType.ExecuteNonQuery, deleteSql, _MetaDataInfo.table_name, this.Name, ConstantCollection.COMPOSITE_CONTROL_SAVE_TO_DB);

            cmd.ExecSql.Add(exec);
            exec = new CtrlExecSQLCmd(CtrlExecSqlCmdType.ExecuteNonQuery, insertSql, _MetaDataInfo.table_name, this.Name, ConstantCollection.COMPOSITE_CONTROL_SAVE_TO_DB);
            cmd.ExecSql.Add(exec);

            cmd.TempValue = new XElement("execute", new XAttribute(ConstantCollection.METHOD_NAME, ConstantCollection.COMPOSITE_CONTROL_SAVE_TO_DB));
            this._IPageRuntime.SendCommand(cmd);
            this._NotifyRuntimePage(ConstantCollection.COMPOSITE_CONTROL_SAVE_TO_DB);
        }
コード例 #20
0
        void InitLoaded()
        {
            string Sql = string.Format("select t.table_name,tt.table_comment,tt.table_type,tt.create_time,t.column_name,t.is_nullable,t.data_type,");

            Sql += string.Format("t.column_comment,t.column_default,t.character_maximum_length,t.column_key,t.ordinal_position");
            Sql += string.Format(" from information_schema.COLUMNS t");
            Sql += string.Format(" INNER JOIN information_schema.tables tt on t.table_name = tt.table_name and t.TABLE_SCHEMA = tt.TABLE_SCHEMA");
            Sql += string.Format(" where t.TABLE_SCHEMA = 'db_system_platform'");
            Sql += string.Format(" order by t.TABLE_NAME");

            //Sql = Wrapper.ParseSqlSentence(Sql, "information_schema.columns");
            cmd             = new CtrlPlatformCommandInfo();
            cmd.CommandName = ConstantCollection.CommandName_MixedCommand;
            cmd.TempValue   = Wrapper.SetXmlValue(ConstantCollection.TABLE_SCHEMA, "InitLoaded");

            cmd.ExecSql = new List <CtrlExecSQLCmd>();
            var exec = new CtrlExecSQLCmd(CtrlExecSqlCmdType.Query, Sql, ConstantCollection.TABLE_SCHEMA, this.Name, "InitLoaded");

            cmd.ExecSql.Add(exec);

            this.SendToService(cmd, this);
        }
コード例 #21
0
        void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            if (null == SelectedItem)
            {
                Wrapper.ShowDialog("请选择要修改的事件流程。");
                return;
            }
            var edc = SelectedItem;

            cmd             = new CtrlPlatformCommandInfo();
            cmd.CommandName = ConstantCollection.CommandName_MixedCommand;

            cmd.ExecSql = new List <CtrlExecSQLCmd>();
            var Sql  = string.Format("delete from {0} where id = {1}", _TableName, edc.ID);
            var exec = new CtrlExecSQLCmd(CtrlExecSqlCmdType.ExecuteNonQuery, Sql, _TableName, this.Name, "DeleteEvent");

            cmd.ExecSql.Add(exec);

            cmd.TempValue = Wrapper.SetXmlValue("Delete", "DeleteEvent");
            this.SendToService(cmd, this);
            this.IsEnabled = false;
        }
コード例 #22
0
        /// <summary>
        /// 发送查询命令
        /// </summary>
        /// <param name="cmd">查询语句</param>
        /// <param name="commandName"></param>
        void SendQueryCommand(CtrlPlatformCommandInfo cmd, string commandName)
        {
            ctrlCmd = new CtrlPlatformCommandInfo();
            ctrlCmd.CompositeControlName = this.Name;
            ctrlCmd.CommandName          = ConstantCollection.CommandName_MixedCommand;
            ctrlCmd.ExecSql = new List <CtrlExecSQLCmd>();
            var exec = new CtrlExecSQLCmd(CtrlExecSqlCmdType.ExecuteNonQuery, "set @count=0", _TableName, this.Name, commandName);

            ctrlCmd.ExecSql.Add(exec);

            string totalSql = string.Empty;
            string sql      = _BuilderSqlSentence(cmd, out totalSql);

            exec = new CtrlExecSQLCmd(CtrlExecSqlCmdType.Query, sql, _TableName, this.Name, commandName);
            ctrlCmd.ExecSql.Add(exec);
            exec = new CtrlExecSQLCmd(CtrlExecSqlCmdType.ExecuteScalar, totalSql, _TableName, this.Name, commandName);
            ctrlCmd.ExecSql.Add(exec);
            exec = new CtrlExecSQLCmd(CtrlExecSqlCmdType.ExecuteNonQuery, "set @count=0", _TableName, this.Name, commandName);
            ctrlCmd.ExecSql.Add(exec);
            ctrlCmd.TempValue = new XElement("Query", new XAttribute(ConstantCollection.METHOD_NAME, commandName));
            this._IPageRuntime.SendCommand(ctrlCmd);
        }