Ejemplo n.º 1
0
 /// <summary>
 /// 执行无返回值SQL语句
 /// </summary>
 /// <param name="strSQL"></param>
 /// <returns></returns>
 public int ExecuteSQL(string strSQL)
 {
     if (DataLib.SysVar.intConnect == 0)
     {
         JxcService.Service myService = GetService();
         string             strErr    = myService.ExecuteSQL(SysVar.strDB, strSQL);
         if (strErr.Length > 0)
         {
             MessageBox.Show(strErr, "错误");
             return(-1);
         }
         return(0);
     }
     else
     {
         CenterLib.Service obj    = GetObj();
         string            strErr = obj.ExecuteSQL(SysVar.strDB, strSQL);
         if (strErr.Length > 0)
         {
             MessageBox.Show(strErr, "错误");
             return(-1);
         }
         return(0);
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 多数据集保存,传递数据集数组及SQL语句数组
        /// </summary>
        /// <param name="ds"></param>
        /// <param name="strSQL"></param>
        /// <returns></returns>
        public string SaveMuteData(DataSet[] ds, string[] strSQL)
        {
            if (DataLib.SysVar.intConnect == 0)
            {
                JxcService.Service myService = GetService();
                string             strErr    = myService.SaveMuteData(SysVar.strDB, ds, strSQL);
                if (strErr.Length > 0)
                {
                    MessageBox.Show(strErr, "错误");
                    return(strErr);
                }
                return("");
            }
            else
            {
                CenterLib.Service obj = GetObj();

                string strErr = obj.SaveMuteData(SysVar.strDB, ds, strSQL);
                if (strErr.Length > 0)
                {
                    MessageBox.Show(strErr, "错误");
                    return(strErr);
                }
                return("");
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 多数据集保存(带参数)
        /// </summary>
        /// <param name="ds"></param>
        /// <param name="strSQL"></param>
        /// <returns></returns>
        public string SaveMuteData1(DataSet[] ds, string[] strSQL, Hashtable parm)
        {
            if (DataLib.SysVar.intConnect == 0)
            {
                JxcService.Service myService = GetService();
                byte[]             bytes     = DataSetCompression.SerializeData(parm);
                string             strErr    = myService.SaveMuteData1(SysVar.strDB, ds, strSQL, bytes);
                if (strErr.Length > 0)
                {
                    MessageBox.Show(strErr, "错误");
                    return(strErr);
                }
                return("");
            }
            else
            {
                CenterLib.Service obj = GetObj();

                string strErr = obj.SaveMuteData1(SysVar.strDB, ds, strSQL, parm);
                if (strErr.Length > 0)
                {
                    MessageBox.Show(strErr, "错误");
                    return(strErr);
                }
                return("");
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 带参数SQL,并返回结果数据集
        /// </summary>
        /// <param name="strSQL"></param>
        /// <param name="parm"></param>
        /// <returns></returns>
        public DataSet GetOtherDs(string strSQL, Hashtable parm)
        {
            string err = "";

            if (DataLib.SysVar.intConnect == 0)
            {
                JxcService.Service myService = GetService();

                byte[] bytes = DataSetCompression.SerializeData(parm);

                byte[] bUserData = myService.GetOtherByte(ref err, SysVar.strDB, strSQL, bytes);
                if (err != "")
                {
                    MessageBox.Show(err, "错误");
                    err = "";
                    return(null);
                }
                DataSet ds = DataSetCompression.DecompressionDataSet(bUserData);
                return(ds);
            }
            else
            {
                CenterLib.Service obj       = GetObj();
                byte[]            bUserData = obj.GetOtherByte(ref err, SysVar.strDB, strSQL, parm);
                if (err != "")
                {
                    MessageBox.Show(err, "错误");
                    err = "";
                    return(null);
                }
                DataSet ds = DataSetCompression.DecompressionDataSet(bUserData);
                return(ds);
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 根据传过去的SQL语句得到相应数据集
        /// </summary>
        /// <param name="strSQL"></param>
        /// <returns></returns>
        public DataSet GetDs(string strSQL)
        {
            string  err = "";
            DataSet ds  = null;

            byte[] bUserData = null;
            if (DataLib.SysVar.intConnect == 0)
            {
                JxcService.Service myService = GetService();
                bUserData = myService.GetCompressDataSet(ref err, SysVar.strDB, strSQL);
                if (err != "")
                {
                    MessageBox.Show(err, "错误");
                    err = "";
                    return(null);
                }
                ds = DataSetCompression.DecompressionDataSet(bUserData);
                return(ds);
            }
            else
            {
                CenterLib.Service obj = GetObj();

                bUserData = obj.GetCompressDataSet(ref err, SysVar.strDB, strSQL);
                if (err != "")
                {
                    MessageBox.Show(err, "错误");
                    err = "";
                    return(null);
                }
                ds = DataSetCompression.DecompressionDataSet(bUserData);
                return(ds);
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 取得后台设置的帐套
        /// </summary>
        /// <returns></returns>
        public DataSet GetAccount(string sFlag)
        {
            if (DataLib.SysVar.intConnect == 0)
            {
                JxcService.Service myService = GetService();
                return(myService.GetAccount());
            }
            else
            {
                CenterLib.Service obj = GetObj();
                DataSet           ds1 = obj.GetAccount(sFlag);


                return(ds1);
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 测试是否登录成功
        /// </summary>
        /// <param name="strServer"></param>
        /// <returns></returns>
        public bool TestLogin(string strServer)
        {
            SysVar.strServer = strServer;
            if (DataLib.SysVar.intConnect == 0)
            {
                JxcService.Service myService = GetService();
                if (myService.Login("YGA", "Kinger") == "success")
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                CenterLib.Service obj = GetObj();

                if (obj.Login("YGA", "Kinger") == "success")
                {
                    return(true);
                }
                else
                {
                    return(false);
                }

                /*
                 *
                 * try
                 * {
                 *  if (obj.Login("YGA", "Kinger") == "success")
                 *      return true;
                 *  else
                 *      return false;
                 * }
                 * catch (Exception E)
                 * {
                 *  MessageBox.Show(E.Message, "错误");
                 *  return false;
                 * }
                 */
            }
        }
Ejemplo n.º 8
0
 /// <summary>
 /// WebService取得相应服务
 /// </summary>
 /// <returns></returns>
 private JxcService.Service GetService()
 {
     JxcService.Service myService = new JxcService.Service();
     myService.Url = SysVar.strUrl;
     return(myService);
 }
Ejemplo n.º 9
0
 /// <summary>
 /// 从中间层(webservice)取连接数据库字符串
 /// </summary>
 /// <returns></returns>
 public string GetCon()
 {
     JxcService.Service myService = GetService();
     return(myService.GetConStr(DataLib.SysVar.strDB));
 }