public virtual void OrgMemberOfOrgDelete(OrgMemberOfOrg entity) { TraceCallEnterEvent.Raise(); try { m_DataContext.BeginNestedTran(); try { m_DataContext.ndihdOrgMemberOfOrgDelete(entity.ID); m_DataContext.CommitNested(); } catch { m_DataContext.RollbackNested(); throw; } TraceCallReturnEvent.Raise(); return; } catch (Exception ex) { ExceptionManager.Publish(ex); TraceCallReturnEvent.Raise(false); throw; } }
public static void KefMemberSave(string CacheID, OrgMemberOfOrg kefMember) { //töröljük ha van már ilyen HttpContext.Current.Cache.Remove("KefMember-" + CacheID); //elmentjük a Cache -be a tag adatait HttpContext.Current.Cache.Add("KefMember-" + CacheID, kefMember, null, Cache.NoAbsoluteExpiration, TimeSpan.FromHours(2), CacheItemPriority.Normal, null); }
protected void btnCreate_Click(object sender, EventArgs e) { try { if (!Page.IsValid) { return; } string orgID = Request["orgID"]; Guid orgGuid = new Guid(orgID); IOrgMemberOfOrgService srvKefMember = ServiceFactory.GetOrgMemberOfOrgService(); OrgMemberOfOrg item = new OrgMemberOfOrg(Guid.NewGuid()); item.OrganisationKefRef = orgGuid; item.OrganisationMemberRef = new Guid(ViewState["selectedOrgId"].ToString()); item.ContactName = txtName.Text; item.ContactInstitution = txtInstitution.Text; item.ContactZipCode = txtZipCode.Text; item.ContactTownShip = txtTownShip.Text; item.ContactAddress = txtAddress.Text; item.ContactPhone1 = txtPhone1.Text; item.ContactPhone2 = txtPhone2.Text; item.ContactPhone3 = txtPhone3.Text; item.ContactFax = txtFax.Text; item.ContactPosition = txtPosition.Text; item.ContactEmail1 = txtEmail1.Text; item.ContactEmail2 = txtEmail2.Text; item.ContactEmail3 = txtEmail3.Text; item.ContactQualification = txtQualification.Text; item.KefContactTypeRef = cmbContactType.SelectedValue.ToString(); item.ContactPositionInKef = txtPositionInKef.Text; srvKefMember.OrgMemberOfOrgInsert(item); Response.Redirect("KefOrganisationData.aspx?orgID=" + orgID); } catch (Exception ex) { errorPanel.Exception = ex; } }
public virtual void OrgMemberOfOrgUpdate(OrgMemberOfOrg entity) { TraceCallEnterEvent.Raise(); try { m_DataContext.BeginNestedTran(); try { int count; m_DataContext.ndihdOrgMemberOfOrgUpdate(entity.ID, entity.OrganisationKefRef, entity.OrganisationMemberRef, entity.ContactName, entity.ContactInstitution, entity.ContactZipCode, entity.ContactTownShip, entity.ContactAddress, entity.ContactPhone1, entity.ContactPhone2, entity.ContactPhone3, entity.ContactFax, entity.ContactPosition, entity.ContactPositionInKef, entity.ContactQualification, entity.ContactEmail1, entity.ContactEmail2, entity.ContactEmail3, entity.KefContactTypeRef, out count); if (count == 0) throw new ServiceUpdateException(); m_DataContext.CommitNested(); } catch { m_DataContext.RollbackNested(); throw; } TraceCallReturnEvent.Raise(); return; } catch (Exception ex) { ExceptionManager.Publish(ex); TraceCallReturnEvent.Raise(false); throw; } }
public virtual OrgMemberOfOrg OrgMemberOfOrgSelect(DBGuid IDVal) { TraceCallEnterEvent.Raise(); try { OrgMemberOfOrg result = null; DataSet entitySet = m_DataContext.ndihdOrgMemberOfOrgSelect(IDVal); if (entitySet.Tables[0].Rows.Count != 0) { result = new OrgMemberOfOrg(entitySet); } TraceCallReturnEvent.Raise(); return result; } catch (Exception ex) { ExceptionManager.Publish(ex); TraceCallReturnEvent.Raise(false); throw; } }
public override void OrgMemberOfOrgUpdate(OrgMemberOfOrg entity) { TraceCallEnterEvent.Raise(); try { m_DataContext.BeginNestedTran(); try { #region : Frissítjük a dKefMembersLastModified idõpontot : OrganisationService srvOrg = new OrganisationService(m_DataContext); Organisation org = srvOrg.OrganisationSelect(entity.OrganisationKefRef); org.KefMembersLastModified = DateTime.Now; srvOrg.OrganisationUpdateBase(org); #endregion //elmentjük az entitás adatait base.OrgMemberOfOrgUpdate(entity); m_DataContext.CommitNested(); } catch { m_DataContext.RollbackNested(); throw; } TraceCallReturnEvent.Raise(); return; } catch (Exception ex) { ExceptionManager.Publish(ex); TraceCallReturnEvent.Raise(false); throw; } }
public void OrganisationKefUpdate(Organisation org, KefEventContainer kefEvents, DataTable kefMembers) { // check permission: Writer or Admin string writerRole = org.ID.Value.ToString() + ".Writer"; PrincipalPermission permWriter = new PrincipalPermission(Thread.CurrentPrincipal.Identity.Name, writerRole); PrincipalPermission permAdmin = new PrincipalPermission(Thread.CurrentPrincipal.Identity.Name, "Administrator"); permWriter.Union(permAdmin).Demand(); TraceCallEnterEvent.Raise(); try { // check required fields: if (org.Name.Length == 0) throw new ArgumentNullException("Organisation.Name", "A szervezet neve nincs megadva."); if (org.PostCode.Length == 0) throw new ArgumentNullException("Organisation.PostCode", "A szervezet címének irányítószáma nincs megadva."); if (org.City.Length == 0) throw new ArgumentNullException("Organisation.City", "A szervezet címének települése nincs megadva."); if (org.Address.Length == 0) throw new ArgumentNullException("Organisation.Address", "A szervezet címének utca, házszám része nincs megadva."); if (org.OrganisationFormRef.Length == 0) throw new ArgumentNullException("Organisation.OrganisationFormRef", "A szervezeti forma kódja nincs megadva."); if (org.WorkingAreaRef.Length == 0) throw new ArgumentNullException("Organisation.WorkingAreaRef", "A mûködési terület nincs megadva."); // logical checks: Organisation selected = base.OrganisationSelect(org.ID); if (selected == null) throw new ApplicationException("Ezzel az azonosítóval nem létezik szervezet."); NdiPrincipal principal = (NdiPrincipal) Thread.CurrentPrincipal; if (!selected.IsActive && !principal.IsInRole("Administrator")) throw new ApplicationException("A szervezet nem aktív."); // save data: org.IsActive = selected.IsActive; try { //elmentjük a szervezet módosított adatokat base.OrganisationUpdate(org); m_DataContext.BeginNestedTran(); //töröljük az összes kapcsolódó eseményt ... OrganisationService srvOrg = new OrganisationService(m_DataContext); KefEventService srvKefEvent = new KefEventService(m_DataContext); srvOrg.DeleteChildrenByOrganisationOfKefEvent(org.ID); //majd beszúrjuk az újakat foreach (KefEvent item in kefEvents.Current) { srvKefEvent.KefEventInsert(item); } //töröljük az összes kapcsolódó tagot ... srvOrg.DeleteChildrenByKefOrgOfOrg(org.ID); OrgMemberOfOrgService srvKefMember = new OrgMemberOfOrgService(m_DataContext); //majd beszúrjuk az újakat foreach (DataRow row in kefMembers.Rows) { OrgMemberOfOrg member = new OrgMemberOfOrg(Guid.NewGuid()); member.OrganisationKefRef = new Guid(row["uOrganisationKefRef"].ToString()); member.OrganisationMemberRef = new Guid(row["uOrganisationMemberRef"].ToString()); member.ContactName = row["cContactName"].ToString(); member.ContactInstitution = row["cContactInstitution"].ToString(); member.ContactZipCode = row["cContactZipCode"].ToString(); member.ContactTownShip = row["cContactTownShip"].ToString(); member.ContactAddress = row["cContactAddress"].ToString(); member.ContactPhone1 = row["cContactPhone1"].ToString(); member.ContactPhone2 = row["cContactPhone2"].ToString(); member.ContactPhone3 = row["cContactPhone3"].ToString(); member.ContactFax = row["cContactFax"].ToString(); member.ContactPosition = row["cContactPosition"].ToString(); member.ContactPositionInKef = row["cContactPositionInKef"].ToString(); member.ContactEmail1 = row["cContactEmail1"].ToString(); member.ContactEmail2 = row["cContactEmail2"].ToString(); member.ContactEmail3 = row["cContactEmail3"].ToString(); member.ContactQualification = row["cContactQualification"].ToString(); member.KefContactTypeRef = row["cKefContactTypeRef"].ToString(); srvKefMember.OrgMemberOfOrgInsert(member); } //elmentjük a szervezethez tartozó feltöltött fileokat OrganisationAttachmentService srvOrgAtt = new OrganisationAttachmentService(m_DataContext); // Clear old files: OrganisationAttachmentContainer oldFiles = base.SelectChildrenByAttachmentOfOrganisation(org.ID); foreach (OrganisationAttachment oldFile in oldFiles.All) { srvOrgAtt.OrganisationAttachmentDelete(oldFile); } foreach (OrganisationAttachment file in org.OrgAttachments.Current) { if(file.DownloadData != null) srvOrgAtt.OrganisationAttachmentInsert(file); } m_DataContext.CommitNested(); } catch { m_DataContext.RollbackNested(); throw; } BusinessAuditEvent.Success( new EventParameter("OrganisationID", org.ID.ToString()), new EventParameter("OrganisationName", org.Name) ); TraceCallReturnEvent.Raise(); return; } catch (Exception ex) { ExceptionManager.Publish(ex); BusinessAuditEvent.Fail( new EventParameter("Exception", ex.ToString()), new EventParameter("OrganisationID", org.ID.ToString()), new EventParameter("OrganisationName", org.Name) ); TraceCallReturnEvent.Raise(false); throw; } }
protected void btnModify_Click(object sender, EventArgs e) { try { if (!Page.IsValid) { return; } NdiPrincipal principal = (NdiPrincipal) Context.User; //megnézzük hogy van e megadva selectedOrgId , mert ha van akkor az lesz a kiválasztott szervezet string selectedOrgId = Request["selectedOrgId"]; string kefId = Request["kefId"]; Guid kefGuid = new Guid(kefId); IOrgMemberOfOrgService srvKefMember = ServiceFactory.GetOrgMemberOfOrgService(); OrgMemberOfOrg item = null; if (selectedOrgId != null) { //létre kell hozni egy újat item = new OrgMemberOfOrg(Guid.NewGuid()); item.OrganisationKefRef = principal.OrganisationID; item.OrganisationMemberRef = new Guid(selectedOrgId); } else { item = srvKefMember.OrgMemberOfOrgSelect(kefGuid); } item.ContactName = txtName.Text; item.ContactInstitution = txtInstitution.Text; item.ContactZipCode = txtZipCode.Text; item.ContactTownShip = txtTownShip.Text; item.ContactAddress = txtAddress.Text; item.ContactPhone1 = txtPhone1.Text; item.ContactPhone2 = txtPhone2.Text; item.ContactPhone3 = txtPhone3.Text; item.ContactFax = txtFax.Text; item.ContactPosition = txtPosition.Text; item.ContactEmail1 = txtEmail1.Text; item.ContactEmail2 = txtEmail2.Text; item.ContactEmail3 = txtEmail3.Text; item.ContactQualification = txtQualification.Text; item.KefContactTypeRef = cmbContactType.SelectedValue.ToString(); item.ContactPositionInKef = txtPositionInKef.Text; if (selectedOrgId != null) { //INSERT srvKefMember.OrgMemberOfOrgInsert(item); //DELETE - töröljük a régit OrgMemberOfOrg kefMemDel = srvKefMember.OrgMemberOfOrgSelect(kefGuid); srvKefMember.OrgMemberOfOrgDelete(kefMemDel); } else //UPDATE srvKefMember.OrgMemberOfOrgUpdate(item); Response.Redirect("KefOrganisationData.aspx?orgID=" + principal.OrganisationID); } catch (Exception ex) { errorPanel.Exception = ex; } }
protected void lnkKefOrganisationList_Click(object sender, EventArgs e) { string kefId = Request["kefId"]; Guid kefGuid = new Guid(kefId); //elmentjük az eddig megadott adatokat OrgMemberOfOrg kefMember = new OrgMemberOfOrg(kefGuid); kefMember.ContactName = txtName.Text; kefMember.KefContactTypeRef = cmbContactType.SelectedValue; kefMember.ContactInstitution = txtInstitution.Text; kefMember.ContactZipCode = txtZipCode.Text; kefMember.ContactTownShip = txtTownShip.Text; kefMember.ContactAddress = txtAddress.Text; kefMember.ContactPhone1 = txtPhone1.Text; kefMember.ContactPhone2 = txtPhone2.Text; kefMember.ContactPhone3 = txtPhone3.Text; kefMember.ContactFax = txtFax.Text; kefMember.ContactPosition = txtPosition.Text; kefMember.ContactQualification = txtQualification.Text; kefMember.ContactEmail1 = txtEmail1.Text; kefMember.ContactEmail2 = txtEmail2.Text; kefMember.ContactEmail3 = txtEmail3.Text; NdiPrincipal principal = (NdiPrincipal) Context.User; CacheData.KefMemberSave(kefId + principal.Identity.Name, kefMember); Response.Redirect("OrganisationList.aspx?mode=kefMemberModSelect&orgId=" + kefId); }
// ------------------------------------------------------------------------------------- /// <summary> /// Copy constructor. /// </summary> /// <param name="IDVal">Value of 'uID' field</param> /// <param name="origInstance">Original document data to copy.</param> // ------------------------------------------------------------------------------------- public OrgMemberOfOrg(DBGuid IDVal, OrgMemberOfOrg origInstance) : base(IDVal, origInstance) { }
// ------------------------------------------------------------------------------------- /// <summary> /// Copy constructor. /// </summary> /// <param name="origInstance">Original document data to copy.</param> // ------------------------------------------------------------------------------------- public OrgMemberOfOrg(OrgMemberOfOrg origInstance) : base(origInstance) { }