Пример #1
0
        /// <summary>
        /// ��ȡָ����Ԫ���������б�
        /// </summary>
        /// <returns>����������Ŀ����</returns>
        private CommandItem[] GetCommandItemList()
        {
            if (null == this._xmlnode) return new CommandItem[0];
            XmlNodeList itemlist = this._xmlnode.SelectNodes("CommandItem");
            CommandItem[] cmdItemList = new CommandItem[itemlist.Count];

            for (int i = 0; i < itemlist.Count; i++)
            {
                cmdItemList[i] = new CommandItem();
                cmdItemList[i].ItemName = itemlist[i].Attributes["name"].Value;
                if (null != itemlist[i].Attributes["dataitem"])
                    cmdItemList[i].DataSrc = itemlist[i].Attributes["dataitem"].Value;
                if (null != itemlist[i].Attributes["topic"])
                    cmdItemList[i].Topic = itemlist[i].Attributes["topic"].Value;
                if (null == itemlist[i].Attributes["funtype"] || "" == itemlist[i].Attributes["funtype"].Value
                    || "sqlcmd" == itemlist[i].Attributes["funtype"].Value.ToLower())
                    cmdItemList[i].FunType = AppendFunType.SqlCmd;
                else if ("xmltodb" == itemlist[i].Attributes["funtype"].Value.ToLower())
                    cmdItemList[i].FunType = AppendFunType.ImportFromExecel;
                else if ("sqlcmdlist" == itemlist[i].Attributes["funtype"].Value.ToLower())
                    cmdItemList[i].FunType = AppendFunType.SqlCmdList;
                else
                    cmdItemList[i].FunType = AppendFunType.SqlCmd;
            }
            return cmdItemList;
        }
Пример #2
0
        /// <summary>
        /// 执行从xml格式的Excel文件导入数据操作
        /// 文件上报设计说明:
        /// 模板文件管理
        ///		内容包括:
        ///		上报主题: 上报主题是指上报的文件存在数据库后,通过操作上报主题的名子
        ///		,即子项名,打开上报后的数据浏览界面;
        ///		上报文件模板:上报的文件是基于模板进行解析的,模板固定存放于一个指定
        /// 	的文件夹中;
        ///		上报模板数据库名称:模板文件中有数据库的名称,不需要另外设置。
        ///		上报主题的目的是为了给远程上报者一个直观的报表标题,不能使用抽象的数据库名称,
        ///		上报主题与上报模板一一对应;
        ///
        ///	上报文件:上报文件是指按上报即定的格式上报的文件,通过上报报表登记界面进行上报,上报后存于指定的服务器文件夹中;
        ///			有关的上报时间等参数用于存放在数据库中对应的字段。
        /// 上报文件存放于"/DataSource/水利局/upload/"中,
        /// </summary>
        /// <param name="cmdCur">当前的命令项目</param>
        private void exeXmlToDB(CommandItem cmdCur)
        {
            //获取模板文件和当前上报文件
            QueryDataRes query = this.PgSysQuery;
            NameObjectList paramList = new NameObjectList();

            //step 1 得到报表主题: 读表[报表上传登记],得到报表主题和报表模板文件fileNameTp = 模板文件名,根据约定的文档存贮路径,得到数据文件。

            paramList.Add("主题名称", cmdCur.Topic);
            DataTable tab = query.getTable("报表文件配置", paramList);
            if (null == tab || tab.Rows.Count < 1) return;
            string fileNameTp = tab.Rows[0]["上报模板"].ToString();

            NameObjectList paramListUp = BuildParamList.BuildParams(this.PgParamXmlDoc);
            paramListUp.Add("主题名称", cmdCur.Topic);
            DataTable tabUpLoad = query.getTable("上报报表文件", paramListUp);
            if (null == tabUpLoad || tabUpLoad.Rows.Count < 1 || null == tabUpLoad.Rows[0]["文件"])
                return;
            string fileNameUp = tabUpLoad.Rows[0]["文件"].ToString();

            fileNameTp = this.Server.MapPath(DataAccRes.AppSettings("TpFilePath") + fileNameTp);
            fileNameUp = this.Server.MapPath(DataAccRes.AppSettings("DocFilePath") + fileNameUp);
            bool brtn = this.PgQuery.ExecuteInsert(cmdCur.DataSrc, csExcel2DB.CreateParamsList(fileNameTp, fileNameUp));
            if (true == brtn)
                leofun.Alert("您已成功执行了 [" + cmdCur.ItemName + "] 操作! ", this);
            else
                leofun.Alert("操作失败! 请检查", this);
            return;
        }
Пример #3
0
		/// <summary>
		/// 获取指定单元的命令项列表
		/// </summary>
		/// <returns>返回命令项目数组</returns>
		private CommandItem[]	GetCommandItemList()
		{
            if (null == this.dtComItem) return new CommandItem[0];
            DataRow[] itemlist = this.dtComItem.Select();
			CommandItem[]	cmdItemList=new CommandItem[itemlist.Length];

			for(int i=0;i<itemlist.Length;i++)
			{
				cmdItemList[i]=new CommandItem();
				cmdItemList[i].ItemName=itemlist[i]["name"].ToString();
                if(null!=itemlist[i]["dataitem"])
				    cmdItemList[i].DataSrc=itemlist[i]["dataitem"].ToString();
                if(null!=itemlist[i]["topic"])
				    cmdItemList[i].Topic=itemlist[i]["topic"].ToString();
				if(null==itemlist[i]["funtype"] || ""==itemlist[i]["funtype"].ToString()
					|| "sqlcmd"==itemlist[i]["funtype"].ToString().ToLower())
					cmdItemList[i].FunType=AppendFunType.SqlCmd;
				else if ("xmltodb"==itemlist[i]["funtype"].ToString().ToLower())
					cmdItemList[i].FunType=AppendFunType.ImportFromExecel;
                else if ("sqlcmdlist" == itemlist[i]["funtype"].ToString().ToLower())
                    cmdItemList[i].FunType = AppendFunType.SqlCmdList;
                else
					cmdItemList[i].FunType=AppendFunType.SqlCmd;
			}
			return cmdItemList;
		}