Beispiel #1
0
        public static List <ReportParameterLabel> GetReportParameterLabelList(string filterExpression)
        {
            List <ReportParameterLabel> result = new List <ReportParameterLabel>();
            IDbContext ctx = DbFactory.Configure();

            try
            {
                DbHelper helper = new DbHelper(typeof(ReportParameterLabel));
                ctx.CommandText = helper.Select(filterExpression);
                using (IDataReader reader = DaoBase.GetDataReader(ctx))
                    while (reader.Read())
                    {
                        result.Add((ReportParameterLabel)helper.IDataReaderToObject(reader, new ReportParameterLabel()));
                    }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
            finally
            {
                ctx.Close();
            }
            return(result);
        }
Beispiel #2
0
        public static List <String> GetSysColumnsPKList(string tableName)
        {
            List <String> result = new List <String>();
            IDbContext    ctx    = DbFactory.Configure();

            try
            {
                DbHelper helper = new DbHelper(typeof(SysColumns));
                ctx.CommandText = string.Format("SELECT column_name FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE OBJECTPROPERTY(OBJECT_ID(constraint_name), 'IsPrimaryKey') = 1 AND table_name = '{0}'", tableName);
                using (IDataReader reader = DaoBase.GetDataReader(ctx))
                    while (reader.Read())
                    {
                        result.Add(reader[0].ToString());
                    }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
            finally
            {
                ctx.Close();
            }
            return(result);
        }
        public static List <spPharmacyStockCard> GetspPharmacyStockCardList(String[] parameterField, String[] param)
        {
            List <spPharmacyStockCard> result = new List <spPharmacyStockCard>();
            IDbContext ctx = DbFactory.Configure();

            try
            {
                DbHelper helper = new DbHelper(typeof(spPharmacyStockCard));
                ctx.CommandText = "spfmrpt_KartuPersediaanFarmasi";
                ctx.CommandType = System.Data.CommandType.StoredProcedure;
                //Add Parameter
                int count = parameterField.Length;
                for (int i = 0; i < count; i++)
                {
                    ctx.Add(parameterField[i], param[i]);
                }
                using (IDataReader reader = DaoBase.GetDataReader(ctx))
                    while (reader.Read())
                    {
                        result.Add((spPharmacyStockCard)helper.IDataReaderToObject(reader, new spPharmacyStockCard()));
                    }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
            finally
            {
                ctx.Close();
            }
            return(result);
        }
        public static List <spSensusRIPerBulanPerKelas> GetspSensusRIPerBulanPerKelasList(String[] parameterField, String[] param)
        {
            List <spSensusRIPerBulanPerKelas> result = new List <spSensusRIPerBulanPerKelas>();
            IDbContext ctx = DbFactory.Configure();

            try
            {
                DbHelper helper = new DbHelper(typeof(spSensusRIPerBulanPerKelas));
                ctx.CommandText = "sprirpt_SensusRI_perBulan_perKelas";
                ctx.CommandType = System.Data.CommandType.StoredProcedure;
                //Add Parameter
                int count = parameterField.Length;
                for (int i = 0; i < count; i++)
                {
                    ctx.Add(parameterField[i], param[i]);
                }
                using (IDataReader reader = DaoBase.GetDataReader(ctx))
                    while (reader.Read())
                    {
                        result.Add((spSensusRIPerBulanPerKelas)helper.IDataReaderToObject(reader, new spSensusRIPerBulanPerKelas()));
                    }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
            finally
            {
                ctx.Close();
            }
            return(result);
        }
        public static DataTable GetDataReport(string procedureName, string[] parameterField, string[] param)
        {
            DataTable  result;
            IDbContext ctx = DbFactory.Configure();

            try
            {
                ctx.CommandText = procedureName;
                ctx.CommandType = CommandType.StoredProcedure;
                ctx.Clear();
                //Add Parameter
                int count = parameterField.Length;
                for (int i = 0; i < count; i++)
                {
                    ctx.Add(parameterField[i], param[i]);
                }

                //Get DataReader
                result = DaoBase.GetDataTable(ctx);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
            finally
            {
                ctx.Close();
            }

            return(result);
        }