public virtual void RegisterOrganisationDelete(RegisterOrganisation entity) { TraceCallEnterEvent.Raise(); try { m_DataContext.BeginNestedTran(); try { m_DataContext.ndihdRegisterOrganisationDelete(entity.ID); m_DataContext.CommitNested(); } catch { m_DataContext.RollbackNested(); throw; } TraceCallReturnEvent.Raise(); return; } catch (Exception ex) { ExceptionManager.Publish(ex); TraceCallReturnEvent.Raise(false); throw; } }
protected void btnSend_Click(object sender, EventArgs e) { try { if (!Page.IsValid) { return; } RegisterOrganisation doc = new RegisterOrganisation(Guid.NewGuid()); // set organisation data doc.Name = txtOrganisationName.Text; doc.Department = txtDepartment.Text; doc.PostCode = txtOrgPostCode.Text; doc.City = txtOrgCity.Text; doc.Address = txtOrgAddress.Text; if (rbtHungary.Checked) { if (cmbRegion.SelectedValue.Length == 0) { throw new ArgumentNullException("", "A megye nincs megadva."); } doc.RegionRef = cmbRegion.SelectedValue; } if (rbtAbroad.Checked) { doc.Country = txtCountry.Text; } doc.Phone1 = txtOrgPhone.Text; doc.Fax = txtOrgFax.Text; doc.Email1 = txtOrgEmail.Text; doc.HomePage = txtHomePage.Text; doc.ActivityPrevention = cbxPrevention.Checked; doc.ActivityResearch = cbxResearch.Checked; doc.ActivityRehabilitation = cbxRehabilitation.Checked; doc.ActivityOther = cbxOther.Checked; doc.WorkingAreaRef = cmbWorkingArea.SelectedValue; doc.WorkingAreaOther = txtWorkingAreaOther.Text; doc.OrganisationFormRef = cmbOrganisationForm.SelectedValue; // user data doc.LoginName = txtLoginName.Text; doc.UserName = txtUserFullName.Text; doc.UserSex = cmbSex.SelectedValue; doc.UserBirthYear = txtBirthYear.Text; doc.UserPhone = txtUserPhone.Text; doc.UserEmail = txtUserEmail.Text; doc.UserCountry = txtAddressCountry.Text; doc.UserCity = txtAddressCity.Text; doc.UserAddress = txtAddressStreet.Text; doc.UserPostCode = txtAddressPostCode.Text; doc.QualificationRef = cmbQualification.SelectedValue; doc.ReasonOfRegistration = txtReasonOfRegistration.Text; // Send data IRegisterOrganisationService srv = ServiceFactory.GetRegisterOrganisationService(); srv.RegisterOrganisationInsert(doc); Response.Redirect("RegisterFinish.aspx?from=org"); } catch (Exception ex) { errorPanel.Exception = ex; } }
private void Registration() { Guid orgID = Guid.NewGuid(); //készítünk egy új azonosítót a szervezetnek IRegisterOrganisationService regOrgSrv = ServiceFactory.GetRegisterOrganisationService(); RegisterOrganisation regOrg = new RegisterOrganisation(orgID); // Organisation regOrg.Name = txtOrganisationName.Text; //if (this.txtOrgPostCode.Text.Length > 0) regOrg.PostCode = "-"; //this.txtOrgPostCode.Text; //if (this.txtOrgCity.Text.Length > 0) regOrg.City = "-"; //this.txtOrgCity.Text; //if (this.txtOrgAddress.Text.Length > 0) regOrg.Address = "-"; //this.txtOrgAddress.Text; if (txtOrgEmail.Text.Length > 0) regOrg.Email1 = txtOrgEmail.Text; if (txtOrgHomePage.Text.Length > 0) regOrg.HomePage = txtOrgHomePage.Text; regOrg.WorkingAreaRef = cmbOrgWorkingArea.SelectedValue.ToString(); regOrg.RegionRef = cmbOrgRegion.SelectedValue.ToString(); regOrg.ReasonOfRegistration = txtOrgDescription.Text; regOrg.OrganisationFormRef = "OTHER"; //beégetjük, ez a KEF // User regOrg.LoginName = txtLoginName.Text; regOrg.UserName = txtUserName.Text; regOrg.UserSex = (rbtMan.Checked ? "F" : "N"); regOrg.UserBirthYear = txtBirthYear.Text; if (txtUserPhone.Text.Length > 0) regOrg.UserPhone = txtUserPhone.Text; regOrg.UserEmail = txtUserEmail.Text; if (txtUserPostCode.Text.Length > 0) regOrg.UserPostCode = txtUserPostCode.Text; if (txtUserCity.Text.Length > 0) regOrg.UserCity = txtUserCity.Text; if (txtUserAddress.Text.Length > 0) regOrg.UserAddress = txtUserAddress.Text; if (txtCountry.Text.Length > 0) regOrg.UserCountry = txtCountry.Text; regOrg.QualificationRef = cmbQualification.SelectedValue.ToString(); //hozzá kell adni azokat a mezõket is amik csak a KEF regisztrációnál szükségesek string regSearchCode = txtOrgRegionSearch.Tag.ToString(); DBInt disSearchCode = DBInt.Null; if (cmbOrgDistrictSearch.SelectedValue.ToString() != "") { disSearchCode = Convert.ToInt32(cmbOrgDistrictSearch.SelectedValue.ToString()); } string estYear = txtOrgEstYear.Text; string estMonth = txtOrgEstMonth.Text; string areaHomePage = txtAreaHomePage.Text; if (!regOrgSrv.RegisterKefOrganisation(regOrg, regSearchCode, disSearchCode, estYear, estMonth, areaHomePage)) { MessageBox.Show("Az elfogadás megtörtént, de az értesítõ levél kiküldése nem sikerült.", "NDI HelpDesk Administrator", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
// ------------------------------------------------------------------------------------- /// <summary> /// Fill datagrid with data /// </summary> // ------------------------------------------------------------------------------------- private void FillDatagrid(DBGuid ID) { try { string sSortColumn = "SentDate"; int nSelectedRow = -1; // Storing the previous sort order if (dtgMain.DataSource != null) { sSortColumn = ((DataTable) dtgMain.DataSource).DefaultView.Sort; } // Set filter RegisterOrganisation filter = new RegisterOrganisation(Guid.Empty); if (cmbStatusFilter.SelectedIndex > 0) { filter.Status = cmbStatusFilter.SelectedValue.ToString(); } // Retrieving data from BusinessServices IRegisterOrganisationService srv = ServiceFactory.GetRegisterOrganisationService(); RegisterOrganisationContainer allData = srv.RegisterOrganisationSelectFiltered(filter); DataTable dt = allData.AllAsDatatable; dt.DefaultView.Sort = sSortColumn; dtgMain.DataSource = dt; // locates the row specified by ID param if (!ID.IsNull) { BindingManagerBase bm = dtgMain.BindingContext[dtgMain.DataSource, dtgMain.DataMember]; DataRow dr; for (int i = 0; i < bm.Count; i++) { dr = ((DataRowView) bm.Current).Row; if (ID.Value.Equals(dr["ID"])) { nSelectedRow = i; break; } bm.Position += 1; } } // Makes the row selected if (nSelectedRow <= ((DataTable) dtgMain.DataSource).DefaultView.Count && nSelectedRow > -1) { dtgMain.Select(nSelectedRow); dtgMain.CurrentRowIndex = nSelectedRow; } else if (((DataTable) dtgMain.DataSource).DefaultView.Count != 0) { dtgMain.Select(0); } // Enabling or disabling the buttons according to record count. // And is because of previous disable state. tbbDecide.Enabled = (((DataTable) dtgMain.DataSource).DefaultView.Count != 0); } catch (Exception ex) { // --- Log exception ExceptionManager.Publish(ex); // --- Display Exception ErrorHandler.DisplayError("Nem várt hiba lépett fel a lista frissítése során.", ex); } }
public virtual void RegisterOrganisationUpdate(RegisterOrganisation entity) { TraceCallEnterEvent.Raise(); try { m_DataContext.BeginNestedTran(); try { int count; m_DataContext.ndihdRegisterOrganisationUpdate(entity.ID, entity.Name, entity.Department, entity.PostCode, entity.City, entity.Address, entity.RegionRef, entity.Country, entity.Phone1, entity.Fax, entity.Email1, entity.HomePage, entity.ActivityPrevention, entity.ActivityResearch, entity.ActivityRehabilitation, entity.ActivityOther, entity.WorkingAreaRef, entity.WorkingAreaOther, entity.OrganisationFormRef, entity.LoginName, entity.UserName, entity.UserSex, entity.UserBirthYear, entity.UserPhone, entity.UserEmail, entity.UserCountry, entity.UserPostCode, entity.UserCity, entity.UserAddress, entity.QualificationRef, entity.ReasonOfRegistration, entity.Status, entity.SentDate, entity.DecidedBy, entity.DecidedDate, entity.RejectComment, entity.IsUserRegistred, 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; } }
// ------------------------------------------------------------------------------------- /// <summary> /// Prepage Accept action /// </summary> // ------------------------------------------------------------------------------------- private void AcceptRegistration() { IRegisterOrganisationService regOrgSrv = ServiceFactory.GetRegisterOrganisationService(); RegisterOrganisation regOrg = new RegisterOrganisation(CurrentID); // Get control values // Organisation regOrg.Name = txtOrganisationName.Text; if (txtOrgDepartment.Text.Length > 0) regOrg.Department = txtOrgDepartment.Text; if (txtOrgPostCode.Text.Length > 0) regOrg.PostCode = txtOrgPostCode.Text; if (txtOrgCity.Text.Length > 0) regOrg.City = txtOrgCity.Text; if (txtOrgAddress.Text.Length > 0) regOrg.Address = txtOrgAddress.Text; if (txtOrgCountry.Text.Length > 0) regOrg.Country = txtOrgCountry.Text; if (txtOrgPhone.Text.Length > 0) regOrg.Phone1 = txtOrgPhone.Text; if (txtOrgFax.Text.Length > 0) regOrg.Fax = txtOrgFax.Text; if (txtOrgEmail.Text.Length > 0) regOrg.Email1 = txtOrgEmail.Text; if (txtOrgHomePage.Text.Length > 0) regOrg.HomePage = txtOrgHomePage.Text; regOrg.RegionRef = cmbOrgRegion.SelectedValue.ToString(); regOrg.WorkingAreaRef = cmbOrgWorkingArea.SelectedValue.ToString(); if (txtOrgWorkingAreaOther.Text.Length > 0) regOrg.WorkingAreaOther = txtOrgWorkingAreaOther.Text; regOrg.OrganisationFormRef = cmbOrgForm.SelectedValue.ToString(); regOrg.ActivityPrevention = cbxOrgActPrevention.Checked; regOrg.ActivityRehabilitation = cbxOrgActRehabilitation.Checked; regOrg.ActivityResearch = cbxOrgActResearch.Checked; regOrg.ActivityOther = cbxOrgActOther.Checked; regOrg.ReasonOfRegistration = txtOrgDescription.Text; // User regOrg.LoginName = txtLoginName.Text; regOrg.UserName = txtUserName.Text; regOrg.UserSex = (rbtMan.Checked ? "F" : "N"); regOrg.UserBirthYear = txtBirthYear.Text; if (txtUserPhone.Text.Length > 0) regOrg.UserPhone = txtUserPhone.Text; regOrg.UserEmail = txtUserEmail.Text; if (txtUserPostCode.Text.Length > 0) regOrg.PostCode = txtUserPostCode.Text; if (txtUserCity.Text.Length > 0) regOrg.City = txtUserCity.Text; if (txtUserAddress.Text.Length > 0) regOrg.Address = txtUserAddress.Text; if (txtCountry.Text.Length > 0) regOrg.Country = txtCountry.Text; regOrg.QualificationRef = cmbQualification.SelectedValue.ToString(); regOrg.RejectComment = txtRejectComment.Text; if (m_IsUserRegistred == false) { if (!regOrgSrv.RegisterOrganisationAccept(regOrg)) { MessageBox.Show("Az elfogadás megtörtént, de az értesítõ levél kiküldése nem sikerült.", "NDI HelpDesk Administrator", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { if (!regOrgSrv.RegisterOrganisationToUserAccept(regOrg)) { MessageBox.Show("Az elfogadás megtörtént, de az értesítõ levél kiküldése nem sikerült.", "NDI HelpDesk Administrator", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } }
public virtual RegisterOrganisation RegisterOrganisationSelect(DBGuid IDVal) { TraceCallEnterEvent.Raise(); try { RegisterOrganisation result = null; DataSet entitySet = m_DataContext.ndihdRegisterOrganisationSelect(IDVal); if (entitySet.Tables[0].Rows.Count != 0) { result = new RegisterOrganisation(entitySet); } TraceCallReturnEvent.Raise(); return result; } catch (Exception ex) { ExceptionManager.Publish(ex); TraceCallReturnEvent.Raise(false); throw; } }
public bool RegisterOrganisationToUserAccept(RegisterOrganisation entity) { //Check permission: Admin PrincipalPermission permissionAdm = new PrincipalPermission(Thread.CurrentPrincipal.Identity.Name, "Administrator"); permissionAdm.Demand(); TraceCallEnterEvent.Raise(); try { // Check required fields // Organisation if (entity.Name.Length == 0) throw new ArgumentNullException("RegisterOrganisation.Name", "A regisztrálandó szervezet neve nincs megadva."); if (entity.RegionRef.Length == 0) throw new ArgumentNullException("RegisterOrganisation.RegionRef", "A regisztrálandó szervezet megyéje nincs megadva."); if (entity.WorkingAreaRef.Length == 0) throw new ArgumentNullException("RegisterOrganisation.WorkingAreaRef", "A regisztrálandó szervezet mûködési területe nincs megadva."); if (entity.OrganisationFormRef.Length == 0) throw new ArgumentNullException("RegisterOrganisation.OrganisationFormRef", "A regisztrálandó szervezet szervezeti formája nincs megadva."); if (entity.ReasonOfRegistration.Length == 0) throw new ArgumentNullException("RegisterOrganisation.ReasonOfRegistration", "Az adatbázis használatának célja nincs megadva."); if (entity.PostCode.Length == 0) throw new ArgumentNullException("RegisterOrganisation.PostCode", "A szervezet címének irányítószáma nincs megadva."); if (entity.City.Length == 0) throw new ArgumentNullException("RegisterOrganisation.City", "A szervezet címének település része nincs megadva."); if (entity.Address.Length == 0) throw new ArgumentNullException("RegisterOrganisation.Address", "A szervezet címének utca, házszám része nincs megadva."); // User if (entity.LoginName.Length == 0) throw new ArgumentNullException("RegisterOrganisation.LoginName", "A regisztrálandó felhasználó bejelentkezési neve nincs megadva."); if (entity.UserName.Length == 0) throw new ArgumentNullException("RegisterOrganisation.UserName", "A regisztrálandó felhasználó neve nincs megadva."); if (entity.UserSex.Length == 0) throw new ArgumentNullException("RegisterOrganisation.UserSex", "A regisztrálandó felhasználó neme nincs megadva."); if (entity.UserBirthYear.Length == 0) throw new ArgumentNullException("RegisterOrganisation.UserBirthYear", "A regisztrálandó felhasználó születési éve nincs megadva."); if (entity.UserEmail.Length == 0) throw new ArgumentNullException("RegisterOrganisation.UserEmail", "A regisztrálandó felhasználó e-mail címe nincs megadva."); if (entity.QualificationRef.Length == 0) throw new ArgumentNullException("RegisterOrganisation.QualificationRef", "A regisztrálandó felhasználó legmagasabb iskolai végzettsége nincs megadva."); // Logical checks RegisterOrganisation selected = base.RegisterOrganisationSelect(entity.ID); if (selected == null) throw new ApplicationException("A megadott azonosítóval nem létezik regisztrálandó szervezet."); if (! selected.Status.Equals(RegistrationStatus.New)) throw new ApplicationException("Csak új státuszú regisztráció bírálható el."); // Set properties entity.SentDate = selected.SentDate; entity.DecidedBy = Thread.CurrentPrincipal.Identity.Name; entity.DecidedDate = DBDateTime.Now; entity.Status = RegistrationStatus.Accepted; Organisation newOrg = new Organisation(entity.ID); newOrg.Name = entity.Name; newOrg.Department = entity.Department; newOrg.PostCode = entity.PostCode; newOrg.City = entity.City; newOrg.Address = entity.Address; newOrg.Country = entity.Country; newOrg.Phone1 = entity.Phone1; newOrg.Fax = entity.Fax; newOrg.Email1 = entity.Email1; newOrg.HomePage = entity.HomePage; newOrg.RegionRef = entity.RegionRef; newOrg.WorkingAreaRef = entity.WorkingAreaRef; newOrg.WorkingAreaOther = entity.WorkingAreaOther; newOrg.OrganisationFormRef = entity.OrganisationFormRef; newOrg.ActivityPrevention = entity.ActivityPrevention; newOrg.ActivityRehabilitation = entity.ActivityRehabilitation; newOrg.ActivityResearch = entity.ActivityResearch; newOrg.ActivityOther = entity.ActivityOther; newOrg.SourceGovernment = 0; newOrg.SourceCompetition = 0; newOrg.SourceSponsor = 0; newOrg.SourceDonation = 0; newOrg.SourceTax = 0; newOrg.SourceOther = 0; newOrg.IsActive = true; // defaults newOrg.WorkersFix = 0; newOrg.WorkersExternal = 0; newOrg.WorkersVolunteer = 0; newOrg.JobPsychologist = 0; newOrg.JobPsychiater = 0; newOrg.JobDoctor = 0; newOrg.JobMedicalExpert = 0; newOrg.JobHealthExpert = 0; newOrg.JobSociologist = 0; newOrg.JobSocialPolitician = 0; newOrg.JobSocialWorker = 0; newOrg.JobSocialPedagogist = 0; newOrg.JobPedagogist = 0; newOrg.JobManualist = 0; newOrg.JobLawyer = 0; newOrg.JobPoliceman = 0; newOrg.JobMentalhygiene = 0; newOrg.JobCultureOrganizer = 0; newOrg.JobOther1 = 0; newOrg.JobOther2 = 0; newOrg.JobOther3 = 0; newOrg.IsActual = true; newOrg.LastModified = DateTime.Now; //set mail: Email mail = new Email(Guid.NewGuid()); mail.Category = EmailCategory.OrganisationRegistrationAccept; mail.To = entity.UserEmail; //Subject és body lekérdezése string body = ""; string subject = ""; EmailTemplateService srvTemplate = new EmailTemplateService(); srvTemplate.GetEmailTemplateByCode(ref subject, ref body, EmailCategory.OrganisationRegistrationAccept); mail.Subject = subject; body = body.Replace("<FULL_USER_NAME>", entity.Name); body = body.Replace("<LOGIN_NAME>", entity.LoginName); body = body.Replace("<ORGANIZATION>", newOrg.Name); mail.MailBody = body; // Save data to database EmailService emailSrv = new EmailService(m_DataContext); m_DataContext.BeginNestedTran(); try { //elmentjük a szervezet adatait OrganisationService orgSrv = new OrganisationService(m_DataContext); orgSrv.OrganisationInsert(newOrg); //eltároljuk a szervezet-felhasználó kapcsolatot OrganisationUserService orgUserSrv = new OrganisationUserService(m_DataContext); OrganisationUser orgUser = new OrganisationUser(newOrg.ID, entity.LoginName); orgUser.Right = UserRights.Write; orgUserSrv.OrganisationUserInsert(orgUser); base.RegisterOrganisationUpdate(entity); emailSrv.EmailInsert(mail); m_DataContext.CommitNested(); } catch { m_DataContext.RollbackNested(); throw; } // Sending mail: try { emailSrv.EmailSend(mail.ID); } catch (Exception ex) { ExceptionManager.Publish(ex); return false; } // Log success BusinessAuditEvent.Success( new EventParameter("RegisterOrganisationID", entity.ID.ToString()), new EventParameter("OrganisationID", newOrg.ID.ToString()), new EventParameter("OrganisationName", entity.Name), new EventParameter("LoginName", entity.LoginName) ); TraceCallReturnEvent.Raise(); return true; } catch (Exception ex) { ExceptionManager.Publish(ex); BusinessAuditEvent.Fail( new EventParameter("Exception", ex.ToString()), new EventParameter("RegisterOrganisationID", entity.ID.ToString()), new EventParameter("OrganisationName", entity.Name), new EventParameter("LoginName", entity.LoginName) ); TraceCallReturnEvent.Raise(false); throw; } }
// ------------------------------------------------------------------------------------- /// <summary> /// Preapare reject action /// </summary> // ------------------------------------------------------------------------------------- private void RejectRegistration() { IRegisterOrganisationService regSrv = ServiceFactory.GetRegisterOrganisationService(); RegisterOrganisation regOrg = new RegisterOrganisation(CurrentID); regOrg.RejectComment = txtRejectComment.Text; if (!regSrv.RegisterOrganisationReject(regOrg)) { MessageBox.Show("Az elutasítás megtörtént, de az értesítõ levél kiküldése nem sikerült.", "NDI HelpDesk Administrator", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
public bool RegisterKefOrganisation(RegisterOrganisation entity, string regSearchCode, DBInt disSearchCode, string estYear, string estMonth, string areaHomePage) { //Check permission: Admin PrincipalPermission permissionAdm = new PrincipalPermission(Thread.CurrentPrincipal.Identity.Name, "Administrator"); permissionAdm.Demand(); TraceCallEnterEvent.Raise(); try { // Check required fields // Organisation if (entity.Name.Length == 0) throw new ArgumentNullException("RegisterOrganisation.Name", "A regisztrálandó szervezet neve nincs megadva."); if (entity.RegionRef.Length == 0) throw new ArgumentNullException("RegisterOrganisation.RegionRef", "A regisztrálandó szervezet megyéje nincs megadva."); if (entity.WorkingAreaRef.Length == 0) throw new ArgumentNullException("RegisterOrganisation.WorkingAreaRef", "A regisztrálandó szervezet mûködési területe nincs megadva."); if (entity.OrganisationFormRef.Length == 0) throw new ArgumentNullException("RegisterOrganisation.OrganisationFormRef", "A regisztrálandó szervezet szervezeti formája nincs megadva."); if (entity.ReasonOfRegistration.Length == 0) throw new ArgumentNullException("RegisterOrganisation.ReasonOfRegistration", "Az adatbázis használatának célja nincs megadva."); if (entity.PostCode.Length == 0) throw new ArgumentNullException("RegisterOrganisation.PostCode", "A szervezet címének irányítószáma nincs megadva."); if (entity.City.Length == 0) throw new ArgumentNullException("RegisterOrganisation.City", "A szervezet címének település része nincs megadva."); if (entity.Address.Length == 0) throw new ArgumentNullException("RegisterOrganisation.Address", "A szervezet címének utca, házszám része nincs megadva."); // User if (entity.LoginName.Length == 0) throw new ArgumentNullException("RegisterOrganisation.LoginName", "A regisztrálandó felhasználó bejelentkezési neve nincs megadva."); if (entity.UserName.Length == 0) throw new ArgumentNullException("RegisterOrganisation.UserName", "A regisztrálandó felhasználó neve nincs megadva."); if (entity.UserSex.Length == 0) throw new ArgumentNullException("RegisterOrganisation.UserSex", "A regisztrálandó felhasználó neme nincs megadva."); if (entity.UserBirthYear.Length == 0) throw new ArgumentNullException("RegisterOrganisation.UserBirthYear", "A regisztrálandó felhasználó születési éve nincs megadva."); if (entity.UserEmail.Length == 0) throw new ArgumentNullException("RegisterOrganisation.UserEmail", "A regisztrálandó felhasználó e-mail címe nincs megadva."); if (entity.QualificationRef.Length == 0) throw new ArgumentNullException("RegisterOrganisation.QualificationRef", "A regisztrálandó felhasználó legmagasabb iskolai végzettsége nincs megadva."); Organisation newOrg = new Organisation(entity.ID); newOrg.Name = entity.Name; newOrg.Department = entity.Department; newOrg.PostCode = entity.PostCode; newOrg.City = entity.City; newOrg.Address = entity.Address; newOrg.Country = entity.Country; newOrg.Phone1 = entity.Phone1; newOrg.Fax = entity.Fax; newOrg.Email1 = entity.Email1; newOrg.HomePage = entity.HomePage; newOrg.RegionRef = entity.RegionRef; newOrg.WorkingAreaRef = entity.WorkingAreaRef; newOrg.WorkingAreaOther = entity.WorkingAreaOther; newOrg.OrganisationFormRef = entity.OrganisationFormRef; newOrg.ActivityPrevention = entity.ActivityPrevention; newOrg.ActivityRehabilitation = entity.ActivityRehabilitation; newOrg.ActivityResearch = entity.ActivityResearch; newOrg.ActivityOther = entity.ActivityOther; newOrg.SourceGovernment = 0; newOrg.SourceCompetition = 0; newOrg.SourceSponsor = 0; newOrg.SourceDonation = 0; newOrg.SourceTax = 0; newOrg.SourceOther = 0; newOrg.IsActive = true; // defaults newOrg.WorkersFix = 0; newOrg.WorkersExternal = 0; newOrg.WorkersVolunteer = 0; newOrg.JobPsychologist = 0; newOrg.JobPsychiater = 0; newOrg.JobDoctor = 0; newOrg.JobMedicalExpert = 0; newOrg.JobHealthExpert = 0; newOrg.JobSociologist = 0; newOrg.JobSocialPolitician = 0; newOrg.JobSocialWorker = 0; newOrg.JobSocialPedagogist = 0; newOrg.JobPedagogist = 0; newOrg.JobManualist = 0; newOrg.JobLawyer = 0; newOrg.JobPoliceman = 0; newOrg.JobMentalhygiene = 0; newOrg.JobCultureOrganizer = 0; newOrg.JobOther1 = 0; newOrg.JobOther2 = 0; newOrg.JobOther3 = 0; //It's a KEF -> set KEF specific data newOrg.IsKef = true; newOrg.RegionSearchCodeRef = regSearchCode; newOrg.DistrictSearchCodeRef = disSearchCode; newOrg.EstablishmentYear = estYear; newOrg.EstablishmentMonth = estMonth; newOrg.AreaHomePage = areaHomePage; newOrg.IsActual = true; newOrg.LastModified = DateTime.Now; //save the user User newUser = new User(entity.LoginName); newUser.OrganisationRef = entity.ID; string generatedPassword = Password.Generate(); newUser.Password = Password.ComputeHash(generatedPassword); newUser.Address = entity.UserAddress; newUser.Name = entity.UserName; newUser.Sex = entity.UserSex; newUser.BirthYear = entity.UserBirthYear; newUser.Phone = entity.UserPhone; newUser.Email = entity.UserEmail; newUser.PostCode = entity.UserPostCode; newUser.City = entity.UserCity; newUser.Address = entity.UserAddress; newUser.Country = entity.UserCountry; newUser.QualificationRef = entity.QualificationRef; newUser.ReasonOfRegistration = entity.ReasonOfRegistration; newUser.Right = UserRights.Write; newUser.IsActive = true; newUser.NewsMail = false; newUser.MustChangePassword = true; newUser.FailedAttemptCount = 0; newUser.LockedOut = false; //set mail: Email mail = new Email(Guid.NewGuid()); mail.Category = EmailCategory.OrganisationRegistrationAccept; mail.To = entity.UserEmail; //Subject és body lekérdezése string body = ""; string subject = ""; IEmailTemplateService srvTemplate = new EmailTemplateService(); srvTemplate.GetEmailTemplateByCode(ref subject, ref body, EmailCategory.OrganisationRegistrationAccept); mail.Subject = subject; body = body.Replace("<FULL_USER_NAME>", entity.Name); body = body.Replace("<LOGIN_NAME>", entity.LoginName); body = body.Replace("<ORGANIZATION>", newOrg.Name); body = body.Replace("<PASSWORD>", generatedPassword); mail.MailBody = body; // Save data to database EmailService emailSrv = new EmailService(m_DataContext); m_DataContext.BeginNestedTran(); try { UserServiceBase userSrv = new UserServiceBase(m_DataContext); OrganisationService orgSrv = new OrganisationService(m_DataContext); orgSrv.OrganisationInsert(newOrg); userSrv.UserInsert(newUser); emailSrv.EmailInsert(mail); m_DataContext.CommitNested(); } catch { m_DataContext.RollbackNested(); throw; } // Sending mail: try { emailSrv.EmailSend(mail.ID); } catch (Exception ex) { ExceptionManager.Publish(ex); return false; } // Log success BusinessAuditEvent.Success( new EventParameter("RegisterOrganisationID", entity.ID.ToString()), new EventParameter("OrganisationID", newOrg.ID.ToString()), new EventParameter("OrganisationName", entity.Name), new EventParameter("LoginName", entity.LoginName) ); TraceCallReturnEvent.Raise(); return true; } catch (Exception ex) { ExceptionManager.Publish(ex); BusinessAuditEvent.Fail( new EventParameter("Exception", ex.ToString()), new EventParameter("RegisterOrganisationID", entity.ID.ToString()), new EventParameter("OrganisationName", entity.Name), new EventParameter("LoginName", entity.LoginName) ); TraceCallReturnEvent.Raise(false); throw; } }
public RegisterOrganisationContainer RegisterOrganisationSelectFiltered(RegisterOrganisation filter) { // Check permission: Admin PrincipalPermission permissionAdm = new PrincipalPermission(Thread.CurrentPrincipal.Identity.Name, "Administrator"); permissionAdm.Demand(); TraceCallEnterEvent.Raise(); try { RegisterOrganisationContainer result; DataSet entitySet = m_DataContext.ndihdRegisterOrganisationSelectFiltered(filter.Status); result = new RegisterOrganisationContainer(entitySet.Tables[0]); TraceCallReturnEvent.Raise(); return result; } catch (Exception ex) { ExceptionManager.Publish(ex); TraceCallReturnEvent.Raise(false); throw; } }
public bool RegisterOrganisationReject(RegisterOrganisation entity) { //Check permission: Admin PrincipalPermission permissionAdm = new PrincipalPermission(Thread.CurrentPrincipal.Identity.Name, "Administrator"); permissionAdm.Demand(); TraceCallEnterEvent.Raise(); try { // Check required fields if (entity.RejectComment.Length == 0) throw new ArgumentNullException("RegisterOrganisation.RejectComment", "Az elutasítás indoklása nincs megadva."); // Logical checks RegisterOrganisation selected = base.RegisterOrganisationSelect(entity.ID); if (selected == null) throw new ApplicationException("A megadott azonosítóval nem létezik regisztrálandó szervezet."); if (! selected.Status.Equals(RegistrationStatus.New)) throw new ApplicationException("Csak új státuszú regisztráció bírálható el."); // Set properties selected.DecidedBy = Thread.CurrentPrincipal.Identity.Name; selected.DecidedDate = DBDateTime.Now; selected.Status = RegistrationStatus.Rejected; selected.RejectComment = entity.RejectComment; //set mail: Email mail = new Email(Guid.NewGuid()); mail.Category = EmailCategory.OrganisationRegistrationReject; mail.To = selected.UserEmail; //Subject és body lekérdezése string body = ""; string subject = ""; IEmailTemplateService srvTemplate = new EmailTemplateService(); srvTemplate.GetEmailTemplateByCode(ref subject, ref body, EmailCategory.OrganisationRegistrationReject); mail.Subject = subject; body = body.Replace("<FULL_USER_NAME>", selected.Name); body = body.Replace("<LOGIN_NAME>", selected.LoginName); body = body.Replace("<ORGANISATION>", ""); body = body.Replace("<REJECT_COMMENT>", entity.RejectComment); mail.MailBody = body; // Save data to database EmailService emailSrv = new EmailService(m_DataContext); m_DataContext.BeginNestedTran(); try { base.RegisterOrganisationUpdate(selected); emailSrv.EmailInsert(mail); m_DataContext.CommitNested(); } catch { m_DataContext.RollbackNested(); throw; } // Sending mail: try { emailSrv.EmailSend(mail.ID); } catch (Exception ex) { ExceptionManager.Publish(ex); return false; } // Log success BusinessAuditEvent.Success( new EventParameter("RegisterOrganisationID", entity.ID.ToString()), new EventParameter("OrganisationName", selected.Name), new EventParameter("LoginName", selected.LoginName) ); TraceCallReturnEvent.Raise(); return true; } catch (Exception ex) { ExceptionManager.Publish(ex); BusinessAuditEvent.Fail( new EventParameter("Exception", ex.ToString()), new EventParameter("RegisterOrganisationID", entity.ID.ToString()) ); TraceCallReturnEvent.Raise(false); throw; } }
public void RegisterOrganisationInsertToLogin(RegisterOrganisation entity) { // Check permission: anybody TraceCallEnterEvent.Raise(); try { // Check required fields if (entity.Name.Length == 0) throw new ArgumentNullException("RegisterOrganisation.Name", "A regisztrálandó szervezet neve nincs megadva."); if (entity.RegionRef.Length == 0) throw new ArgumentNullException("RegisterOrganisation.RegionRef", "A megye kódja nincs megadva."); if (entity.WorkingAreaRef.Length == 0) throw new ArgumentNullException("RegisterOrganisation.WorkingAreaRef", "A mûködési terület nincs megadva."); if (entity.OrganisationFormRef.Length == 0) throw new ArgumentNullException("RegisterOrganisation.OrganisationFormRef", "A szervezeti forma nincs megadva."); if (entity.PostCode.Length == 0) throw new ArgumentNullException("RegisterOrganisation.PostCode", "A szervezet címének irányítószáma nincs megadva."); if (entity.City.Length == 0) throw new ArgumentNullException("RegisterOrganisation.City", "A szervezet címének település része nincs megadva."); if (entity.Address.Length == 0) throw new ArgumentNullException("RegisterOrganisation.Address", "A szervezet címének utca, házszám része nincs megadva."); if (entity.LoginName.Length == 0) throw new ArgumentNullException("RegisterOrganisation.LoginName", "A felhasználó login neve nincs megadva."); // Logical checks UserService userService = new UserService(m_DataContext); if (userService.UserCheckLoginName(entity.LoginName) == false) { throw new ApplicationException("A megadott bejelentkezési név nem létezik."); } // Set properties entity.SentDate = DBDateTime.Now; entity.Status = RegistrationStatus.New; //egy már létezõ regisztrált felhasználóhoz rendeljük a szervezetet entity.IsUserRegistred = true; // Save data to database base.RegisterOrganisationInsert(entity); // Log success BusinessAuditEvent.Success( new EventParameter("RegisterOrganisationID", entity.ID.ToString()), new EventParameter("OrganisationName", entity.Name), new EventParameter("LoginName", entity.LoginName) ); TraceCallReturnEvent.Raise(); return; } catch (Exception ex) { ExceptionManager.Publish(ex); BusinessAuditEvent.Fail( new EventParameter("Exception", ex.ToString()), new EventParameter("RegisterOrganisationID", entity.ID.ToString()), new EventParameter("OrganisationName", entity.Name), new EventParameter("LoginName", entity.LoginName) ); TraceCallReturnEvent.Raise(false); throw; } }
public new void RegisterOrganisationInsert(RegisterOrganisation entity) { // Check permission: anybody TraceCallEnterEvent.Raise(); try { // Check required fields if (entity.Name.Length == 0) throw new ArgumentNullException("RegisterOrganisation.Name", "A regisztrálandó szervezet neve nincs megadva."); if (entity.RegionRef.Length == 0) throw new ArgumentNullException("RegisterOrganisation.RegionRef", "A megye kódja nincs megadva."); if (entity.WorkingAreaRef.Length == 0) throw new ArgumentNullException("RegisterOrganisation.WorkingAreaRef", "A mûködési terület nincs megadva."); if (entity.OrganisationFormRef.Length == 0) throw new ArgumentNullException("RegisterOrganisation.OrganisationFormRef", "A szervezeti forma nincs megadva."); if (entity.PostCode.Length == 0) throw new ArgumentNullException("RegisterOrganisation.PostCode", "A szervezet címének irányítószáma nincs megadva."); if (entity.City.Length == 0) throw new ArgumentNullException("RegisterOrganisation.City", "A szervezet címének település része nincs megadva."); if (entity.Address.Length == 0) throw new ArgumentNullException("RegisterOrganisation.Address", "A szervezet címének utca, házszám része nincs megadva."); if (entity.LoginName.Length == 0) throw new ArgumentNullException("RegisterOrganisation.LoginName", "A felhasználó login neve nincs megadva."); if (entity.UserName.Length == 0) throw new ArgumentNullException("RegisterOrganisation.UserName", "A felhasználó neve nincs megadva."); if (entity.UserSex.Length == 0) throw new ArgumentNullException("RegisterOrganisation.Sex", "A regisztrálandó felhasználó neme nincs megadva."); if (entity.UserBirthYear.Length == 0) throw new ArgumentNullException("RegisterOrganisation.BirthYear", "A regisztrálandó felhasználó születési éve nincs megadva."); if (entity.UserEmail.Length == 0) throw new ArgumentNullException("RegisterOrganisation.UserEmail", "A felhasználó e-mail címe nincs megadva."); if (entity.QualificationRef.Length == 0) throw new ArgumentNullException("RegisterOrganisation.QualificationRef", "A regisztrálandó felhasználó legmagasabb iskolai végzettsége nincs megadva."); if (entity.ReasonOfRegistration.Length == 0) throw new ArgumentNullException("RegisterOrganisation.ReasonOfRegistration", "Az adatbázis használatának célja nincs megadva."); // Logical checks UserService userService = new UserService(m_DataContext); if (userService.UserCheckLoginName(entity.LoginName)) throw new ApplicationException("A megadott bejelentkezési név már foglalt. Kérem válasszon másikat."); // Set properties entity.SentDate = DBDateTime.Now; entity.Status = RegistrationStatus.New; // Save data to database base.RegisterOrganisationInsert(entity); // Log success BusinessAuditEvent.Success( new EventParameter("RegisterOrganisationID", entity.ID.ToString()), new EventParameter("OrganisationName", entity.Name), new EventParameter("LoginName", entity.LoginName) ); TraceCallReturnEvent.Raise(); return; } catch (Exception ex) { ExceptionManager.Publish(ex); BusinessAuditEvent.Fail( new EventParameter("Exception", ex.ToString()), new EventParameter("RegisterOrganisationID", entity.ID.ToString()), new EventParameter("OrganisationName", entity.Name), new EventParameter("LoginName", entity.LoginName) ); TraceCallReturnEvent.Raise(false); throw; } }
// ------------------------------------------------------------------------------------- /// <summary> /// Copy constructor. /// </summary> /// <param name="origInstance">Original document data to copy.</param> // ------------------------------------------------------------------------------------- public RegisterOrganisation(RegisterOrganisation origInstance) : base(origInstance) { }
// ------------------------------------------------------------------------------------- /// <summary> /// Copy constructor. /// </summary> /// <param name="IDVal">Value of 'uID' field</param> /// <param name="origInstance">Original document data to copy.</param> // ------------------------------------------------------------------------------------- public RegisterOrganisation(DBGuid IDVal, RegisterOrganisation origInstance) : base(IDVal, origInstance) { }