private void btnSave_Click(object sender, EventArgs e) { var webWorkInfo = new WebPeopleWorkInfo(); webWorkInfo.PeopleID = this._currentPeopleID; webWorkInfo.JoinCompanyDate = this.dtpJoinCompanyDate.Value; float lengthOfService; if (float.TryParse(this.txtLengthOfService.Text, out lengthOfService)) { webWorkInfo.LengthOfService = lengthOfService; } webWorkInfo.Department = this.txtDepartment.Text; webWorkInfo.Title = this.txtTitle.Text; webWorkInfo.TitleState = this.rbtnTitleAt.Checked ? this.rbtnTitleAt.Text : this.rbtnTitleOut.Text; if (this.dtpLeftCompanyDate.Checked) { webWorkInfo.LeftCompanyDate = this.dtpLeftCompanyDate.Value; } webWorkInfo.LeftCompanyReason = this.txtLeftCompanyReason.Text; webWorkInfo.SpecialSkill = this.txtSpecialSkill.Text; webWorkInfo.WageCardNumber = this.txtWageCardNumber.Text; webWorkInfo.WageCardAddress = this.txtWageCardAddress.Text; webWorkInfo.IsCallInArchives = this.rbtnCallIn.Checked; webWorkInfo.ArchivesNum = this.txtArchivesNum.Text; if (this.dtpArchiveCallOutDate.Checked) { webWorkInfo.ArchiveCallOutDate = this.dtpArchiveCallOutDate.Value; } webWorkInfo.ArchiveCallInDate = this.dtpArchiveCallInDate.Value; var result = new PeopleBLL().UpdatePeopleWorkInfo(webWorkInfo); MessageHelper.ShowSaveDbResultMessage(result); }
public CResult<bool> UpdatePeopleWorkInfo(WebPeopleWorkInfo webPeopleWorkInfo) { var people = new PeopleBasicInfo() { PeopleID = webPeopleWorkInfo.PeopleID, JoinCompanyDate = webPeopleWorkInfo.JoinCompanyDate, LengthOfService = webPeopleWorkInfo.LengthOfService, Department = webPeopleWorkInfo.Department, Title = webPeopleWorkInfo.Title, TitleState = webPeopleWorkInfo.TitleState, LeftCompanyDate = webPeopleWorkInfo.LeftCompanyDate, LeftCompanyReason = webPeopleWorkInfo.LeftCompanyReason, SpecialSkill = webPeopleWorkInfo.SpecialSkill, WageCardNumber = webPeopleWorkInfo.WageCardNumber, WageCardAddress = webPeopleWorkInfo.WageCardAddress, IsCallInArchives = webPeopleWorkInfo.IsCallInArchives, ArchivesNum = webPeopleWorkInfo.ArchivesNum, ArchiveCallInDate = webPeopleWorkInfo.ArchiveCallInDate, ArchiveCallOutDate = webPeopleWorkInfo.ArchiveCallOutDate, }; var result = new PeopleDAL().UpdatePeopleWorkInfo(people); if (result) { return new CResult<bool>(true); } else { return new CResult<bool>(false, ErrorCode.SaveDataFailed); } }
public CResult<WebPeopleWorkInfo> GetPeopleWorkInfoByPeopleID(int peopleID) { if (peopleID <= 0) { return new CResult<WebPeopleWorkInfo>(null, ErrorCode.ParameterError); } var domainModel = new PeopleDAL().GetPeopleWorkInfoByID(peopleID); if (domainModel == null) { return new CResult<WebPeopleWorkInfo>(null, ErrorCode.PeopleNotExist); } else { var result = new WebPeopleWorkInfo() { PeopleID = domainModel.PeopleID, JoinCompanyDate = domainModel.JoinCompanyDate, LengthOfService = domainModel.LengthOfService, Department = domainModel.Department, Title = domainModel.Title, TitleState = domainModel.TitleState, LeftCompanyDate = domainModel.LeftCompanyDate, LeftCompanyReason = domainModel.LeftCompanyReason, SpecialSkill = domainModel.SpecialSkill, WageCardNumber = domainModel.WageCardNumber, WageCardAddress = domainModel.WageCardAddress, IsCallInArchives = domainModel.IsCallInArchives, ArchivesNum = domainModel.ArchivesNum, ArchiveCallInDate = domainModel.ArchiveCallInDate, ArchiveCallOutDate = domainModel.ArchiveCallOutDate, }; return new CResult<WebPeopleWorkInfo>(result); } }