public string GetCarBrandName(int id) { CarBrandInfo entity = GetCarBrandModel(id, true); if (entity == null) { return(string.Empty); } return(entity.Name); }
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); }
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; }
private void LoadData() { int id = GetInt("id"); if (id > 0) { CurrentCarBrand = Cars.Instance.GetCarBrandModel(id, true); txtName.Value = CurrentCarBrand.Name; txtNameIndex.Value = CurrentCarBrand.NameIndex; } }
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); }
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"); }
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)); }
public int AddCarBrand(CarBrandInfo entity) { return CommonDataProvider.Instance().AddCarBrand(entity); }
public abstract void UpdateCarBrand(CarBrandInfo entity);
public abstract int AddCarBrand(CarBrandInfo entity);
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); }
public int AddCarBrand(CarBrandInfo entity) { return(CommonDataProvider.Instance().AddCarBrand(entity)); }
private void FillData(CarBrandInfo entity) { entity.Name = txtName.Value; entity.NameIndex = txtNameIndex.Value; }
public void UpdateCarBrand(CarBrandInfo entity) { CommonDataProvider.Instance().UpdateCarBrand(entity); }