Пример #1
0
        /// <summary>
        /// exect sql
        /// </summary>
        /// <param name="sProcName"></param>
        /// <param name="dicParams"></param>
        /// <returns></returns>
        public ResultInfo <int> ExcuteSqlEntpriseLib(string sql, Dictionary <string, object> dicParams)
        {
            using (DbCommand cmd = CurrentDatabase.GetSqlStringCommand(sql))
            {
                foreach (string str in dicParams.Keys)
                {
                    CurrentDatabase.AddInParameter(cmd, str, DbType.Object, dicParams[str]);
                }
                CurrentDatabase.AddParameter(cmd, "ReturnValue", System.Data.DbType.Int32, System.Data.ParameterDirection.ReturnValue, "", System.Data.DataRowVersion.Current, 0);
                base.ExecuteNonQuery(cmd);//use thinkDev.data.dll to excute sp
                //CurrentDatabase.ExecuteNonQuery(cmd);
                int ReturnValue = int.Parse(cmd.Parameters["@ReturnValue"].Value.ToString());

                ResultInfo <int> result = SetRullErr(ReturnValue.ToString(), ReturnValue, 0);
                return(result);
            }
        }
Пример #2
0
        /// <summary>
        /// get dataSet
        /// </summary>
        /// <param name="sProcName"></param>
        /// <param name="dicParams"></param>
        /// <returns></returns>
        public ResultInfo <DataSet> getDataSetEntpriseLib(string sProcName, Dictionary <string, object> dicParams)
        {
            using (DbCommand cmd = CurrentDatabase.GetStoredProcCommand(sProcName))
            {
                foreach (string str in dicParams.Keys)
                {
                    CurrentDatabase.AddInParameter(cmd, str, DbType.Object, dicParams[str]);
                }
                CurrentDatabase.AddParameter(cmd, "ReturnValue", System.Data.DbType.Int32, System.Data.ParameterDirection.ReturnValue, "", System.Data.DataRowVersion.Current, 0);
                CurrentDatabase.AddOutParameter(cmd, "@Count", DbType.Int32, 10);

                DataSet st = base.ExecuteDataSet(cmd);//use thinkDev.data.dll to excute sp
                //CurrentDatabase.ExecuteDataSet(cmd);
                int count                   = int.Parse(cmd.Parameters["@Count"].Value.ToString());
                int ReturnValue             = int.Parse(cmd.Parameters["@ReturnValue"].Value.ToString());
                ResultInfo <DataSet> result = new ResultInfo <DataSet>(false, "", "0", st);
                return(result);
            }
        }
Пример #3
0
        /// <summary>
        /// getList by sql
        /// </summary>
        /// <param name="dicParams"></param>
        /// <param name="sProcName"></param>
        /// <returns></returns>
        public ResultInfo <List <SysUserInfo> > getListEntpriseLibsql(string sql, Dictionary <string, object> dicParams)
        {
            List <SysUserInfo> list = new List <SysUserInfo>();

            using (DbCommand cmd = CurrentDatabase.GetSqlStringCommand(sql))
            {
                foreach (string str in dicParams.Keys)
                {
                    CurrentDatabase.AddInParameter(cmd, str, DbType.Object, dicParams[str]);
                }
                CurrentDatabase.AddParameter(cmd, "ReturnValue", System.Data.DbType.Int32, System.Data.ParameterDirection.ReturnValue, "", System.Data.DataRowVersion.Current, 0);
                CurrentDatabase.AddOutParameter(cmd, "@Count", DbType.Int32, 10);


                System.Data.IDataReader dr = ExecuteDataReader(cmd);//use thinkDev.data.dll to excute sp
                //System.Data.IDataReader dr = CurrentDatabase.ExecuteReader(cmd);
                //int ReturnValue = int.Parse(cmd.Parameters["@ReturnValue"].Value.ToString());
                list = GetObjectList <SysUserInfo>(dr);

                ResultInfo <List <SysUserInfo> > result = new ResultInfo <List <SysUserInfo> >(false, "", "0", list);
                return(result);
            }
        }