/// <summary> /// 更改车型信息 /// </summary> /// <param name="New_Type">新的车型实体</param> /// <returns></returns> public bool UpdateType(Car_Type TempType) { Car_Type OldType = DB_Type.Select(P => P.Type_ID == TempType.Type_ID).Single(); Car_Type NewType = OldType; NewType.Type_Info = TempType.Type_Info; NewType.Type_Name = TempType.Type_Name; return(DB_Type.Update(OldType, NewType)); }
/// <summary> /// 类型选择框变动事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void LB_Type_SelectedIndexChanged(object sender, EventArgs e) { if (Mark) { String TypeName = LB_Type.SelectedItem.ToString(); Car_Type Cartype = List_Type.Where(P => P.Type_Name == TypeName).Single(); TB_TypeName.Text = Cartype.Type_Name; TB_TypeInfo.Text = Cartype.Type_Info; } }
public IList <Car_Type> GetAllType() { string sql = "usp_SelcectCarType"; List <Car_Type> list = new List <Car_Type>(); using (DataTable table = DBHelper.GetDataTableProc(sql)) { foreach (DataRow row in table.Rows) { Car_Type cartype = new Car_Type(); cartype.TypeId = (int)row["TypeId"]; cartype.Genre = (string)row["Genre"]; list.Add(cartype); } return(list); } }
public Car_Type GetAllCarsById(int Id) { string sql = "usp_SelcectCarsTypeById"; SqlDataReader reader = DBHelper.ExecuteReaderProc(sql, new SqlParameter("@Id", Id)); if (reader.Read()) { Car_Type car = new Car_Type(); car.TypeId = (int)reader["TypeId"]; car.Genre = (string)reader["Genre"]; reader.Close(); return(car); } else { reader.Close(); return(null); } }
protected void ddlCarMark_SelectedIndexChanged(object sender, EventArgs e) { string name = "0"; name = Request.QueryString["DR_name"]; int id = Convert.ToInt32(ddlCarMark.SelectedValue); if (id != 0) { Car_Cars car = CarsManager.GetAllCarsById(id); Car_Type cartype = (Car_Type)CarTypeManager.GetAllCarsById(car.Typeid.TypeId); rblDR_CarType.SelectedValue = cartype.Genre; if (name == "Up") { rblDR_CarType.Enabled = false; } } else { rblDR_CarType.SelectedValue = "普通用车"; } }
/// <summary> /// 删除车型信息 /// </summary> /// <param name="Type">要删除的车型实体</param> /// <returns></returns> public bool DeleteType(int TypeID) { Car_Type typ = DB_Type.Select(P => P.Type_ID == TypeID).Single(); return(DB_Type.Delete(typ)); }
/// <summary> /// 新增车型信息 /// </summary> /// <param name="Type">要增加的车型实体</param> /// <returns></returns> public bool AddType(Car_Type Type) { return(DB_Type.Insert(Type)); }