Exemplo n.º 1
0
        public static string ExpExcel(string path)
        {
            ReturnDoc obj_ReturnDoc = new ReturnDoc();

            try
            {
                Microsoft.Office.Interop.Excel.Application xlApp = new Microsoft.Office.Interop.Excel.Application();

                Microsoft.Office.Interop.Excel.Workbooks workbooks = xlApp.Workbooks;
                Microsoft.Office.Interop.Excel.Workbook  workbook  = workbooks.Add(Microsoft.Office.Interop.Excel.XlWBATemplate.xlWBATWorksheet);
                Microsoft.Office.Interop.Excel.Worksheet worksheet = (Microsoft.Office.Interop.Excel.Worksheet)workbook.Worksheets[1];//取得sheet1

                worksheet.Cells[1, 1] = "管道名称";


                // 数据查询

                OleDbDataReader rst = null;
                string          ret = CommonQuery.qryRst("select * from PIPELINE", ref rst);
                Int16           i   = 2;

                DicCache dic = DicCache.getInstance();

                if (ret.Equals("0"))
                {
                    while (rst.Read())
                    {
                        worksheet.Cells[i, 1] = rst["DATA1"].ToString();
                        i++;
                    }

                    rst.Close();
                }


                string sPath    = path;
                string filename = "海底管道数据导出.xls";

                workbook.Saved = true;
                workbook.SaveCopyAs(sPath + filename);

                xlApp.Quit();


                obj_ReturnDoc.addErrorResult(Common.RT_SUCCESS);
                obj_ReturnDoc.setFuncErrorInfo(filename);
            }
            catch (Exception e)
            {
                obj_ReturnDoc.addErrorResult(Common.RT_FUNCERROR);
                obj_ReturnDoc.setFuncErrorInfo(e.Message);
            }

            return(obj_ReturnDoc.getXml());
        }
Exemplo n.º 2
0
        public static string addNew(string strXml)
        {
            /// 创建执行对象
            DataStorage obj_Storage   = new DataStorage();
            ReturnDoc   obj_ReturnDoc = new ReturnDoc();

            try
            {
                XmlDocument obj_Doc = XmlFun.CreateNewDoc(strXml);
                XmlNodeList nodeLst = obj_Doc.SelectNodes("//*[@operation][@operation!='']");

                for (int i = 0; i < nodeLst.Count; i++)
                {
                    XmlElement ele_Temp = (XmlElement)nodeLst.Item(i);

                    // 分配学生编码
                    string strpersonid = NumAssign.assignID_B("100001", "1007");
                    XmlFun.setNodeValue(ele_Temp.SelectSingleNode("//PERSONID"), strpersonid);

                    string stT = ele_Temp.InnerXml;

                    //      创建插入数据的XML
                    string str_SQL = SQLAnalyse.analyseXMLSQL(ele_Temp);

                    obj_Storage.addSQL(str_SQL);
                }

                /// 执行
                string str_Return = obj_Storage.runSQL();


                if (!General.empty(str_Return))
                {
                    obj_ReturnDoc.addErrorResult(Common.RT_FUNCERROR);
                    obj_ReturnDoc.setFuncErrorInfo(str_Return);
                }
                else
                {
                    obj_ReturnDoc.addErrorResult(Common.RT_SUCCESS);
                }
            }
            catch (Exception e)
            {
                obj_ReturnDoc.addErrorResult(Common.RT_FUNCERROR);
                obj_ReturnDoc.setFuncErrorInfo(e.Message);
            }

            return(obj_ReturnDoc.getXml());
        }
Exemplo n.º 3
0
        /// <summary>
        /// 删除用户
        /// </summary>
        /// <param name="strUserID">用户编号</param>
        /// <returns></returns>
        public static string dropUser(string strUserID)
        {
            DataStorage storage = new DataStorage();
            string      str_SQL = "DELETE FROM USERLIST WHERE USERID='" + strUserID + "'";

            storage.addSQL(str_SQL);

            str_SQL = "DELETE FROM ROLEUSER WHERE USERID='" + strUserID + "'";
            storage.addSQL(str_SQL);
            // 执行
            string    strReturn = storage.runSQL();
            ReturnDoc returndoc = new ReturnDoc();

            if (!General.empty(strReturn))
            {
                returndoc.addErrorResult(Common.RT_FUNCERROR);
                returndoc.setFuncErrorInfo(strReturn);
            }
            else
            {
                returndoc.addErrorResult(Common.RT_SUCCESS);
            }

            return(returndoc.getXml());
        }
Exemplo n.º 4
0
        public static string addNew(string strXml)
        {
            DataDoc doc = new DataDoc(strXml);
            // 创建执行对象
            DataStorage storage = new DataStorage();
            int         size    = doc.getDataNum(Table.USERLIST);

            // 解析sql语句
            for (int i = 0; i < size; i++)
            {
                XmlElement ele = (XmlElement)doc.getDataNode(Table.USERLIST, i);
                string     a   = ele.InnerXml;

                XmlNode node  = XmlFun.getNode(ele, Field.USERID);
                string  strId = NumAssign.assignID_A("000002");
                XmlFun.setNodeValue(node, strId);

                storage.addSQL(SQLAnalyse.analyseXMLSQL(ele));
            }
            // 执行
            string    strReturn = storage.runSQL();
            ReturnDoc returndoc = new ReturnDoc();

            if (!General.empty(strReturn))
            {
                returndoc.addErrorResult(Common.RT_FUNCERROR);
                returndoc.setFuncErrorInfo(strReturn);
            }
            else
            {
                returndoc.addErrorResult(Common.RT_SUCCESS);
            }

            return(returndoc.getXml());
        }
Exemplo n.º 5
0
        /// <summary>
        /// 删除订单信息
        /// </summary>
        /// <param name="strOrdID">订单编码</param>
        /// <returns></returns>
        public static string ordersDel(string strOrdID)
        {
            /// 创建执行对象
            DataStorage obj_Storage   = new DataStorage();
            ReturnDoc   obj_ReturnDoc = new ReturnDoc();

            // 手工构造sql语句
            string str_SQL = "DELETE FROM PIPELINE WHERE PIPEID='" + strOrdID + "'";

            obj_Storage.addSQL(str_SQL);

            str_SQL = "DELETE FROM PIPELINEDETAIL WHERE PIPEID='" + strOrdID + "'";
            obj_Storage.addSQL(str_SQL);

            str_SQL = "DELETE FROM PIPELINEDETAIL1 WHERE PIPEID='" + strOrdID + "'";
            obj_Storage.addSQL(str_SQL);

            /// 执行sql
            string str_Return = obj_Storage.runSQL();


            if (!General.empty(str_Return))
            {
                obj_ReturnDoc.addErrorResult(Common.RT_FUNCERROR);
                obj_ReturnDoc.setFuncErrorInfo(str_Return);
            }
            else
            {
                obj_ReturnDoc.addErrorResult(Common.RT_SUCCESS);
            }

            return(obj_ReturnDoc.getXml());
        }
Exemplo n.º 6
0
        public static string drop(string strAffairTypeID)
        {
            DataStorage storage = new DataStorage();
            // 删除角色权限
            string strSQL = "DELETE FROM ROLEPOWER WHERE EVENTTYPEID IN (SELECT EVENTTYPEID FROM EVENTTYPE WHERE AFFAIRTYPEID='" + strAffairTypeID + "')";

            storage.addSQL(strSQL);

            // 删除对应的事件
            strSQL = "DELETE FROM EVENTTYPE WHERE AFFAIRTYPEID='" + strAffairTypeID + "'";
            storage.addSQL(strSQL);

            // 删除对应的事务
            strSQL = "DELETE FROM AFFAIRTYPE WHERE AFFAIRTYPEID='" + strAffairTypeID + "'";
            storage.addSQL(strSQL);
            // 执行
            string    strReturn = storage.runSQL();
            ReturnDoc returndoc = new ReturnDoc();

            if (!General.empty(strReturn))
            {
                returndoc.addErrorResult(Common.RT_FUNCERROR);
                returndoc.setFuncErrorInfo(strReturn);
            }
            else
            {
                returndoc.addErrorResult(Common.RT_SUCCESS);
            }
            return(returndoc.getXml());
        }
Exemplo n.º 7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            string sMothod = Request["method"];
            if (!General.empty(sMothod))
            {
                Type ts = typeof(baseRef);

                object obj = Activator.CreateInstance(ts, null); //获得一个实例

                object[] methodParamArgs = new object[] { Request, Response };

                MethodInfo mi = ts.GetMethod(sMothod);                 //获得执行方法

                string sXml = (string)mi.Invoke(obj, methodParamArgs); //带参数方法的调用并返回值

                Response.ContentType = "text/xml;charset=utf-8";
                Response.Charset     = "UTF-8";

                Response.Write(sXml);
            }
        }
        catch (Exception ex)
        {
            ReturnDoc obj_ReturnDoc = new ReturnDoc();
            obj_ReturnDoc.addErrorResult(ex.Message);
            obj_ReturnDoc.setFuncErrorInfo(Common.SRT_FUNCERROR);
            Response.Write(obj_ReturnDoc.getXml());
        }
    }
Exemplo n.º 8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.ContentType = "text/xml;charset=utf-8";
        Response.Charset     = "UTF-8";
        string    strDicName    = Request["txtDicName"];
        ReturnDoc obj_ReturnDoc = new ReturnDoc();

        try
        {
            General.CreateDicFile(strDicName);
            obj_ReturnDoc.setErrorResult(Common.SRT_SUCCESS);
        }
        catch (Exception ep)
        {
            obj_ReturnDoc.addErrorResult(ep.Message);
            obj_ReturnDoc.setFuncErrorInfo(Common.SRT_FUNCERROR);
        }

        Response.Write(obj_ReturnDoc.getXml());
    }