示例#1
0
文件: Cars.cs 项目: shaohaiou/comopp
        public string GetCarBrandName(int id)
        {
            CarBrandInfo entity = GetCarBrandModel(id, true);

            if (entity == null)
            {
                return(string.Empty);
            }
            return(entity.Name);
        }
示例#2
0
文件: Cars.cs 项目: shaohaiou/comopp
        public CarBrandInfo GetCarBrandModel(int id, bool fromCache = false)
        {
            CarBrandInfo entity = null;

            List <CarBrandInfo> list = GetCarBrandList(fromCache);

            entity = list.Find(c => c.ID == id);

            return(entity);
        }
示例#3
0
        public static CarBrandInfo PopulateCarBrandInfo(IDataReader reader)
        {
            CarBrandInfo entity = new CarBrandInfo()
            {
                ID = (int)reader["ID"],
                Name = reader["Name"] as string,
                NameIndex = reader["NameIndex"] as string
            };

            return entity;
        }
示例#4
0
        private void LoadData()
        {
            int id = GetInt("id");
            if (id > 0)
            {
                CurrentCarBrand = Cars.Instance.GetCarBrandModel(id, true);

                txtName.Value = CurrentCarBrand.Name;
                txtNameIndex.Value = CurrentCarBrand.NameIndex;
            }
        }
示例#5
0
        public static CarBrandInfo PopulateCarBrandInfo(IDataReader reader)
        {
            CarBrandInfo entity = new CarBrandInfo()
            {
                ID        = (int)reader["ID"],
                Name      = reader["Name"] as string,
                NameIndex = reader["NameIndex"] as string
            };

            return(entity);
        }
示例#6
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            CarBrandInfo entity = new CarBrandInfo();
            int id = GetInt("id");
            if (id > 0) entity = Cars.Instance.GetCarBrandModel(id, true);
            FillData(entity);

            if (id > 0) Cars.Instance.UpdateCarBrand(entity);
            else Cars.Instance.AddCarBrand(entity);

            Cars.Instance.ReloadCarBrandListCache();
            Response.Redirect("carbrandmg.aspx");
        }
示例#7
0
 public override int AddCarBrand(CarBrandInfo entity)
 {
     string sql = @"INSERT INTO ComOpp_CarBrand(
         [Name]
         ,[NameIndex]
     )VALUES(
         @Name
         ,@NameIndex
     );SELECT @@IDENTITY";
     SqlParameter[] p =
     {
         new SqlParameter("@Name",entity.Name),
         new SqlParameter("@NameIndex",entity.NameIndex)
     };
     return DataConvert.SafeInt(SqlHelper.ExecuteScalar(_con, CommandType.Text, sql, p));
 }
示例#8
0
文件: Cars.cs 项目: shaohaiou/comopp
 public int AddCarBrand(CarBrandInfo entity)
 {
     return CommonDataProvider.Instance().AddCarBrand(entity);
 }
示例#9
0
 public abstract void UpdateCarBrand(CarBrandInfo entity);
示例#10
0
 public abstract int AddCarBrand(CarBrandInfo entity);
示例#11
0
 public abstract void UpdateCarBrand(CarBrandInfo entity);
示例#12
0
 public override void UpdateCarBrand(CarBrandInfo entity)
 {
     string sql = @"
     UPDATE ComOpp_CarBrand set
         Name = @Name
         ,NameIndex = @NameIndex
     WHERE ID=@ID";
     SqlParameter[] parameters =
     {
         new SqlParameter("@ID", entity.ID),
         new SqlParameter("@Name", entity.Name),
         new SqlParameter("@NameIndex", entity.NameIndex)
     };
     SqlHelper.ExecuteNonQuery(_con, CommandType.Text, sql, parameters);
 }
示例#13
0
文件: Cars.cs 项目: shaohaiou/comopp
 public int AddCarBrand(CarBrandInfo entity)
 {
     return(CommonDataProvider.Instance().AddCarBrand(entity));
 }
示例#14
0
 public abstract int AddCarBrand(CarBrandInfo entity);
示例#15
0
 private void FillData(CarBrandInfo entity)
 {
     entity.Name = txtName.Value;
     entity.NameIndex = txtNameIndex.Value;
 }
示例#16
0
文件: Cars.cs 项目: shaohaiou/comopp
 public void UpdateCarBrand(CarBrandInfo entity)
 {
     CommonDataProvider.Instance().UpdateCarBrand(entity);
 }
示例#17
0
文件: Cars.cs 项目: shaohaiou/comopp
 public void UpdateCarBrand(CarBrandInfo entity)
 {
     CommonDataProvider.Instance().UpdateCarBrand(entity);
 }