protected void btnSave_Click(object sender, EventArgs e) { Owen.BLL.BLL_Employees bllEmployees = new Owen.BLL.BLL_Employees(); Owen.Model.Model_Employees entity = bllEmployees.GetEntity(employeesId); if (entity == null) entity = new Owen.Model.Model_Employees(); entity.DistributorID = distributorID; entity.Memo = txtMemo.Text.Trim(); entity.EmployeesName = txtEmployeesName.Text.Trim(); entity.Mobile = txtMobile.Text.Trim(); entity.NativePlace = txtNativePlace.Text.Trim(); entity.Address = txtAddress.Text.Trim(); entity.Sex = int.Parse(ddlSex.SelectedValue); entity.Status = int.Parse(ddlStatus.SelectedValue); switch (action) { case "add": new Owen.BLL.BLL_Employees().AddEntity(entity); JSHelper.Alert(this, "保存成功!", "EmployeesList.aspx"); break; case "edit": entity.EmployeesID = employeesId; new Owen.BLL.BLL_Employees().UpdateEntity(entity); JSHelper.Alert(this, "保存成功!", "EmployeesList.aspx"); break; } }
protected void Page_Load(object sender, EventArgs e) { Owen.Model.Model_UserInfo userInfo = null; //先判断是不是经销商员工 userInfo = new Owen.BLL.BLL_UserInfo().IsRoles((int)Owen.Common.RolesValue.Employees); //不是经销商员工 if (userInfo == null) { //再判断是不是经销商管理员 userInfo = new Owen.BLL.BLL_UserInfo().IsRoles((int)Owen.Common.RolesValue.Distributor); if (userInfo == null) { Owen.Common.JSHelper.Alert(this, "对不起,您没有权限创建/修改病历!", "../Center.aspx"); return; } Owen.Model.Model_Distributor mDistributor = new Owen.BLL.BLL_Distributor().GetEntity(string.Format(" Mobile = '{0}' ", userInfo.UserName)); if (mDistributor == null) { Owen.Common.JSHelper.Alert(this, "对不起,经销商信息不存在!", "../Center.aspx"); return; } distributorID = mDistributor.DistributorID; } else { Owen.Model.Model_Employees mEmployess = new Owen.BLL.BLL_Employees().GetEntity(string.Format(" Mobile = '{0}' ", userInfo.UserName)); if (mEmployess == null) { Owen.Common.JSHelper.Alert(this, "对不起,经销商员工信息不存在!", "../Center.aspx"); return; } employessID = mEmployess.EmployeesID; distributorID = mEmployess.DistributorID; } medicalId = Owen.Common.Utils.GetQueryInt("medicalId"); action = Owen.Common.Utils.GetQueryString("action"); if (action.Equals("add")) btnSave.Text = "立即创建"; if (action.Equals("edit")) btnSave.Text = "保存"; if (!Page.IsPostBack) { BindHospital(distributorID); OnStart(sender, e); } }
/// <summary> /// 初始加载 /// </summary> private void OnStart(object sender, EventArgs e) { Owen.Model.Model_Employees model = new Owen.BLL.BLL_Employees().GetEntity(employeesId); if (model == null) return; txtEmployeesName.Text = model.EmployeesName; txtMobile.Text = model.Mobile; txtNativePlace.Text = model.NativePlace; txtMemo.Text = model.Memo; ddlSex.SelectedValue = model.Sex.ToString(); ddlStatus.SelectedValue = model.Status.ToString(); txtAddress.Text = model.Address; }