protected override void ItemShowing() { Staff staff = UpdatingItem as Staff; txtName.Text = staff.Name; txtCertificate.Text = staff.Certificate; if (staff.Department != null) { departmentComboBox1.DepartmentID = staff.Department.ID; } txtCardID.Text = !string.IsNullOrEmpty(staff.CardID) ? staff.CardID : string.Empty; txtPassword.Text = !string.IsNullOrEmpty(staff.Password) ? staff.Password : string.Empty; txtUserPosition.Text = staff.UserPosition; rdMale.Checked = staff.Sex == "男"; rdFemale.Checked = staff.Sex == "女"; dtHireDate.Value = staff.HireDate; rdUnResign.Checked = !staff.Resigned; rdResign.Checked = staff.Resigned; chkIsAdmin.Checked = (staff.IsAdmin != null && staff.IsAdmin.Value); verifyCodeComboBox1.SelectedVerifyCode = staff.VerifyCode; StaffPhoto sp = (new StaffBLL(AppSettings.CurrentSetting.ConnectUri)).GetPhoto(staff.ID).QueryObject; if (sp != null) { picPhoto.Image = sp.Photo; } _BioTemplates = (new StaffBLL(AppSettings.CurrentSetting.ConnectUri)).GetBioTemplates(staff.ID).QueryObjects; if (_BioTemplates != null && _BioTemplates.Count > 0) { templateGrid.Rows.Clear(); foreach (StaffBioTemplate sbt in _BioTemplates) { AddTemplateToGrid(sbt); } } }
public CommandResult SavePhoto(int staffID, string path) { StaffPhoto sp = new StaffPhoto(staffID, path); return(ProviderFactory.Create <IStaffPhotoProvider>(_RepoUri).Insert(sp)); }