private bool CopyFields() { ClassForForm.CheckFilled(tbLastName.Text, "Фамилия"); ClassForForm.CheckFilled(tbFirstName.Text, "Имя"); ClassForForm.CheckFilled(tbSecondName.Text, "Отчество"); string lastName, firstName, secondName; lastName = _person.LastName; firstName = _person.FirstName; secondName = _person.SecondName; _person.LastName = tbLastName.Text; _person.FirstName = tbFirstName.Text; _person.SecondName = tbSecondName.Text; if (_person.CheckNamesake()) { if (MessageBox.Show("В данной организации уже есть сотрудник с такими ФИО. Продолжить сохранение?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.No) { _person.LastName = lastName; _person.FirstName = firstName; _person.SecondName = secondName; return(false); } } _person.Appeal = cbAppeal.SelectedIndex; Position position = _person.Position; _person.Position = _positionList.GetItem(Convert.ToInt32(cbPosition.SelectedValue)) as Position; if (_person.IsOrganizationHaveUnique()) { MessageBox.Show("В данной организации уже есть сотрудник с такой должностью.\nИсправьте пожалуйста.", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Warning); _person.Position = position; return(false); } _person.MainSpecPerson = _mainSpecPersonList.GetItem(Convert.ToInt32(cbMainSpecPerson.SelectedValue)) as MainSpecPerson; _person.AcademTitle = _academTitleList.GetItem(Convert.ToInt32(cbAcademTitle.SelectedValue)) as AcademTitle; _person.Email = tbEmail.Text; _person.Mobile = mtbMobile.Text; _person.Phone = tbPhone.Text; _person.Comment = tbComment.Text; return(true); }
private bool CopyFields() { ClassForForm.CheckFilled(tbName.Text, "Официальное название"); ClassForForm.CheckFilled(tbShortName.Text, "Сокращенное название"); ClassForForm.CheckFilled(tbStreet.Text, "Уличный адрес"); if (tbINN.Text != string.Empty) { ClassForForm.CheckINN(_organization, tbINN.Text); } _organization.Name = tbName.Text; _organization.ShortName = tbShortName.Text; _organization.INN = tbINN.Text; _organization.KPP = tbKPP.Text; _organization.PostIndex = tbPostIndex.Text; _organization.Email = tbEmail.Text; _organization.Website = tbWebSite.Text; _organization.Phone = tbPhone.Text; _organization.City = tbCity.Text; _organization.Street = tbStreet.Text; if (_organization.TypeOrg == TypeOrg.Аптека) { if (rbA.Checked) { _organization.Pharmacy = "A"; } else if (rbB.Checked) { _organization.Pharmacy = "B"; } else if (rbC.Checked) { _organization.Pharmacy = "C"; } } else { _organization.Pharmacy = string.Empty; } return(true); }
private void CopyFields() { if (cbMainSpec.Visible) { int idMainSpec = Convert.ToInt32(cbMainSpec.SelectedValue); _organization.MainSpec = _mainSpecList.GetItem(idMainSpec) as MainSpec; } ClassForForm.CheckFilled(tbName.Text, "Официальное название"); ClassForForm.CheckFilled(tbShortName.Text, "Сокращенное название"); CheckNameAdmin(tbName.Text); CheckNameAdmin(tbShortName.Text); _organization.Name = tbName.Text; _organization.ShortName = tbShortName.Text; _organization.Email = tbEmail.Text; _organization.Website = tbWebSite.Text; _organization.Phone = tbPhone.Text; if (_organization.TypeOrg == TypeOrg.Отделение) { _organization.MachineGD = tbMachineGD.Text; _organization.MachineGDF = tbMachineGDF.Text; _organization.MachineCRRT = tbMachineCRRT.Text; _organization.Shift = tbShift.Text; _organization.PatientGD = tbPatientGD.Text; _organization.PatientPD = tbPatientPD.Text; _organization.PatientCRRT = tbPatientCRRT.Text; } else { _organization.MachineGD = string.Empty; _organization.MachineGDF = string.Empty; _organization.MachineCRRT = string.Empty; _organization.Shift = string.Empty; _organization.PatientGD = string.Empty; _organization.PatientPD = string.Empty; _organization.PatientCRRT = string.Empty; } }
private bool CopyFields() { int idTypeLPU = Convert.ToInt32(cbTypeLpu.SelectedValue); _lpu.TypeLPU = _typeLPUList.GetItem(idTypeLPU) as TypeLPU; int idOwnership = Convert.ToInt32(cbOwnership.SelectedValue); _lpu.Ownership = _ownershipList.GetItem(idOwnership) as Ownership; int idAdmLevel = Convert.ToInt32(cbAdmLevel.SelectedValue); _lpu.AdmLevel = _admLevelList.GetItem(idAdmLevel) as AdmLevel; int idMainSpec = Convert.ToInt32(cbMainSpec.SelectedValue); _lpu.MainSpec = _mainSpecList.GetItem(idMainSpec) as MainSpec; int idTypeFin = Convert.ToInt32(cbTypeFin.SelectedValue); _lpu.TypeFin = _typeFinList.GetItem(idTypeFin) as TypeFin; /* * int idSubRegion = Convert.ToInt32(cbSubRegion.SelectedValue); * _lpu.SubRegion = _subRegionList.GetItem(idSubRegion) as SubRegion; */ ClassForForm.CheckFilled(tbName.Text, "Официальное название"); ClassForForm.CheckFilled(tbShortName.Text, "Сокращенное название"); ClassForForm.CheckFilled(tbINN.Text, "ИНН"); if (_parentLPU != null) { ClassForForm.CheckFilled(tbKPP.Text, "КПП"); } ClassForForm.CheckFilled(tbStreet.Text, "Уличный адрес"); ClassForForm.CheckINN(_lpu, tbINN.Text); _lpu.Name = tbName.Text; _lpu.ShortName = tbShortName.Text; _lpu.City = tbCity.Text; _lpu.INN = (_parentLPU == null) ? tbINN.Text : string.Empty; _lpu.KPP = tbKPP.Text; _lpu.PostIndex = tbPostIndex.Text; string email = _lpu.Email; _lpu.Email = tbEmail.Text; if (!ClassForForm.IsEmail(tbEmail.Text)) { MessageBox.Show("Ошибка в электронном адресе. Пожалуйста, исправьте.", "Ошибка ввода", MessageBoxButtons.OK, MessageBoxIcon.Warning); _lpu.Email = email; return(false); } string website = _lpu.Website; _lpu.Website = tbWebSite.Text; if (!ClassForForm.IsWebSite(tbWebSite.Text)) { MessageBox.Show("Ошибка в адресе веб-сайта. Пожалуйста, исправьте.", "Ошибка ввода", MessageBoxButtons.OK, MessageBoxIcon.Warning); _lpu.Website = website; return(false); } _lpu.Phone = tbPhone.Text; _lpu.Street = tbStreet.Text; string bedsTotal, bedsIC, bedsSurgical; bedsTotal = _lpu.BedsTotal; bedsIC = _lpu.BedsIC; bedsSurgical = _lpu.BedsSurgical; _lpu.BedsTotal = tbBedsTotal.Text; _lpu.BedsIC = tbBedsIC.Text; _lpu.BedsSurgical = tbBedsSurgical.Text; if (_lpu.IsTotalLessThenSum()) { MessageBox.Show("Общее количество коек меньше, чем сумма реанимационных и хирургических коек.\nПожалуйста, исправьте.", "Ошибка ввода", MessageBoxButtons.OK, MessageBoxIcon.Warning); _lpu.BedsTotal = bedsTotal; _lpu.BedsIC = bedsIC; _lpu.BedsSurgical = bedsSurgical; return(false); } _lpu.Operating = tbOperating.Text; if (_lpu.IsHaveDepartment()) { _lpu.MachineGD = string.Empty; _lpu.MachineGDF = string.Empty; _lpu.MachineCRRT = string.Empty; _lpu.Shift = string.Empty; _lpu.PatientGD = string.Empty; _lpu.PatientPD = string.Empty; _lpu.PatientCRRT = string.Empty; } else { _lpu.MachineGD = tbMachineGD.Text; _lpu.MachineGDF = tbMachineGDF.Text; _lpu.MachineCRRT = tbMachineCRRT.Text; _lpu.Shift = tbShift.Text; _lpu.PatientGD = tbPatientGD.Text; _lpu.PatientPD = tbPatientPD.Text; _lpu.PatientCRRT = tbPatientCRRT.Text; } if (cbLpuRR.Enabled) { int idLpuRR; int.TryParse(cbLpuRR.SelectedValue.ToString(), out idLpuRR); LpuRR lpuRR = _lpuRRList.GetItem(idLpuRR) as LpuRR; if (lpuRR != null) { _lpu.LpuRR = lpuRR; } } if (cbLpuRR2.Enabled) { int idLpuRR2; int.TryParse(cbLpuRR2.SelectedValue.ToString(), out idLpuRR2); LpuRR lpuRR2 = _lpuRRList.GetItem(idLpuRR2) as LpuRR; if (lpuRR2 != null) { _lpu.LpuRR2 = lpuRR2; } } return(true); }