public void BindGrid(string id) { Demo.BLL.tb_JC_Employee bll = new Demo.BLL.tb_JC_Employee(); Demo.Model.tb_JC_Employee model = new Demo.Model.tb_JC_Employee(); model = bll.GetModel(id); employeeno.Text = model.EmployeeName.ToString(); employeename.Text = model.EmployeeName.ToString(); emid.Text = model.ID.ToString(); DropDownList2.SelectedValue = model.PositionNO.ToString(); DropDownList1.SelectedValue = model.DepartmentNO.ToString(); sex.SelectedValue = model.Sex.ToString(); age.Text = model.Age.ToString(); email.Text = model.Email.ToString(); phone.Text = model.MobileNumber.ToString(); entrydate.Text = model.EntryDate.ToString(); leavedate.Text = model.LeaveDate.ToString(); nation.Text = model.Nation.ToString(); nativeplace.Text = model.NativePlace.ToString(); politicalstatus.SelectedValue = model.PoliticalStatus.ToString(); Maritialstatus.SelectedValue = model.MaritialStatus.ToString(); // deptno.SelectedValue = deptbll.GetModelList("where DeptmentNo = "+ model.DepartmentNO)[0].DepartmentName; }
protected void btnSaveRefresh_Click(object sender, EventArgs e) { // 1. 这里放置保存窗体中数据的逻辑 Demo.BLL.tb_JC_Employee bll = new Demo.BLL.tb_JC_Employee(); Demo.Model.tb_JC_Employee model = new Demo.Model.tb_JC_Employee(); model.EmployeeNO = employeeno.Text.Trim(); model.EmployeeName = employeename.Text.Trim(); model.ID = Guid.NewGuid().ToString(); model.PositionNO = DropDownList2.SelectedValue; model.DepartmentNO = DropDownList1.SelectedValue; model.Sex = sex.SelectedText;; model.Age = Convert.ToInt16(age.Text.Trim()); model.Email = email.Text.Trim(); model.MobileNumber = phone.Text.Trim(); model.EntryDate = Convert.ToDateTime(entrydate.SelectedDate); model.LeaveDate = Convert.ToDateTime(leavedate.SelectedDate.HasValue ? entrydate.SelectedDate.Value.ToString("yyyy-MM-dd") : ""); model.Nation = nation.Text; model.NativePlace = nativeplace.Text; model.PoliticalStatus = politicalstatus.SelectedValue; model.MaritialStatus = Maritialstatus.SelectedValue; if (bll.Add(model)) { Alert.ShowInTop("添加成功"); } else { Alert.ShowInTop("添加失败"); } PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Demo.Model.tb_JC_Employee model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(Demo.Model.tb_JC_Employee model) { return(dal.Add(model)); }