private void ShowInfo(int _id) { BLL.car_use_recordbll bll = new BLL.car_use_recordbll(); Model.car_use_recordinfo model = bll.GetModel(_id); txtCode.Text = model.Code; txtUse_Time.Text = model.Use_Time; ddlDept_Code.SelectedValue = model.Department.Dept_Code; ddlUser_Code.SelectedValue = model.User.user_name; ddlCar_Number.SelectedValue = model.Car.Car_Number; ddlDriver_Code.SelectedValue = model.Driver.Driver_Code; txtStart_Address.Text = model.Start_Address; txtMileage_First.Text = model.Mileage_First.ToString(); txtUser_Number.Text = model.User_Number.ToString(); txtUContent.Text = model.UContent; txtEnd_Address.Text = model.End_Address; txtReturn_Time.Text = model.Return_Time; txtConnecter.Text = model.Connecter; txtTel.Text = model.Tel; if (model.OnCity == 1) { Range1.Checked = true; Range2.Checked = false; } else if (model.OnCity == 0) { Range1.Checked = false; Range2.Checked = true; } }
private bool DoEdit(int _id) { bool result = true; BLL.car_use_recordbll bll = new BLL.car_use_recordbll(); Model.car_use_recordinfo model = bll.GetModel(_id); model.Code = txtCode.Text.Trim(); model.Use_Time = txtUse_Time.Text.Trim(); model.Department.Dept_Code = ddlDept_Code.SelectedValue; model.User.user_name = ddlUser_Code.SelectedValue; model.Car.Car_Number = ddlCar_Number.SelectedValue; model.Driver.Driver_Code = ddlDriver_Code.SelectedValue; model.Start_Address = txtStart_Address.Text.Trim(); string s = txtMileage_First.Text.Trim(); model.Mileage_First = Convert.ToInt32(s == "" ? "0" : s); s = txtUser_Number.Text.Trim(); model.User_Number = Convert.ToInt32(s == "" ? "0" : s); model.UContent = txtUContent.Text.Trim(); model.End_Address = txtEnd_Address.Text.Trim(); model.Return_Time = txtReturn_Time.Text.Trim(); model.Connecter = txtConnecter.Text.Trim(); model.Tel = txtTel.Text.Trim(); if (Range1.Checked) { model.OnCity = 1; } else if (Range2.Checked) { model.OnCity = 0; } if (!bll.Update(model)) { result = false; } return(result); }