private void LoadDataFromServer() { string message = string.Empty; try { MmedicalInstitutionPermit = PharmacyDatabaseService.GetMmedicalInstitutionPermit(entity.Id, out message).FirstOrDefault(); if (MmedicalInstitutionPermit == null) { MmedicalInstitutionPermit = new MmedicalInstitutionPermit(); MmedicalInstitutionPermit.Id = Guid.Empty; MmedicalInstitutionPermit.IssuanceDate = DateTime.Now; MmedicalInstitutionPermit.OutDate = DateTime.Now.AddYears(1); MmedicalInstitutionPermit.StartDate = DateTime.Now; this.dateTimePickerOutDate.Value = DateTime.Now.AddYears(1); MmedicalInstitutionPermit.UnitName = unitName; MmedicalInstitutionPermit.RegAddress = Address; MmedicalInstitutionPermit.LegalPerson = Legalperson; MmedicalInstitutionPermit.WarehouseAddress = WareHouseAddress; } } catch (Exception ex) { MessageBox.Show("证书信息不存在或已被删除!", "警告!"); } }
public FormMmedicalInstitutionPermit(MmedicalInstitutionPermit value, string name, string address, string legalperson, string wareHouseAddress) { InitializeComponent(); if (value == null) { value = new MmedicalInstitutionPermit(); } else { this.entity = value; } this.unitName = name; this.Address = address; this.Legalperson = legalperson; WareHouseAddress = wareHouseAddress; }
private void GetResource(int i) { PurchaseUnitShow ps = this.dgvMain.CurrentRow.DataBoundItem as PurchaseUnitShow; PurchaseUnit pu = this._listPurchaseUnit.Where(r => r.Id == ps.Id).FirstOrDefault(); if (pu == null) { return; } switch (i) { case 0: FormMedicineBusinessLicense FormMedicineBusinessLicense = new FormMedicineBusinessLicense(pu.MedicineBusinessLicenseId, true); FormMedicineBusinessLicense.ShowDialog(); break; case 1: FormGMPLicense frm = new FormGMPLicense(pu.GMPLicenseId, string.Empty, string.Empty, true); frm.ShowDialog(); break; case 2: FormMedicineProductionLicense FormMedicineProductionLicense = new FormMedicineProductionLicense(pu.MedicineProductionLicenseId, true); SetControls.SetControlReadonly(FormMedicineProductionLicense, true); FormMedicineProductionLicense.ShowDialog(); break; case 3: FormBusinessLicense FormBusinessLicense = new FormBusinessLicense(pu.BusinessLicenseId, string.Empty, string.Empty); SetControls.SetControlReadonly(FormBusinessLicense, true); FormBusinessLicense.ShowDialog(); break; case 4: FormInstrumentsProductionLicense FormInstrumentsProductionLicense = new FormInstrumentsProductionLicense(pu.InstrumentsProductionLicenseId, string.Empty, string.Empty, string.Empty); SetControls.SetControlReadonly(FormInstrumentsProductionLicense, true); FormInstrumentsProductionLicense.ShowDialog(); break; case 5: FormInstrumentsBusinessLicense FormInstrumentsBusinessLicense = new FormInstrumentsBusinessLicense(pu.InstrumentsBusinessLicenseId, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty); SetControls.SetControlReadonly(FormInstrumentsBusinessLicense, true); FormInstrumentsBusinessLicense.ShowDialog(); break; case 6: FormOrganizationCodeLicense FormOrganizationCodeLicense = new FormOrganizationCodeLicense(pu.OrganizationCodeLicenseId, string.Empty, string.Empty); SetControls.SetControlReadonly(FormOrganizationCodeLicense, true); FormOrganizationCodeLicense.ShowDialog(); break; case 7: FormHealthLicense FormHealthLicense = new FormHealthLicense(pu.HealthLicenseId, string.Empty, string.Empty, string.Empty); SetControls.SetControlReadonly(FormHealthLicense, true); FormHealthLicense.ShowDialog(); break; case 8: LnstitutionLegalPersonLicense LegalPersonLicense = new LnstitutionLegalPersonLicense(); LegalPersonLicense.Id = pu.LnstitutionLegalPersonLicenseId; FormLegalPersonLicense FormLegalPersonLicense = new FormLegalPersonLicense(LegalPersonLicense, string.Empty, string.Empty, string.Empty); SetControls.SetControlReadonly(FormLegalPersonLicense, true); FormLegalPersonLicense.ShowDialog(); break; case 9: FormTaxRegisterLicense FormTaxRegisterLicense = new FormTaxRegisterLicense(pu.TaxRegisterLicenseId, string.Empty, string.Empty, string.Empty); SetControls.SetControlReadonly(FormTaxRegisterLicense, true); FormTaxRegisterLicense.ShowDialog(); break; case 10: FormFoodCirculateLicense FormFoodCirculateLicense = new FormFoodCirculateLicense(pu.FoodCirculateLicenseId, string.Empty, string.Empty, string.Empty); SetControls.SetControlReadonly(FormFoodCirculateLicense, true); FormFoodCirculateLicense.ShowDialog(); break; case 11: FormGSPLicense FormGSPLicense = new FormGSPLicense(pu.GSPLicenseId, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty); SetControls.SetControlReadonly(FormGSPLicense, true); FormGSPLicense.ShowDialog(); break; case 12: MmedicalInstitutionPermit InstitutionPermit = new MmedicalInstitutionPermit(); InstitutionPermit.Id = pu.MmedicalInstitutionPermitId; FormMmedicalInstitutionPermit FormMmedicalInstitutionPermit = new FormMmedicalInstitutionPermit(InstitutionPermit, string.Empty, string.Empty, string.Empty, string.Empty); SetControls.SetControlReadonly(FormMmedicalInstitutionPermit, true); FormMmedicalInstitutionPermit.ShowDialog(); break; } }
private void GetResource(int i) { bool2String b = this.dataGridView1.SelectedRows[0].DataBoundItem as bool2String; SupplyUnit su = _listSupplyUnit.Where(r => r.Id == b.id).FirstOrDefault(); switch (i) { case 0: FormMedicineBusinessLicense FormMedicineBusinessLicense = new FormMedicineBusinessLicense(su.MedicineBusinessLicenseId, true); SetControls.SetControlReadonly(FormMedicineBusinessLicense, true); FormMedicineBusinessLicense.ShowDialog(); break; case 1: FormGMPLicense FormGMPLiscense = new FormGMPLicense(su.GMPLicenseId, string.Empty, string.Empty, true); SetControls.SetControlReadonly(FormGMPLiscense, true); FormGMPLiscense.ShowDialog(); break; case 2: FormMedicineProductionLicense FormMedicineProductionLicense = new FormMedicineProductionLicense(su.MedicineProductionLicenseId, true); SetControls.SetControlReadonly(FormMedicineProductionLicense, true); FormMedicineProductionLicense.ShowDialog(); break; case 3: FormBusinessLicense FormBusinessLicense = new FormBusinessLicense(su.BusinessLicenseId, string.Empty, string.Empty); SetControls.SetControlReadonly(FormBusinessLicense, true); FormBusinessLicense.ShowDialog(); break; case 4: FormInstrumentsProductionLicense FormInstrumentsProductionLicense = new FormInstrumentsProductionLicense(su.InstrumentsProductionLicenseId, string.Empty, string.Empty, string.Empty); SetControls.SetControlReadonly(FormInstrumentsProductionLicense, true); FormInstrumentsProductionLicense.ShowDialog(); break; case 5: FormInstrumentsBusinessLicense FormInstrumentsBusinessLicense = new FormInstrumentsBusinessLicense(su.InstrumentsBusinessLicenseId, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty); SetControls.SetControlReadonly(FormInstrumentsBusinessLicense, true); FormInstrumentsBusinessLicense.ShowDialog(); break; case 6: FormOrganizationCodeLicense FormOrganizationCodeLicense = new FormOrganizationCodeLicense(su.OrganizationCodeLicenseId, string.Empty, string.Empty); SetControls.SetControlReadonly(FormOrganizationCodeLicense, true); FormOrganizationCodeLicense.ShowDialog(); break; case 7: FormHealthLicense FormHealthLicense = new FormHealthLicense(su.HealthLicenseId, string.Empty, string.Empty, string.Empty); SetControls.SetControlReadonly(FormHealthLicense, true); FormHealthLicense.ShowDialog(); break; case 8: LnstitutionLegalPersonLicense LegalPersonLicense = new LnstitutionLegalPersonLicense(); LegalPersonLicense.Id = su.LnstitutionLegalPersonLicenseId; FormLegalPersonLicense FormLegalPersonLicense = new FormLegalPersonLicense(LegalPersonLicense, string.Empty, string.Empty, string.Empty); SetControls.SetControlReadonly(FormLegalPersonLicense, true); FormLegalPersonLicense.ShowDialog(); break; case 9: FormTaxRegisterLicense FormTaxRegisterLicense = new FormTaxRegisterLicense(su.TaxRegisterLicenseId, string.Empty, string.Empty, string.Empty); SetControls.SetControlReadonly(FormTaxRegisterLicense, true); FormTaxRegisterLicense.ShowDialog(); break; case 10: FormFoodCirculateLicense FormFoodCirculateLicense = new FormFoodCirculateLicense(su.FoodCirculateLicenseId, string.Empty, string.Empty, string.Empty); SetControls.SetControlReadonly(FormFoodCirculateLicense, true); FormFoodCirculateLicense.ShowDialog(); break; case 11: FormGSPLicense FormGSPLicense = new FormGSPLicense(su.GSPLicenseId, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty); SetControls.SetControlReadonly(FormGSPLicense, true); FormGSPLicense.ShowDialog(); break; case 12: MmedicalInstitutionPermit InstitutionPermit = new MmedicalInstitutionPermit(); InstitutionPermit.Id = su.MmedicalInstitutionPermitId; FormMmedicalInstitutionPermit FormMmedicalInstitutionPermit = new FormMmedicalInstitutionPermit(InstitutionPermit, string.Empty, string.Empty, string.Empty, string.Empty); SetControls.SetControlReadonly(FormMmedicalInstitutionPermit, true); FormMmedicalInstitutionPermit.ShowDialog(); break; } }
private void buttonLicense_Click(object sender, EventArgs e) { if (!ValidateControls(out msg)) { MessageBox.Show("请先填写必要的企业信息,如单位名称,法人,收货地址等!"); return; } Button btnLicense = sender as Button; string legalPerson = txtLegalPerson.Text.Trim(); string name = txtName.Text.Trim(); string address = txtBoxCompanyAddress.Text.Trim(); string qualityCharger = txtBoxQualityCharger.Text.Trim(); string wareHouseAddress = txtReceiveAddress.Text.Trim(); Guid LicenseId = btnLicense.Tag == null ? Guid.Empty : (Guid)btnLicense.Tag; switch (btnLicense.Text) { case "分类控制中心": LicenseId = PurchaseUnit == null ? Guid.Empty : PurchaseUnit.GSPLicenseId; FormGSPLicense frm = new FormGSPLicense(LicenseId, legalPerson, qualityCharger, name, address, wareHouseAddress); SetControls.SetControlReadonly(frm, !this._isEditable); if (frm.ShowDialog() == DialogResult.OK) { btnLicense.Tag = frm._gspLiscenceId; btnLicense.BackColor = Color.LightBlue; } break; case "三证信息": FormBusinessLicense FormBusinessLicense = new FormBusinessLicense(LicenseId, name, address); SetControls.SetControlReadonly(FormBusinessLicense, !this._isEditable); if (FormBusinessLicense.ShowDialog() == DialogResult.OK) { btnLicense.Tag = FormBusinessLicense.BusinessLicense.Id; } break; case "器械生产许可证": FormInstrumentsProductionLicense FormInstrumentsProductionLicense = new FormInstrumentsProductionLicense(LicenseId, legalPerson, address, name); SetControls.SetControlReadonly(FormInstrumentsProductionLicense, !this._isEditable); if (FormInstrumentsProductionLicense.ShowDialog() == DialogResult.OK) { btnLicense.Tag = FormInstrumentsProductionLicense.InstrumentsProductionLicense.Id; } break; case "器械经营许可证": FormInstrumentsBusinessLicense FormInstrumentsBusinessLicense = new FormInstrumentsBusinessLicense(LicenseId, legalPerson, qualityCharger, name, address, wareHouseAddress); SetControls.SetControlReadonly(FormInstrumentsBusinessLicense, !this._isEditable); if (FormInstrumentsBusinessLicense.ShowDialog() == DialogResult.OK) { btnLicense.Tag = FormInstrumentsBusinessLicense.InstrumentsBusinessLicense.Id; } break; case "医疗机构执业许可证": MmedicalInstitutionPermit InstitutionPermit = new MmedicalInstitutionPermit(); InstitutionPermit.Id = LicenseId; FormMmedicalInstitutionPermit FormMmedicalInstitutionPermit = new FormMmedicalInstitutionPermit(InstitutionPermit, name, address, legalPerson, wareHouseAddress); SetControls.SetControlReadonly(FormMmedicalInstitutionPermit, !this._isEditable); if (FormMmedicalInstitutionPermit.ShowDialog() == DialogResult.OK) { btnLicense.Tag = FormMmedicalInstitutionPermit.MmedicalInstitutionPermit.Id; } break; } if (!(btnLicense.Tag == null)) { if (!btnLicense.Tag.Equals(Guid.Empty))// ||!btnLicense.Tag.Equals(Guid.Empty) { btnLicense.BackColor = Color.LightBlue; } else { btnLicense.BackColor = Color.LightGray; } } }
/// <summary> /// InitPurchaseUnit /// </summary> /// <param name="purchaseUnit"></param> /// <returns></returns> public PurchaseUnit InitPurchaseUnit(PurchaseUnit purchaseUnit) { string msg = String.Empty; DateTime mindate = DateTime.Now.AddYears(10); _outDateList.Clear(); if (!ValidateControls(out msg)) { MessageBox.Show(msg); return(null); } PurchaseUnit sUnit = purchaseUnit; if (cmbApprovelFlow.SelectedValue == null) { FlowTypeID = Guid.Empty; } else { FlowTypeID = (Guid)cmbApprovelFlow.SelectedValue; } if (sUnit == null) { sUnit = new PurchaseUnit(); sUnit.Id = Guid.NewGuid(); sUnit.CreateTime = DateTime.Now; sUnit.CreateUserId = AppClientContext.CurrentUser.Id; sUnit.FlowID = Guid.NewGuid(); } if (this.cmbUnitType.SelectedValue != null) { sUnit.UnitTypeId = Guid.Parse(this.cmbUnitType.SelectedValue.ToString()); } else { sUnit.UnitTypeId = Guid.Empty; } sUnit.Code = txtCode.Text.Trim(); sUnit.ContactName = txtContactName.Text.Trim(); sUnit.ContactTel = txtContactTel.Text.Trim(); sUnit.Description = rtbDesc.Text.Trim(); sUnit.Email = txtEmail.Text.Trim(); sUnit.Enabled = ckEnable.Checked; sUnit.Fax = txtFax.Text.Trim(); sUnit.LegalPerson = txtLegalPerson.Text.Trim(); sUnit.Name = txtName.Text.Trim(); sUnit.PinyinCode = txtPinyinCode.Text; sUnit.WebAddress = txtWebAddress.Text.Trim(); sUnit.ReceiveAddress = txtReceiveAddress.Text.Trim(); sUnit.UpdateTime = DateTime.Now; sUnit.UpdateUserId = AppClientContext.CurrentUser.Id; sUnit.DistrictId = Guid.Parse(cmbDistrict.SelectedValue.ToString()); sUnit.DetailedAddress = txtBoxCompanyAddress.Text.Trim(); sUnit.DocNumber = txtDocNumber.Text.Trim(); sUnit.QualityCharger = txtBoxQualityCharger.Text.Trim(); if (((Guid)buttonMedicineBusinessLicense.Tag) == Guid.Empty) { MessageBox.Show("请打开分类控制中心,设定器械代码!"); return(null); } sUnit.GSPLicenseId = (Guid)buttonMedicineBusinessLicense.Tag; sUnit.GSPLicenseOutDate = DateTime.Now.Date.AddYears(50); //法人委托书数据 if (this.newDataGridviewer1.Rows.Count > 0) { List <DateTime> OutDateAttorneyAattorney = new List <DateTime>(); string strOutDate = DateTime.Now.Date.ToString("yyyyMMdd"); DateTime OutDate = DateTime.ParseExact(strOutDate, "yyyyMMdd", format); try { strAttorneyAattorney = string.Empty; foreach (DataGridViewRow item in this.newDataGridviewer1.Rows) { for (int i = 0; i < this.newDataGridviewer1.Columns.Count; i++) { if (item.Cells[i].Value != null) { strAttorneyAattorney += item.Cells[i].Value.ToString(); if (i != this.newDataGridviewer1.Columns.Count - 1) { strAttorneyAattorney += ","; } } else { MessageBox.Show("法人委托书有未填项,请检查!"); strAttorneyAattorney = null; return(null); } } strAttorneyAattorney = strAttorneyAattorney + "||"; { OutDate = DateTime.ParseExact(item.Cells["colEndTime"].Value.ToString(), "yyyyMMdd", format); OutDateAttorneyAattorney.Add(OutDate); } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); return(null); } sUnit.BusinessLicenseeOutDate = OutDateAttorneyAattorney.Max();//BusinessLicenseeOutDate表示法人委托书过期日 //if (OutDateAttorneyAattorney.Max() < DateTime.Now.Date) //{ // MessageBox.Show("法人委托书日期填写过期,请检查!"); // return null; //} if (strAttorneyAattorney == "") { MessageBox.Show("请输入法人委托书信息!"); return(null); } else { sUnit.AttorneyAattorneyDetail = strAttorneyAattorney; } } else { sUnit.BusinessLicenseeOutDate = DateTime.ParseExact(DateTime.Now.Date.ToString(), "yyyyMMdd", format); } //质量协议书数据 if (this.dataGridView1.Rows.Count > 0) { List <DateTime> OutDateQualityAgreement = new List <DateTime>(); string strOutDate = DateTime.Now.Date.ToString("yyyyMMdd"); DateTime OutDate = DateTime.ParseExact(strOutDate, "yyyyMMdd", format); strQualityAgreement = string.Empty; foreach (DataGridViewRow item in this.dataGridView1.Rows) { for (int i = 0; i < this.dataGridView1.Columns.Count; i++) { if (item.Cells[i].Value != null) { strQualityAgreement += item.Cells[i].Value.ToString(); if (i != this.dataGridView1.Columns.Count - 1) { strQualityAgreement += ","; } } else { MessageBox.Show("质量协议书有未填项,请检查!"); strQualityAgreement = null; return(null); } } strQualityAgreement = strQualityAgreement + "||"; { bool isDate = DateTime.TryParseExact(item.Cells["colOutDate"].Value.ToString(), "yyyyMMdd", null, System.Globalization.DateTimeStyles.None, out OutDate); OutDateQualityAgreement.Add(OutDate); } } //if (OutDateQualityAgreement.Max() < DateTime.Now.Date) //{ // MessageBox.Show("质量委托书填写过期!"); // return null; //} sUnit.QualityAgreementOutdate = OutDateQualityAgreement.Max(); sUnit.QualityAgreemenStartdate = DateTime.Now; sUnit.QualityAgreementFile = Guid.Empty; if (strQualityAgreement == "") { MessageBox.Show("请输入质量协议书信息!"); return(null); } else { sUnit.QualityAgreementDetail = strQualityAgreement; } } else { sUnit.QualityAgreementOutdate = DateTime.Now.Date; } _outDateList.Add(new OutDateDetail() { Content = "法人委托书", outDate = sUnit.BusinessLicenseeOutDate }); _outDateList.Add(new OutDateDetail() { Content = "质量协议书", outDate = sUnit.QualityAgreementOutdate }); string message; #region 营业执照 sUnit.BusinessLicenseId = this.buttonBusinessLicense.Tag == null ? Guid.Empty : (Guid)this.buttonBusinessLicense.Tag; if (sUnit.BusinessLicenseId != Guid.Empty) { try { sUnit.BusinessLicenseeOutDate = PharmacyDatabaseService.GetBusinessLicense(out message, sUnit.BusinessLicenseId) .OutDate; } catch (Exception ex) { MessageBox.Show("营业执照读取失败,请稍候提交或者打开该资质,并点击清空按钮!"); return(null); } _outDateList.Add(new OutDateDetail() { Content = "营业执照", outDate = sUnit.BusinessLicenseeOutDate }); } else { sUnit.BusinessLicenseeOutDate = DateTime.MaxValue.AddYears(-1); } #endregion #region 器械生产许可证 sUnit.InstrumentsProductionLicenseId = this.buttonInstrumentsProductionLicense.Tag == null || (Guid)this.buttonInstrumentsProductionLicense.Tag == Guid.Empty ? Guid.Empty : (Guid)this.buttonInstrumentsProductionLicense.Tag; if (sUnit.InstrumentsProductionLicenseId != Guid.Empty) { try { sUnit.InstrumentsProductionLicenseOutDate = PharmacyDatabaseService.GetInstrumentsProductionLicense(out message, sUnit.InstrumentsProductionLicenseId) .OutDate; } catch (Exception ex) { MessageBox.Show("器械生产许可证读取失败,请稍候提交或者打开该资质,并点击清空按钮!"); return(null); } _outDateList.Add(new OutDateDetail() { Content = "器械生产许可证", outDate = sUnit.InstrumentsProductionLicenseOutDate }); } else { sUnit.InstrumentsProductionLicenseOutDate = DateTime.MaxValue.AddYears(-1); } #endregion #region 器械经营许可证 sUnit.InstrumentsBusinessLicenseId = this.buttonInstrumentsBusinessLicense.Tag == null ? Guid.Empty : (Guid)this.buttonInstrumentsBusinessLicense.Tag; if (sUnit.InstrumentsBusinessLicenseId != Guid.Empty) { try { sUnit.InstrumentsBusinessLicenseOutDate = PharmacyDatabaseService.GetInstrumentsBusinessLicense(out message, sUnit.InstrumentsBusinessLicenseId) .OutDate; } catch (Exception ex) { MessageBox.Show("器械经营许可证读取失败,请稍候提交或者打开该资质,并点击清空按钮!"); return(null); } _outDateList.Add(new OutDateDetail() { Content = "器械经营许可证", outDate = sUnit.InstrumentsBusinessLicenseOutDate }); } else { sUnit.InstrumentsBusinessLicenseOutDate = DateTime.MaxValue.AddYears(-1); } #endregion #region 医疗机构执业许可证 sUnit.MmedicalInstitutionPermitId = this.buttonMedInst.Tag == null ? Guid.Empty : (Guid)this.buttonMedInst.Tag; if (sUnit.MmedicalInstitutionPermitId != Guid.Empty) { try { MmedicalInstitutionPermit MmedicalInstitutionPermit = new MmedicalInstitutionPermit(); MmedicalInstitutionPermit.Id = sUnit.MmedicalInstitutionPermitId; sUnit.MmedicalInstitutionPermitOutDate = PharmacyDatabaseService.GetMmedicalInstitutionPermit(MmedicalInstitutionPermit, out message).First().OutDate; _outDateList.Add(new OutDateDetail() { Content = "医疗执业许可证书", outDate = sUnit.MmedicalInstitutionPermitOutDate }); } catch (Exception ex) { MessageBox.Show("医疗执业许可证书读取失败,请稍候提交或者打开该资质,并点击清空按钮!"); return(null); } } else { sUnit.MmedicalInstitutionPermitOutDate = DateTime.MaxValue.AddYears(-1); } #endregion if (_outDateList.Count > 0) { DateTime dtime = _outDateList.Min(r => r.outDate); sUnit.OutDate = dtime; OutDateDetail od = _outDateList.Where(r => r.outDate < DateTime.Now).FirstOrDefault(); if (od != null) { var v = MessageBox.Show(od.Content + "过期,请检查,需要继续保存吗?", "提示", MessageBoxButtons.YesNo); if (v == DialogResult.No) { return(null); } } if (sUnit.OutDate > DateTime.Now) { sUnit.IsOutDate = false; } } else { sUnit.OutDate = DateTime.Now.Date; } return(sUnit); }