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); }
private void InitCompontValue() { var result = new PeopleBLL().GetPeopleWorkInfoByPeopleID(this._currentPeopleID); if (result == null) { MessageBox.Show("工作信息不存在!"); return; } var webWorkInfo = result.Data; if (webWorkInfo.JoinCompanyDate.HasValue) { this.dtpJoinCompanyDate.Value = webWorkInfo.JoinCompanyDate.Value; } this.txtLengthOfService.Text = webWorkInfo.LengthOfService.ToString(); this.txtDepartment.Text = webWorkInfo.Department; this.txtTitle.Text = webWorkInfo.Title; if (webWorkInfo.TitleState == this.rbtnTitleAt.Text) { this.rbtnTitleAt.Checked = true; } else { this.rbtnTitleOut.Checked = true; } //this.dtpLeftCompanyDate.Value = webWorkInfo.LeftCompanyDate.Value; if (webWorkInfo.LeftCompanyDate.HasValue) { this.dtpLeftCompanyDate.Value = webWorkInfo.LeftCompanyDate.Value; this.dtpLeftCompanyDate.Checked = true; } else { this.dtpLeftCompanyDate.Checked = true; } this.txtLeftCompanyReason.Text = webWorkInfo.LeftCompanyReason; this.txtSpecialSkill.Text = webWorkInfo.SpecialSkill; this.txtWageCardNumber.Text = webWorkInfo.WageCardNumber; this.txtWageCardAddress.Text = webWorkInfo.WageCardAddress; if (webWorkInfo.IsCallInArchives) { this.rbtnCallIn.Checked = true; } else { this.rbtnNotCallIn.Checked = true; } this.txtArchivesNum.Text = webWorkInfo.ArchivesNum; //this.dtpArchiveCallOutDate.Value = webWorkInfo.ArchiveCallOutDate.Value; //this.dtpArchiveCallInDate.Value = webWorkInfo.ArchiveCallInDate.Value; if (webWorkInfo.ArchiveCallOutDate.HasValue) { this.dtpArchiveCallOutDate.Value = webWorkInfo.ArchiveCallOutDate.Value; this.dtpArchiveCallOutDate.Checked = true; } else { this.dtpArchiveCallOutDate.Checked = false; } if (webWorkInfo.ArchiveCallInDate.HasValue) { this.dtpArchiveCallInDate.Value = webWorkInfo.ArchiveCallInDate.Value; } }
private void btnSave_Click(object sender, EventArgs e) { if (this.ValidateChildren(ValidationConstraints.Enabled) == false) { return; } var webPeople = new WebPeopleBasicInfo() { WorkerNum = this.txtWorkerNum.Text, PeopleName = this.txtName.Text, Gender = this.rbtnMan.Checked ? this.rbtnMan.Text : this.rbtnWoman.Text, DateOfBirth = this.dtpDateOfBirth.Value.Date, IDCardNum = this.txtIDCardNum.Text, IsMarried = this.rbtnMarried.Checked, PoliticalStatus = this.cbxPoliticalStatus.Text, Nation = this.cbxNation.Text, HouseholdRegisterAddress = this.txtHouseholdRegisterAddress.Text, HouseholdRegisterType = this.rbtnPeasant.Checked ? this.rbtnPeasant.Text : this.rbtnNotPeasant.Text, HouseholdRegisterPostCode = this.txtHouseholdRegisterPostCode.Text, CurrentAddress = this.txtCurrentAddress.Text, PhoneNum = this.txtPhoneNum.Text, CurrentAddressPostCode = this.txtCurrentAddressPostCode.Text, EducationGrade = this.cbxEducationGrade.Text, GraduationSchool = this.txtGraduationSchool.Text, Profession = this.txtProfession.Text, EmergencyContactPerson = this.txtEmergencyContactPerson.Text, EmergencyContactPersonPhone = this.txtEmergencyContactPersonPhone.Text, EmergencyContactPersonRelation = this.txtEmergencyContactPersonRelation.Text, }; int age; if (int.TryParse(this.txtAge.Text, out age)) { webPeople.Age = age; } var result = new PeopleBLL().AddPeople(webPeople); if (result.Code > 0) { MessageBox.Show(result.Message, SystemInfo.ErrorReminderStr, MessageBoxButtons.OK); return; } else { MessageBox.Show(SystemInfo.SuccessReminderStr, SystemInfo.ReminderStr, MessageBoxButtons.OK); this.Dispose(); if (callbackEvent != null) { callbackEvent.Invoke(); } } }
private void InitCompontValue() { var result = new PeopleBLL().GetPeopleByID(_currentPeopleID); var peopleBaseInfo = result.Data; this.txtWorkerNum.Text = peopleBaseInfo.WorkerNum; this.txtName.Text = peopleBaseInfo.PeopleName; if (peopleBaseInfo.Gender == this.rbtnMan.Text) { this.rbtnMan.Checked = true; } else { this.rbtnWoman.Checked = true; } this.dtpDateOfBirth.Value = peopleBaseInfo.DateOfBirth.Value; this.txtAge.Text = peopleBaseInfo.Age.ToString(); this.txtIDCardNum.Text = peopleBaseInfo.IDCardNum; //this.rbtnMarried.Checked = peopleBaseInfo.IsMarried; if (peopleBaseInfo.IsMarried) { this.rbtnMarried.Checked = true; } else { this.rbtnNotMarried.Checked = true; } this.cbxPoliticalStatus.SelectedItem = peopleBaseInfo.PoliticalStatus; this.cbxNation.Text = peopleBaseInfo.Nation; this.txtHouseholdRegisterAddress.Text = peopleBaseInfo.HouseholdRegisterAddress; //this..Checked = peopleBaseInfo.HouseholdRegisterType == this.rbtnPeasant.Text; if (peopleBaseInfo.HouseholdRegisterType == this.rbtnPeasant.Text) { this.rbtnPeasant.Checked = true; } else { this.rbtnNotPeasant.Checked = true; } this.txtHouseholdRegisterPostCode.Text = peopleBaseInfo.HouseholdRegisterPostCode; this.txtCurrentAddress.Text = peopleBaseInfo.CurrentAddress; this.txtPhoneNum.Text = peopleBaseInfo.PhoneNum; this.txtCurrentAddressPostCode.Text = peopleBaseInfo.CurrentAddressPostCode; this.cbxEducationGrade.Text = peopleBaseInfo.EducationGrade; this.txtGraduationSchool.Text = peopleBaseInfo.GraduationSchool; this.txtProfession.Text = peopleBaseInfo.Profession; this.txtEmergencyContactPerson.Text = peopleBaseInfo.EmergencyContactPerson; this.txtEmergencyContactPersonPhone.Text = peopleBaseInfo.EmergencyContactPersonPhone; this.txtEmergencyContactPersonRelation.Text = peopleBaseInfo.EmergencyContactPersonRelation; }
private void btnSave_Click(object sender, EventArgs e) { if (this.ValidateChildren(ValidationConstraints.Enabled) == false) { return; } var webPeople = new WebPeopleBasicInfo() { PeopleID = this._currentPeopleID, WorkerNum = this.txtWorkerNum.Text, PeopleName = this.txtName.Text, Gender = this.rbtnMan.Checked ? this.rbtnMan.Text : this.rbtnWoman.Text, DateOfBirth = this.dtpDateOfBirth.Value, //Age = int.Parse(this.txtAge.Text), IDCardNum = this.txtIDCardNum.Text, IsMarried = this.rbtnMarried.Checked, PoliticalStatus = this.cbxPoliticalStatus.Text, Nation = this.cbxNation.Text, HouseholdRegisterAddress = this.txtHouseholdRegisterAddress.Text, HouseholdRegisterType = this.rbtnPeasant.Checked ? this.rbtnPeasant.Text : this.rbtnNotPeasant.Text, HouseholdRegisterPostCode = this.txtHouseholdRegisterPostCode.Text, CurrentAddress = this.txtCurrentAddress.Text, PhoneNum = this.txtPhoneNum.Text, CurrentAddressPostCode = this.txtCurrentAddressPostCode.Text, EducationGrade = this.cbxEducationGrade.Text, GraduationSchool = this.txtGraduationSchool.Text, Profession = this.txtProfession.Text, EmergencyContactPerson = this.txtEmergencyContactPerson.Text, EmergencyContactPersonPhone = this.txtEmergencyContactPersonPhone.Text, EmergencyContactPersonRelation = this.txtEmergencyContactPersonRelation.Text, }; int age; if (int.TryParse(this.txtAge.Text, out age)) { webPeople.Age = age; } var result = new PeopleBLL().UpdatePeople(webPeople); MessageHelper.ShowSaveDbResultMessage(result); }
private void dgvPeopleList_CellContentClick(object sender, DataGridViewCellEventArgs e) { int columnIndex = e.ColumnIndex; int rowIndex = e.RowIndex; //AddCode if (rowIndex == -1) { return; } //AddCode if (this.dgvPeopleList.Columns[columnIndex] == this.dgvPeopleList.Columns[_delColumnName]) { var dialogResult = MessageBox.Show("确定要删除吗?", SystemInfo.ReminderStr, MessageBoxButtons.OKCancel); if (dialogResult == DialogResult.OK) { var peopleID = (int)dgvPeopleList.Rows[rowIndex].Cells["PeopleID"].Value; var result = new PeopleBLL().DeletePeople(peopleID); if (result.Code > 0) { MessageBox.Show(result.Message, SystemInfo.ErrorReminderStr, MessageBoxButtons.OK); } else { BindListView(10, this._currentPage); } } } else if (this.dgvPeopleList.Columns[columnIndex] == this.dgvPeopleList.Columns[_editColumName]) { var peopleID = (int)dgvPeopleList.Rows[rowIndex].Cells["PeopleID"].Value; //var workInfoForm = new WorkerInfoForm(_peopleID); //workInfoForm.callbackEvent += delegate { // BindListView(pageIndex: int.Parse(this.cbxPageIndex.Text)); //}; //workInfoForm.Show(); var peopleMgmtForm = new PeopleInfoMgmtForm(peopleID); peopleMgmtForm.Callback = delegate { BindListView(pageIndex: int.Parse(this.cbxPageIndex.Text)); }; peopleMgmtForm.ShowDialog(); } }