Пример #1
0
        public IEnumerable <IdNameViewModel> GetModelByBrandIdName(int brandId)
        {
            var parameters = new List <SqlParameter>();

            parameters.Add(sqlHelper.CreateParameter("@BrandId", brandId, DbType.Int32));
            var dataReader = sqlHelper.GetDataReader("SELECT Id, Name From Models WHERE BrandId=@BrandId",
                                                     CommandType.Text, parameters.ToArray(), out connection);

            try
            {
                var banTypes = new List <IdNameViewModel>();
                while (dataReader.Read())
                {
                    var banType = new IdNameViewModel();
                    banType.Id   = Convert.ToInt32(dataReader["Id"].ToString());
                    banType.Name = dataReader["Name"].ToString();
                    banTypes.Add(banType);
                }

                return(banTypes);
            }
            catch (Exception exp)
            {
                throw;
            }
            finally
            {
                dataReader.Close();
                CloseConnection();
            }
        }
        public ActionResult DestroyGoverningStatuteAsync(int id)
        {
            IdNameViewModel obj = mainRepository.GetGoverningStatuteById(id);

            mainRepository.DeleteGoverningStatutes(obj);
            return(Json(""));
        }
        public ActionResult DestroyRetainerAsync(int id)
        {
            IdNameViewModel obj = mainRepository.GetRetainerById(id);

            mainRepository.DeleteRetainer(obj);
            return(Json(""));
        }
Пример #4
0
        public IEnumerable <IdNameViewModel> GetEngineCapacitiesByIdName()
        {
            var parameters = new List <SqlParameter>();
            var dataReader = sqlHelper.GetDataReader("SELECT Id,Capacity From EngineCapacities ",
                                                     CommandType.Text, null, out connection);

            try
            {
                var engineCapacities = new List <IdNameViewModel>();
                while (dataReader.Read())
                {
                    var engineCapacitie = new IdNameViewModel();
                    engineCapacitie.Id   = Convert.ToInt32(dataReader["Id"].ToString());
                    engineCapacitie.Name = dataReader["Capacity"].ToString();
                    engineCapacities.Add(engineCapacitie);
                }

                return(engineCapacities);
            }
            catch (Exception ex)
            {
                throw;
            }
            finally
            {
                dataReader.Close();
                CloseConnection();
            }
        }
Пример #5
0
        public IEnumerable <IdNameViewModel> GetBanTypesByIdName()
        {
            var parameters = new List <SqlParameter>();
            var dataReader = sqlHelper.GetDataReader("SELECT Id, Name From BanTypes ",
                                                     CommandType.Text, null, out connection);

            try
            {
                var banTypes = new List <IdNameViewModel>();
                while (dataReader.Read())
                {
                    var banType = new IdNameViewModel();
                    banType.Id   = Convert.ToInt32(dataReader["Id"].ToString());
                    banType.Name = dataReader["Name"].ToString();
                    banTypes.Add(banType);
                }

                return(banTypes);
            }
            catch (Exception exp)
            {
                ;
                throw;
            }
            finally
            {
                dataReader.Close();
                CloseConnection();
            }
        }
        public void InsertRetainer(IdNameViewModel ovm)
        {
            Retainer newRecord = new Retainer {
                RET_Id = ovm.Id, RET_Name = ovm.Name
            };

            context.Retainers.Add(newRecord);
            context.SaveChanges();
        }
        public void InsertGoverningStatutes(IdNameViewModel ovm)
        {
            GoverningStatute newRecord = new GoverningStatute {
                GST_Id = ovm.Id, GST_Name = ovm.Name
            };

            context.GoverningStatutes.Add(newRecord);
            context.SaveChanges();
        }
        public void InsertGoverningRegulation(IdNameViewModel ovm)
        {
            GoverningRegulation newRecord = new GoverningRegulation {
                GRE_Id = ovm.Id, GRE_Name = ovm.Name
            };

            context.GoverningRegulations.Add(newRecord);
            context.SaveChanges();
        }
        public void InsertGoverningPolicy(IdNameViewModel ovm)
        {
            GoverningPolicy newRecord = new GoverningPolicy {
                GPO_Id = ovm.Id, GPO_Name = ovm.Name
            };

            context.GoverningPolicies.Add(newRecord);
            context.SaveChanges();
        }
        public void DeleteRetainer(IdNameViewModel ovm)
        {
            Retainer newRecord = new Retainer {
                RET_Id = ovm.Id, RET_Name = ovm.Name
            };

            context.Retainers.Attach(newRecord);
            context.Retainers.Remove(newRecord);
            context.SaveChanges();
        }
        public void UpdateGoverningStatutes(IdNameViewModel ovm)
        {
            GoverningStatute newRecord = new GoverningStatute {
                GST_Id = ovm.Id, GST_Name = ovm.Name
            };

            context.GoverningStatutes.Attach(newRecord);
            context.Entry(newRecord).State = EntityState.Modified;
            context.SaveChanges();
        }
        public void DeleteGoverningStatutes(IdNameViewModel ovm)
        {
            GoverningStatute newRecord = new GoverningStatute {
                GST_Id = ovm.Id, GST_Name = ovm.Name
            };

            context.GoverningStatutes.Attach(newRecord);
            context.GoverningStatutes.Remove(newRecord);
            context.SaveChanges();
        }
        public void DeleteGoverningRegulation(IdNameViewModel ovm)
        {
            GoverningRegulation newRecord = new GoverningRegulation {
                GRE_Id = ovm.Id, GRE_Name = ovm.Name
            };

            context.GoverningRegulations.Attach(newRecord);
            context.GoverningRegulations.Remove(newRecord);
            context.SaveChanges();
        }
        public void UpdateGoverningPolicy(IdNameViewModel ovm)
        {
            GoverningPolicy newRecord = new GoverningPolicy {
                GPO_Id = ovm.Id, GPO_Name = ovm.Name
            };

            context.GoverningPolicies.Attach(newRecord);
            context.Entry(newRecord).State = EntityState.Modified;
            context.SaveChanges();
        }
        public void DeleteGoverningPolicy(IdNameViewModel ovm)
        {
            GoverningPolicy newRecord = new GoverningPolicy {
                GPO_Id = ovm.Id, GPO_Name = ovm.Name
            };

            context.GoverningPolicies.Attach(newRecord);
            context.GoverningPolicies.Remove(newRecord);
            context.SaveChanges();
        }
        public void UpdateRetainer(IdNameViewModel ovm)
        {
            Retainer newRecord = new Retainer {
                RET_Id = ovm.Id, RET_Name = ovm.Name
            };

            context.Retainers.Attach(newRecord);
            context.Entry(newRecord).State = EntityState.Modified;
            context.SaveChanges();
        }
        public void UpdateGoverningRegulation(IdNameViewModel ovm)
        {
            GoverningRegulation newRecord = new GoverningRegulation {
                GRE_Id = ovm.Id, GRE_Name = ovm.Name
            };

            context.GoverningRegulations.Attach(newRecord);
            context.Entry(newRecord).State = EntityState.Modified;
            context.SaveChanges();
        }
 public ActionResult DestroyRetainer([DataSourceRequest] DataSourceRequest request, IdNameViewModel obj)
 {
     mainRepository.DeleteRetainer(obj);
     return(Json(new[] { obj }.ToDataSourceResult(request, ModelState)));
 }
 public ActionResult CreateGoverningStatute([DataSourceRequest] DataSourceRequest request, IdNameViewModel obj)
 {
     if (ModelState.IsValid)
     {
         mainRepository.InsertGoverningStatutes(obj);
     }
     return(Json(new[] { obj }.ToDataSourceResult(request, ModelState)));
 }
 public ActionResult UpdateRetainer([DataSourceRequest] DataSourceRequest request, IdNameViewModel obj)
 {
     if (ModelState.IsValid)
     {
         mainRepository.UpdateRetainer(obj);
     }
     return(Json(new[] { obj }.ToDataSourceResult(request, ModelState)));
 }