Demand() public method

public Demand ( ) : void
return void
コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SetDefaultControls("btnGetRight", "");
              PrincipalPermission permReg = new PrincipalPermission(Context.User.Identity.Name, "Registered");
              permReg.Demand();

              if (!Page.IsPostBack)
              {
            IOrganisationService srvOrg = ServiceFactory.GetOrganisationService();

            //megnézzük hogy volt e szervezet kiválasztva (van e selectedOrgId)
            string selectedOrgId = Request["selectedOrgId"];

            if (selectedOrgId != null)
            {
              //lekérdezzük a kiválasztott szervezet adatait
              Organisation org = srvOrg.OrganisationSelect(new Guid(selectedOrgId));

              txtOrgInstitution.Text = org.Name;
              lblZipCode.Text = org.PostCode;
              lblTownShip.Text = org.City;
              lblAddress.Text = org.Address;

              lblOrganisationForm.Text = org.Department.IsNull ? "-" : org.Department.ToString();
            }
              }
        }
コード例 #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     // Put user code to initialize the page here
       // Check permission: all registered user
       PrincipalPermission perm = new PrincipalPermission(Context.User.Identity.Name, "Registered");
       perm.Demand();
 }
コード例 #3
0
        public new void EDocumentCommendationDelete(EDocumentCommendation entity)
        {
            // check permission: admin
              PrincipalPermission permAdmin = new PrincipalPermission(Thread.CurrentPrincipal.Identity.Name, "Administrator");
              permAdmin.Demand();

              TraceCallEnterEvent.Raise();
              try
              {
            base.EDocumentCommendationDelete(entity);

            BusinessAuditEvent.Success();
            TraceCallReturnEvent.Raise();
            return;
              }
              catch (Exception ex)
              {
            ExceptionManager.Publish(ex);
            BusinessAuditEvent.Fail(
              new EventParameter("Exception", ex.ToString())
              );
            TraceCallReturnEvent.Raise(false);
            throw;
              }
        }
コード例 #4
0
ファイル: RBSBase.cs プロジェクト: anytao/insidenet
 public static void OfficerMethod()
 {
     string name = "��";
     string role = "ʿ��";
     PrincipalPermission principalPermission = new PrincipalPermission(name, role);
     principalPermission.Demand();
 }
コード例 #5
0
        public new void NewsPictureDelete(NewsPicture entity)
        {
            // check permission: admin
              PrincipalPermission permAdmin = new PrincipalPermission(Thread.CurrentPrincipal.Identity.Name, "Administrator");
              permAdmin.Demand();

              TraceCallEnterEvent.Raise();
              try
              {
            FileDataContext fileDataContext = new FileDataContext();
            string ext = Path.GetExtension(entity.PictureUrl).ToLower();
            string fileName = entity.ID.ToString() + ext;
            fileDataContext.NewsPictureDelete(entity.NewsRef, fileName);
            base.NewsPictureDelete(entity);

            BusinessAuditEvent.Success();
            TraceCallReturnEvent.Raise();
            return;
              }
              catch (Exception ex)
              {
            ExceptionManager.Publish(ex);
            BusinessAuditEvent.Fail(
              new EventParameter("Exception", ex.ToString())
              );
            TraceCallReturnEvent.Raise(false);
            throw;
              }
        }
コード例 #6
0
ファイル: EmailService.cs プロジェクト: bmadarasz/ndihelpdesk
        public EmailContainer EmailSelectFiltered(Email filter)
        {
            // Check permission: admin
              PrincipalPermission permAdmin = new PrincipalPermission(Thread.CurrentPrincipal.Identity.Name, "Administrator");
              permAdmin.Demand();

              TraceCallEnterEvent.Raise();
              try
              {
            EmailContainer result;
            DataSet entitySet = m_DataContext.ndihdEmailSelectFiltered(
              filter.Category,
              filter.FilterOnSentFrom,
              filter.FilterOnSentTo,
              filter.FilterOnActivityPrevention,
              filter.FilterOnActivityResearch,
              filter.FilterOnActivityRehabilitation,
              filter.FilterOnActivityOther,
              filter.FilterOnNDI,
              filter.FilterOnActivityAll
              );
            result = new EmailContainer(entitySet.Tables[0]);
            TraceCallReturnEvent.Raise();
            return result;
              }
              catch (Exception ex)
              {
            ExceptionManager.Publish(ex);
            TraceCallReturnEvent.Raise(false);
            throw;
              }
        }
コード例 #7
0
        public new void ContinuativeDelete(Continuative entity)
        {
            //check permission: Admin
              PrincipalPermission permAdm = new PrincipalPermission(Thread.CurrentPrincipal.Identity.Name, "Administrator");
              permAdm.Demand();

              TraceCallEnterEvent.Raise();
              try
              {
            base.ContinuativeDelete(entity);

            BusinessAuditEvent.Success(
              new EventParameter("ContinuativeID", entity.ID)
              );
            TraceCallReturnEvent.Raise();
            return;
              }
              catch (Exception ex)
              {
            ExceptionManager.Publish(ex);
            BusinessAuditEvent.Fail(
              new EventParameter("Exception", ex.ToString()),
              new EventParameter("ContinuativeID", entity.ID));
            TraceCallReturnEvent.Raise(false);
            throw;
              }
        }
コード例 #8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     // Check permission: all registered user
       PrincipalPermission perm = new PrincipalPermission(Context.User.Identity.Name, "Registered");
       perm.Demand();
       if (!Page.IsPostBack)
       {
     ShowGrid(gridCompetition, 0, null, null);
       }
 }
コード例 #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SetDefaultControls("btnModify", "");
              // Check permission: all registered user
              PrincipalPermission perm = new PrincipalPermission(Context.User.Identity.Name, "Registered");
              perm.Demand();
              SetTitle(" - Felhasználói adatok");
              if (!Page.IsPostBack)
              {

            RetreivData();
              }
        }
コード例 #10
0
ファイル: Program.cs プロジェクト: oblivious/Oblivious
        static void Main(string[] args)
        {
            Console.WriteLine("\nWindows Identity");
            WindowsIdentity identity = WindowsIdentity.GetCurrent();
            Console.WriteLine("Authentication Type: " + identity.AuthenticationType);
            Console.WriteLine("Name: " + identity.Name);
            Console.WriteLine("Is System: " + identity.IsSystem);
            Console.WriteLine("Is Authenticated: " + identity.IsAuthenticated);
            Console.WriteLine("Owner Value: " + identity.Owner.Value);
            Console.WriteLine("User Value: " + identity.User.Value);
            Console.WriteLine("Token: " + identity.Token.ToString());
            Console.WriteLine("Groups:");
            IdentityReferenceCollection groups = identity.Groups;
            foreach (IdentityReference ir in groups)
            {
                Console.WriteLine(" - Value: " + ir.Value);
            }

            
            Console.WriteLine("\nWindows Principal");
            AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal);
            WindowsPrincipal principal = (WindowsPrincipal)Thread.CurrentPrincipal;
            Console.WriteLine("Identity Name: " + principal.Identity.Name);

            Console.WriteLine("\nUser Roles: ");
            Console.WriteLine("Administrator: " + principal.IsInRole(WindowsBuiltInRole.Administrator));
            Console.WriteLine("Power User: "******"User: "******"ToString: " + pp.ToString());
                pp.Demand();
                Console.WriteLine("Success!");
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }
            try
            {
                SuperDuperMethod();
            }
            catch (Exception e)
            {
                Console.WriteLine("Super Duper method threw a far out exception: " + e.ToString());
            }
        }
コード例 #11
0
ファイル: Program.cs プロジェクト: oblivious/Oblivious
		static void Main(string[] args)
		{
			try
			{
				AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal);
				/*
				string id1 = "Bob";
				string role1 = "Manager";
				PrincipalPermission principalPermission1 = new PrincipalPermission(id1, role1);

				PrincipalPermission principalPermission2 = new PrincipalPermission("Louise", "Supervisor");

				(principalPermission1.Union(principalPermission2)).Demand();
				*/

				WindowsPrincipal principal = (WindowsPrincipal)Thread.CurrentPrincipal;
				Console.WriteLine("Identity name: " + principal.Identity.Name);
				Console.WriteLine("Authentication type: " + principal.Identity.AuthenticationType);
				Console.WriteLine("IsInRole(\"administrators\"): " + principal.IsInRole("Administrators").ToString());

				Console.WriteLine("Checking that the current user is \"EZETOP\\dobyrne\" and that they are in the " + 
					"\"administrators\" group \\ role:");

				PrincipalPermission permission = new PrincipalPermission("EZETOP\\dobyrne", "administrators");
				permission.Demand();

				Console.WriteLine("Demand succeeded.");

				Console.WriteLine("\nChecking that the current user is in the \"administrators\" role. I know we did" + 
					" it already but it's on the page:");
				PrincipalPermission principalPerm = new PrincipalPermission(null, "Administrators");
				principalPerm.Demand();
				Console.WriteLine("Demand succeeded.");

				Console.WriteLine("\nPlease be sure to note that if either the \"name\" or \"role\" passed to a " +
					"PrincipalPermission constructor are null it means that any value is accepted.");

				Console.WriteLine("Checking if unrestricted: ");
				PrincipalPermission finalPerm = new PrincipalPermission(PermissionState.Unrestricted);
				finalPerm.Demand();
				Console.WriteLine("Demand succeeded, the current principal is unrestricted.");


			}
			catch (Exception e)
			{
				Console.WriteLine("Exception: " + e.ToString());
			}
		}
コード例 #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Context.User.Identity.IsAuthenticated)
              {
            PrincipalPermission permReg = new PrincipalPermission(Context.User.Identity.Name, "Registered");
            permReg.Demand();
              }

              if (!Page.IsPostBack)
              {
            SetSearchLabel();
            ShowForumGroupGrid(gridForumGroup, 0, null, null);
              }
              //SearchStrategyIFrame(lblSearch, lblIframe);
        }
        public Main()
        {
            InitializeComponent();
            Program.Project.Changed += new EventHandler<Library.ChangedEventArgs>(Project_Changed);
            this.InitUI();

            PrincipalPermission permission = new PrincipalPermission(null, "Administrators");
            try
            {
                permission.Demand();
            }
            catch (SecurityException ex)
            {
                this.envoyerToolStripMenuItem.Visible = false;
            }
        }
コード例 #14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SetDefaultControls("btnCreate", "txtName");
              PrincipalPermission permReg = new PrincipalPermission(Context.User.Identity.Name, "Registered");
              permReg.Demand();

              string orgId = Request["orgId"];
              if (orgId == null)
            throw new ApplicationException("Hiányzó kötelezõ paraméter: szervezet azonosító.");

              Guid orgGuid = new Guid(orgId);
              string writerRole = orgId + ".Writer";
              PrincipalPermission permWriter = new PrincipalPermission(Context.User.Identity.Name, writerRole);
              permWriter.Demand();

              txtDescription.Attributes.Add("onkeyup", "DescriptionChanged()");
        }
コード例 #15
0
ファイル: _Home.aspx.cs プロジェクト: bmadarasz/ndihelpdesk
        protected void Page_Load(object sender, EventArgs e)
        {
            // Check permission: all registered user
              PrincipalPermission perm = new PrincipalPermission(Context.User.Identity.Name, "Registered");
              perm.Demand();

              if (!Page.IsPostBack)
              {
            //a hírek dinamikus feltöltése
            INewsCategoryService srvNewsCateg = ServiceFactory.GetNewsCategoryService();
            NewsCategoryContainer categCont = srvNewsCateg.NewsCategorySelectAll();

            foreach (NewsCategory item in categCont.All.SortBy("Rank", true))
            {
              CreateControl(item.ID, item.Name);
            }
              }
        }
コード例 #16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // Check permission: datawriter
              PrincipalPermission permReg = new PrincipalPermission(Context.User.Identity.Name, "Registered");
              permReg.Demand();
              NdiPrincipal principal = (NdiPrincipal) Context.User;
              string writerRole = principal.OrganisationID + ".Writer";
              PrincipalPermission perm = new PrincipalPermission(Context.User.Identity.Name, writerRole);
              perm.Demand();

              string kefId = Request["kefId"];
              Guid kefGuid = new Guid(kefId);

              if (!Page.IsPostBack)
              {
             RetrieveData(kefGuid);
              }
        }
コード例 #17
0
        public void KefDownloadChangeRank(DBGuid uid1, DBGuid uid2, int rank1, int rank2)
        {
            //check permission: Admin
              PrincipalPermission permAdm = new PrincipalPermission(Thread.CurrentPrincipal.Identity.Name, "Administrator");
              permAdm.Demand();

              TraceCallEnterEvent.Raise();
              try
              {
            m_DataContext.ndihdKefDownloadChangeRank(uid1, uid2, rank1, rank2);
            TraceCallReturnEvent.Raise();
              }
              catch (Exception ex)
              {
            ExceptionManager.Publish(ex);
            TraceCallReturnEvent.Raise(false);
            throw;
              }
        }
コード例 #18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SetTitle(" - Szervezeteim");
              // Check permission: datawriter
              PrincipalPermission permReg = new PrincipalPermission(Context.User.Identity.Name, "Registered");
              permReg.Demand();
              NdiPrincipal principal = (NdiPrincipal)Context.User;
              string writerRole = principal.OrganisationID + ".Writer";
              PrincipalPermission perm = new PrincipalPermission(Context.User.Identity.Name, writerRole);
              perm.Demand();

              IUserService srvUser = ServiceFactory.GetUserService();
              OrganisationUserContainer contOrgUser = srvUser.SelectChildrenByUserOfOrganisationUser(principal.Identity.Name);
              //Ha csak egy szervezetem van, akkor egybõlannak az adatai látszanak
              if(contOrgUser.All.Count == 1)
              {
            Response.Redirect(string.Format("OrganisationData.aspx?orgID={0}",((OrganisationUser)contOrgUser.All.Items[0]).OrganisationRef.ToString()));
              }
              repOrganisation.DataSource = contOrgUser.All.Items;
              repOrganisation.DataBind();
        }
コード例 #19
0
        public void EDocumentCategoryActivate(EDocumentCategory entity)
        {
            //check permission: Admin
              PrincipalPermission permAdm = new PrincipalPermission(Thread.CurrentPrincipal.Identity.Name, "Administrator");
              permAdm.Demand();

              TraceCallEnterEvent.Raise();
              try
              {
            int maxRank = 0;

            EDocumentCategoryContainer cont = EDocumentCategorySelectAll();
            foreach (EDocumentCategory cat in cont.All)
            {
              if (cat.DocumentTypeRef == cat.DocumentTypeRef && cat.IsActive && cat.Rank > maxRank)
              {
            maxRank = cat.Rank;
              }
            }

            entity.IsActive = true;
            entity.Rank = maxRank + 1;
            base.EDocumentCategoryUpdate(entity);

            BusinessAuditEvent.Success(
              new EventParameter("EDocumentCategoryID", entity.ID)
              );
            TraceCallReturnEvent.Raise();
            return;
              }
              catch (Exception ex)
              {
            ExceptionManager.Publish(ex);
            BusinessAuditEvent.Fail(
              new EventParameter("Exception", ex.ToString()),
              new EventParameter("EDocumentCategoryID", entity.ID));
            TraceCallReturnEvent.Raise(false);
            throw;
              }
        }
コード例 #20
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Redirect("Default.aspx");
              SetTitle(" - Állásajánlatra jelentkezés módosítása");
              SetDefaultControls("btnModify", "txtMotivation");
              // Check permission: anybody can use this page
              PrincipalPermission permReg = new PrincipalPermission(Context.User.Identity.Name, "Registered");
              permReg.Demand();

              string jobId = Request["jobId"];
              m_sender = Request["sender"];
              m_subscriber = Request["subscriber"];

              if (jobId == null)
            throw new ApplicationException("Hiányzó kötelező paraméter: hirdetés azonosító.");
              if (m_sender == null)
            throw new ApplicationException("Hiányzó kötelező paraméter: hirdetés azonosító.");
              if (m_subscriber == null)
            throw new ApplicationException("Hiányzó kötelező paraméter: hirdetés azonosító.");

              if (!m_subscriber.Equals(Context.User.Identity.Name))
              {
            throw new SecurityException("Ez nem az ön jelentkezése. Nincs jogosultsága módosítani.");
              }

              m_srvJob = ServiceFactory.GetJobOfferService();
              m_JobId = new Guid(jobId);
              m_Job = m_srvJob.JobOfferSelect(m_JobId);
              m_JobAnswer = m_srvJobAnswer.JobAnswerSelect(m_JobId, JobAnswerTypeEnum.OFF, Context.User.Identity.Name, m_Job.Sender);
              if (!Page.IsPostBack)
              {
            RetreiveData();

            #region Egyéb dokumentumok grid feltöltése

            ShowAttachementGrid();

            #endregion
              }
        }
コード例 #21
0
        public new void ForumGroupInsert(ForumGroup entity)
        {
            // check permission: admin
              PrincipalPermission permAdmin = new PrincipalPermission(Thread.CurrentPrincipal.Identity.Name, "Administrator");
              permAdmin.Demand();

              TraceCallEnterEvent.Raise();
              try
              {
            // Check required fields
            if (entity.Name.Length == 0)
              throw new ArgumentNullException("ForumGroup.Name", "A a fórum téma neve nincs megadva.");

            // Logical checks
            ForumGroup selected = base.ForumGroupSelect(entity.ID);
            if (selected != null)
              throw new ApplicationException("A megadott azonosítóval már létezik fórum téma.");

            // Save data
            base.ForumGroupInsert(entity);

            BusinessAuditEvent.Success(
              new EventParameter("ForumGroupID", entity.ID.ToString()),
              new EventParameter("ForumGroupName", entity.Name)
              );
            TraceCallReturnEvent.Raise();
            return;
              }
              catch (Exception ex)
              {
            ExceptionManager.Publish(ex);
            BusinessAuditEvent.Fail(
              new EventParameter("Exception", ex.ToString()),
              new EventParameter("ForumGroupID", entity.ID.ToString()),
              new EventParameter("ForumGroupName", entity.Name)
              );
            TraceCallReturnEvent.Raise(false);
            throw;
              }
        }
コード例 #22
0
        public new void CompetitionInsert(Competition entity)
        {
            // Check permission: Admin
              PrincipalPermission permAdmin = new PrincipalPermission(Thread.CurrentPrincipal.Identity.Name, "Administrator");
              permAdmin.Demand();

              TraceCallEnterEvent.Raise();
              try
              {
            if (entity.ID.IsNull)
              throw new ArgumentNullException("Competition.ID", "A pályázat azonosítója nincs megadva.");
            if (entity.Name.Length == 0)
              throw new ArgumentNullException("Competition.Name", "A pályázat neve nincs megadva.");
            if (entity.Url.Length == 0)
              throw new ArgumentNullException("Competition.Url", "A pályázat linkje (Url) nincs megadva.");

            // Save data
            entity.CreatedDate = DBDateTime.Now;
            base.CompetitionInsert(entity);

            BusinessAuditEvent.Success(
              new EventParameter("CompetitionID", entity.ID),
              new EventParameter("CompetitionName", entity.Name)
              );

            TraceCallReturnEvent.Raise();
            return;
              }
              catch (Exception ex)
              {
            ExceptionManager.Publish(ex);
            BusinessAuditEvent.Fail(
              new EventParameter("Exception", ex.ToString()),
              new EventParameter("CompetitionID", entity.ID),
              new EventParameter("CompetitionName", entity.Name)
              );
            TraceCallReturnEvent.Raise(false);
            throw;
              }
        }
コード例 #23
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SetDefaultControls("btnSetPassword", "txtOrigPassword");
              // Check permission: registered
              PrincipalPermission perm = new PrincipalPermission(Context.User.Identity.Name, "Registered");
              perm.Demand();

              // Fill data:
              if (!Page.IsPostBack)
              {
            NdiPrincipal principal = (NdiPrincipal) Context.User;
            lblFullName.Text = principal.FullName;
            lblLoginName.Text = principal.Identity.Name;

            IUserService srv = ServiceFactory.GetUserService();
            User user = srv.UserSelect(principal.Identity.Name);
            txtPasswordQuestion.Text = user.PasswordQuestion;
            if (user.MustChangePassword)
            {
              lblMustChangePassword.Visible = true;
            }
              }
        }
コード例 #24
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SetDefaultControls("btnNewThread","");
              string groupId = Request["groupId"];
              if (groupId == null)
            throw new ApplicationException("Hiányzó kötelezõ paraméter: Fórum téma azonosító.");

              Guid groupGuid = new Guid(groupId);
              IForumGroupService groupSrv = ServiceFactory.GetForumGroupService();
              ForumGroup group = groupSrv.ForumGroupSelect(groupGuid);
              if (!group.VisibleForVisitor)
              {
            PrincipalPermission permReg = new PrincipalPermission(Context.User.Identity.Name, "Registered");
            permReg.Demand();
              }

              if (!Page.IsPostBack)
              {
            lblForumGroup.Text = group.Name;
            SetMainMenu(groupGuid);
            ShowForumThreadGrid(gridForumThread, 0, null, null, groupGuid);
              }
        }
コード例 #25
0
ファイル: Program.cs プロジェクト: oblivious/Oblivious
        static void Main(string[] args)
        {
            AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal);
            string r = System.Environment.MachineName + @"\VS Developers";

            try
            {
                PrincipalPermission p = new PrincipalPermission(null, r, true);
                p.Demand();

                Console.WriteLine("Access Allowed");
            }
            catch (Exception e)
            {
                Console.WriteLine("Access Denied: " + e.Message);
            }
            Console.ReadKey();

            List<GroupPrincipal> groupPrincipals = GetGroups(@"Amphion\Donal");
            foreach (GroupPrincipal gp in groupPrincipals)
            {
                Console.WriteLine(gp.DisplayName);
            }
        }
コード例 #26
0
 public EDocumentCategoryDispsetContainer EDocumentCategorySelectDispsetByType(string type)
 {
     //check permission: Admin
       PrincipalPermission permAdm = new PrincipalPermission(Thread.CurrentPrincipal.Identity.Name, "Administrator");
       permAdm.Demand();
       //check permission: Admin
       TraceCallEnterEvent.Raise();
       try
       {
     EDocumentCategoryDispsetContainer result;
     DataSet entitySet = m_DataContext.ndihdEDocumentCategorySelectDispsetByType(type);
     result = new EDocumentCategoryDispsetContainer(entitySet.Tables[0]);
     TraceCallReturnEvent.Raise();
     BusinessAuditEvent.Success();
     return result;
       }
       catch (Exception ex)
       {
     ExceptionManager.Publish(ex);
     BusinessAuditEvent.Fail();
     TraceCallReturnEvent.Raise(false);
     throw;
       }
 }
コード例 #27
0
        public void EDocumentCategoryInActivate(EDocumentCategory entity)
        {
            //check permission: Admin
              PrincipalPermission permAdm = new PrincipalPermission(Thread.CurrentPrincipal.Identity.Name, "Administrator");
              permAdm.Demand();

              TraceCallEnterEvent.Raise();
              try
              {
            //ellenõrizzük, hogy nem kapcsolódik-e aktív dokumentumhoz, mert ha igen, akkor nem engedjük inaktiválni
            EDocumentContainer documents = base.SelectChildrenByCategoryOfEDocument(entity.ID);
            foreach (EDocument doc in documents.All)
            {
              if (doc.IsActive)
              {
            throw new ApplicationException("A kategória nem inaktiválható,mert tartozik hozzá aktív dokumentum!");
              }
            }

            entity.IsActive = false;
            entity.Rank = -1;
            base.EDocumentCategoryUpdate(entity);

            BusinessAuditEvent.Success(
              new EventParameter("EDocumentCategoryID", entity.ID)
              );
            TraceCallReturnEvent.Raise();
            return;
              }
              catch (Exception ex)
              {
            ExceptionManager.Publish(ex);
            BusinessAuditEvent.Fail(
              new EventParameter("Exception", ex.ToString()),
              new EventParameter("EDocumentCategoryID", entity.ID));
            TraceCallReturnEvent.Raise(false);
            throw;
              }
        }
コード例 #28
0
        public bool OrganisationPendingUserAccept(Guid OrgPendingUseID, Guid OrganisationID, string LoginName,
                                              string RejectText)
        {
            //Check permission: Admin
              PrincipalPermission permissionAdm =
            new PrincipalPermission(Thread.CurrentPrincipal.Identity.Name, "Administrator");
              permissionAdm.Demand();

              TraceCallEnterEvent.Raise();
              try
              {
            // Check required fields
            if (OrgPendingUseID == Guid.Empty)
              throw new ArgumentNullException("OrganisationPendingUser.OrgPendingUseID",
                                          "A jóváhagyás azonosítója nincs megadva.");
            if (OrganisationID == Guid.Empty)
              throw new ArgumentNullException("OrganisationPendingUser.OrganisationRef",
                                          "A regisztrálandó szervezet azonosítója nincs megadva.");
            if (LoginName.Length == 0)
              throw new ArgumentNullException("OrganisationPendingUser.LoginNameRef",
                                          "A regisztrálandó felhasználó nincs megadva.");

            // Logical checks
            OrganisationPendingUser selected = base.OrganisationPendingUserSelect(OrgPendingUseID);
            if (selected == null)
              throw new ApplicationException("A megadott azonosítóval nem létezik regisztráció.");
            if (! selected.Status.Equals(RegistrationStatus.New))
              throw new ApplicationException("Csak új státuszú regisztráció bírálható el.");

            // Frissitjük a regisztráció adatait
            selected.SentDate = selected.SentDate;
            selected.DecidedBy = Thread.CurrentPrincipal.Identity.Name;
            selected.DecidedDate = DBDateTime.Now;
            selected.Status = RegistrationStatus.Accepted;
            selected.RejectComment = RejectText;

            //Emailben szereplõ adatok lekkérdezése
            string userEmail = "";
            string userFullName = "";
            string organisationName = "";
            OrganisationService srvOrg = new OrganisationService();
            UserService srvUser = new UserService();
            Organisation org = srvOrg.OrganisationSelect(OrganisationID);
            User u = srvUser.UserSelect(LoginName);

            userEmail = u.Email;
            userFullName = u.Name;
            organisationName = org.Name;

            //set mail:
            Email mail = new Email(Guid.NewGuid());
            mail.Category = EmailCategory.OrganisationPendingUserAccept;
            mail.To = userEmail;

            //Subject és body lekérdezése
            string body = "";
            string subject = "";
            IEmailTemplateService srvTemplate = new EmailTemplateService();
            srvTemplate.GetEmailTemplateByCode(ref subject, ref body, EmailCategory.OrganisationPendingUserAccept);

            mail.Subject = subject;

            body = body.Replace("<FULL_USER_NAME>", userFullName);
            body = body.Replace("<LOGIN_NAME>", LoginName);
            body = body.Replace("<ORGANISATION>", organisationName);
            mail.MailBody = body;

            // Save data to database
            EmailService emailSrv = new EmailService(m_DataContext);
            m_DataContext.BeginNestedTran();
            try
            {
              //eltároljuk a szervezet-felhasználó kapcsolatot
              OrganisationUserService orgUserSrv = new OrganisationUserService(m_DataContext);
              OrganisationUser orgUser = new OrganisationUser(OrganisationID, LoginName);
              orgUser.Right = selected.Right;
              orgUserSrv.OrganisationUserInsert(orgUser);

              base.OrganisationPendingUserUpdate(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("OrganisationPendingUser", OrgPendingUseID.ToString()),
              new EventParameter("OrganisationID", OrganisationID.ToString()),
              new EventParameter("LoginName", LoginName)
              );
            TraceCallReturnEvent.Raise();
            return true;
              }
              catch (Exception ex)
              {
            ExceptionManager.Publish(ex);
            BusinessAuditEvent.Fail(
              new EventParameter("OrganisationPendingUser", OrgPendingUseID.ToString()),
              new EventParameter("OrganisationID", OrganisationID.ToString()),
              new EventParameter("LoginName", LoginName)
              );
            TraceCallReturnEvent.Raise(false);
            throw;
              }
        }
コード例 #29
0
        public bool OrganisationPendingUserReject(OrganisationPendingUser 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("OrganisationPendingUser.RejectComment",
                                          "Az elutasítás indoklása nincs megadva.");

            // Logical checks
            OrganisationPendingUser selected = base.OrganisationPendingUserSelect(entity.ID);
            if (selected == null)
              throw new ApplicationException("A megadott azonosítóhoznemtartozik igénylés.");
            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;

            //Emailben szereplõ adatok lekkérdezése
            string userEmail = "";
            string userFullName = "";
            string organisationName = "";
            IOrganisationPendingUserService srvOpu = new OrganisationPendingUserService();
            OrganisationPendingUser opu = srvOpu.OrganisationPendingUserSelect(entity.ID);
            IOrganisationService srvOrg = new OrganisationService();
            IUserService srvUser = new UserService();
            Organisation org = srvOrg.OrganisationSelect(opu.OrganisationRef);
            User u = srvUser.UserSelect(opu.LoginNameRef);

            userEmail = u.Email;
            userFullName = u.Name;
            organisationName = org.Name;

            //set mail:
            Email mail = new Email(Guid.NewGuid());
            mail.Category = EmailCategory.OrganisationRegistrationReject;
            mail.To = 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>", userFullName);
            body = body.Replace("<LOGIN_NAME>", u.LoginName);
            body = body.Replace("<ORGANISATION>", organisationName);
            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.OrganisationPendingUserUpdate(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", organisationName),
              new EventParameter("LoginName", u.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;
              }
        }
コード例 #30
0
        public new void CompetitionUpdate(Competition entity)
        {
            // Check permission: Admin
              PrincipalPermission permAdmin = new PrincipalPermission(Thread.CurrentPrincipal.Identity.Name, "Administrator");
              permAdmin.Demand();

              TraceCallEnterEvent.Raise();
              try
              {
            // Check required fields:
            if (entity.Name.Length == 0)
              throw new ArgumentNullException("Competition.Name", "A pályázat neve nincs megadva.");
            if (entity.Url.Length == 0)
              throw new ArgumentNullException("Competition.Url", "A pályázat linkje (Url) nincs megadva.");

            // Logical checks
            Competition selected = base.CompetitionSelect(entity.ID);
            if (selected == null)
              throw new ApplicationException("A megadott azonosítóval nem létezik pályázat.");

            // Save data
            selected.Name = entity.Name;
            selected.Url = entity.Url;
            selected.Description = entity.Description;
            selected.IsVisible = entity.IsVisible;

            base.CompetitionUpdate(selected);

            BusinessAuditEvent.Success(
              new EventParameter("CompetitionID", entity.ID),
              new EventParameter("CompetitionName", entity.Name)
              );
            TraceCallReturnEvent.Raise();
            return;
              }
              catch (Exception ex)
              {
            ExceptionManager.Publish(ex);
            BusinessAuditEvent.Fail(
              new EventParameter("Exception", ex.ToString()),
              new EventParameter("CompetitionID", entity.ID),
              new EventParameter("CompetitionName", entity.Name)
              );
            TraceCallReturnEvent.Raise(false);
            throw;
              }
        }