public bool EditGSPLiscence(GSPLicense m) { try { var c = this.Get(m.Id); foreach (var i in c.GMSPLicenseBusinessScopes) { this.BusinessHandlerFactory.GMSPLicenseBusinessScopeBusinessHandler.Delete(i.Id); } foreach (var i in m.GMSPLicenseBusinessScopes.ToList()) { GMSPLicenseBusinessScope bs = new GMSPLicenseBusinessScope { GSPLicenseId = i.GSPLicenseId, Id = Guid.NewGuid(), BusinessScopeCodeMemo = i.BusinessScopeCodeMemo, BusinessScopeCode = i.BusinessScopeCode }; this.RepositoryProvider.Db.GMSPLicenseBusinessScopes.Add(bs); } m.GMSPLicenseBusinessScopes = null; this.Save(m); this.Save(); return(true); } catch (Exception ex) { return(false); } }
/// <summary> /// 从服务器获取该Guid证书 /// </summary> /// <returns></returns> private bool LoadGSPLicense(bool showMessage = false) { try { string message; GSPLicense = PharmacyDatabaseService.GetGSPLicense(out message, gMSPLicenseId); if (GSPLicense != null) { EditMode = true; //this.buttonSave.Enabled = false; } else { EditMode = false; GSPLicense = new GSPLicense(); GSPLicense.Id = gMSPLicenseId; GSPLicense.StoreId = AppClientContext.Config.Store.Id; GSPLicense.IssuanceDate = DateTime.Now; GSPLicense.OutDate = DateTime.Now.AddYears(1);//edit by wfz GSPLicense.LegalPerson = LegalPerson; GSPLicense.QualityHeader = QualityCharger; GSPLicense.UnitName = Name; GSPLicense.Enabled = true; GSPLicense.RegAddress = Address; GSPLicense.WarehouseAddress = wareHouseAddress; GSPLicense.Header = LegalPerson; } return(true); } catch (Exception ex) { Log.Error(ex); if (showMessage) { //MessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Stop); MessageBox.Show(this.Text + ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Stop); } return(false); } }