コード例 #1
0
        /// <summary>
        /// 查询系统所有的自定义表信息
        /// </summary>
        /// <returns></returns>
        public DataTable GetTables()
        {
            string      sql     = "select * from sysobjects where xtype='U'";
            DataCommand command = DataCommandManager.CreateCustomDataCommand("JooWMS", CommandType.Text, sql);
            DataSet     ds      = command.ExecuteDataSet();

            if (ds != null && ds.Tables.Count > 0)
            {
                return(ds.Tables[0]);
            }
            return(null);
        }
コード例 #2
0
ファイル: CustomerBIZ.cs プロジェクト: sanlonezhang/ql
 private void CreateCustomerPhone(string sqlInsert)
 {
     if (!string.IsNullOrEmpty(sqlInsert))
     {
         try
         {
             DataCommand dc = DataCommandManager.CreateCustomDataCommand("OverseaCustomerManagement", CommandType.Text, sqlInsert);
             dc.ExecuteNonQuery();
         }
         catch
         {
         }
     }
 }
コード例 #3
0
        /// <summary>
        /// 获取数据源
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="list"></param>
        /// <returns></returns>
        public DataSet GetDataSource(ReportsEntity entity, List <ReportParamsEntity> list)
        {
            DataCommand command = null;
            DataSet     ds      = null;

            if (entity.DsType == (int)EDataSourceType.SQL)
            {
                command = DataCommandManager.CreateCustomDataCommand("GitWMS", CommandType.Text, entity.DataSource);
            }
            else
            {
                command = DataCommandManager.CreateCustomDataCommand("GitWMS", CommandType.StoredProcedure, entity.DataSource);
            }
            if (list != null)
            {
                foreach (ReportParamsEntity item in list)
                {
                    DbType dbType = DbType.String;
                    if (item.ParamType == "datetime" || item.ParamType == "date")
                    {
                        dbType            = DbType.DateTime;
                        item.DefaultValue = string.IsNullOrEmpty(item.DefaultValue) ? DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") : item.DefaultValue;
                    }
                    else if (item.ParamType == "int")
                    {
                        dbType            = DbType.Int32;
                        item.DefaultValue = string.IsNullOrEmpty(item.DefaultValue) ? "0" : item.DefaultValue;
                    }
                    else
                    {
                        item.DefaultValue = string.IsNullOrEmpty(item.DefaultValue) ? "" : item.DefaultValue;
                    }
                    command.AddParameterValue(item.ParamName, item.DefaultValue, dbType);
                }
            }
            ds = command.ExecuteDataSet();

            return(ds);
        }