Beispiel #1
0
        public async Task <int> Count(string search)
        {
            var totSchool = await Task.FromResult(_dapper.Get <int>($"select COUNT(*) from [Schools] WHERE SchoolName like '%{search}%'", null,
                                                                    commandType: CommandType.Text));

            return(totSchool);
        }
Beispiel #2
0
 public IEnumerable <Vendors> GetVendors()
 {
     //var vendors = dapper.Get<Vendors>(StoredProcedures.GetVendors,null,null,true,null,System.Data.CommandType.StoredProcedure);
     try
     {
         var vendors = dapper.Get <Vendors>("select * from VendorDetails with (nolock)", null, null, true, null, System.Data.CommandType.Text);
         return(vendors);
     }
     catch (Exception ex) {
         ex.Data["MethodAndClass"] = "GetVendors() in VendorRepository";
         throw ex;
     }
 }
Beispiel #3
0
 public IEnumerable <int> GetSunGrowPlants()
 {
     try
     {
         DynamicParameters parameters = new DynamicParameters();
         parameters.Add("@FromTable", "SunGrowPlantInformation");
         parameters.Add("@ColumnName", "PowerStationId");
         var plants = dapper.Get <SunGrowPlantInformation>(StoredProcedures.GetPlants, parameters, null, true, null, System.Data.CommandType.StoredProcedure);
         return(plants.Select(x => x.PowerStationId));
     }
     catch (Exception ex) {
         ex.Data["MethodAndClass"] = "GetSunGrowPlants() in SunGrowRepository";
         throw ex;
     }
 }
        public IEnumerable <PlantInformation> GetGoodWeePlants()
        {
            try
            {
                DynamicParameters parameters = new DynamicParameters();
                parameters.Add("@FromTable", "PlantInformation");
                parameters.Add("@ColumnName", "PlantId,CreatedTime");

                var plants = dapper.Get <PlantInformation>(StoredProcedures.GetPlants, parameters, null, true, null, System.Data.CommandType.StoredProcedure);
                return(plants);
            }
            catch (Exception ex)
            {
                ex.Data["MethodAndClass"] = "GetGoodWeePlants() in GoodWeeRepository";
                throw ex;
            }
        }