/// <summary> /// Recupera os dados das permissões pela leitura de um xml. /// </summary> /// <param name="reader"></param> public void PermissionsFromXml(System.Xml.XmlReader reader) { var element = FromXml(reader); _permissions = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.None); _permissions.FromXml(element); }
private void LoadReport(string path, List <ViewMonthlyDataPer> _Employee) { this.ReportViewer1.KeepSessionAlive = false; this.ReportViewer1.AsyncRendering = false; string _Header = "Monthly Sheet Permanent Employees"; this.ReportViewer1.LocalReport.DisplayName = "Monthly Report"; string _Date = "Month: " + DateTo.Date.ToString("MMMM") + " , " + DateTo.Year.ToString(); ReportViewer1.ProcessingMode = ProcessingMode.Local; ReportViewer1.LocalReport.ReportPath = Server.MapPath(path); System.Security.PermissionSet sec = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.Unrestricted); ReportViewer1.LocalReport.SetBasePermissionsForSandboxAppDomain(sec); IEnumerable <ViewMonthlyDataPer> ie; ie = _Employee.AsQueryable(); ReportDataSource datasource1 = new ReportDataSource("DataSet1", ie); ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.DataSources.Add(datasource1); ReportParameter rp = new ReportParameter("Header", _Header, false); ReportParameter rp1 = new ReportParameter("Date", _Date, false); this.ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp, rp1 }); ReportViewer1.LocalReport.Refresh(); }
private void LoadReport(string path, List <ViewPresentEmp> _Employee) { string DateToFor = ""; if (DateFrom.Date.ToString("d") == DateTo.ToString("d")) { DateToFor = "Date : " + DateFrom.Date.ToString("dd-MMM-yyyy"); } else { DateToFor = "From : " + DateFrom.Date.ToString("dd-MMM-yyyy") + " To: " + DateTo.Date.ToString("dd-MMM-yyyy"); } string _Header = "Employee Detail Attendance Report"; this.ReportViewer1.LocalReport.DisplayName = "Attendance Detail Report"; ReportViewer1.ProcessingMode = ProcessingMode.Local; ReportViewer1.LocalReport.ReportPath = Server.MapPath(path); System.Security.PermissionSet sec = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.Unrestricted); ReportViewer1.LocalReport.SetBasePermissionsForSandboxAppDomain(sec); IEnumerable <ViewPresentEmp> ie; ie = _Employee.AsQueryable(); ReportDataSource datasource1 = new ReportDataSource("DataSet1", ie); ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.DataSources.Add(datasource1); ReportParameter rp = new ReportParameter("Date", DateToFor, false); ReportParameter rp1 = new ReportParameter("Header", _Header, false); this.ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp, rp1 }); ReportViewer1.LocalReport.Refresh(); }
internal static void Check() { var evi = new System.Security.Policy.Evidence(); evi.AddHostEvidence(new System.Security.Policy.Zone(System.Security.SecurityZone.Intranet)); var ps = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.None); ps.AddPermission(new System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityPermissionFlag.Assertion | System.Security.Permissions.SecurityPermissionFlag.Execution | System.Security.Permissions.SecurityPermissionFlag.BindingRedirects)); ps.AddPermission(new System.Security.Permissions.FileIOPermission(System.Security.Permissions.PermissionState.Unrestricted)); var domainSetup = new AppDomainSetup(); domainSetup.ApplicationBase = Environment.CurrentDirectory; var domain = AppDomain.CreateDomain("CrackCheck", evi, domainSetup, ps, null); try { string crackCheck = (string)domain.CreateInstanceFromAndUnwrap(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName, typeof(string).FullName); AppDomain.Unload(domain); } catch (Exception ex) { if (ex.Message.Equals("8013141a", StringComparison.OrdinalIgnoreCase)) { Console.Out.WriteError("对本应用的校验不合法,请从官方重新安装应用。"); System.Threading.Thread.Sleep(6000); Environment.Exit(0); } } }
static void Main(string[] args) { System.Security.Policy.Evidence evi = new System.Security.Policy.Evidence(); evi.AddHost(new System.Security.Policy.Zone(System.Security.SecurityZone.Intranet)); System.Security.PermissionSet ps = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.None); ps.AddPermission(new System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityPermissionFlag.Assertion | System.Security.Permissions.SecurityPermissionFlag.Execution | System.Security.Permissions.SecurityPermissionFlag.BindingRedirects)); ps.AddPermission(new System.Security.Permissions.FileIOPermission(System.Security.Permissions.PermissionState.Unrestricted)); AppDomainSetup ads = new AppDomainSetup(); ads.ApplicationBase = System.IO.Directory.GetCurrentDirectory(); AppDomain app = AppDomain.CreateDomain("check", evi, ads, ps, null); try { string check = (string)app.CreateInstanceFromAndUnwrap(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName, typeof(string).FullName); AppDomain.Unload(app); } catch (Exception e) { AppDomain.Unload(app); if (e.Message.Contains("8013141A") || e.Message.Contains("8013141a")) { MessageBox.Show("程序被修改过不允许执行!\r\nThe program has been modified to disallow execution!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Stop, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly, false); return; } } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1(args)); }
internal void FailoverCheck(SqlInternalConnection connection, bool actualUseFailoverPartner, SqlConnectionString userConnectionOptions, string actualFailoverPartner) { if (UseFailoverPartner != actualUseFailoverPartner) { // TODO: will connections in progress somehow be active for two different datasources? SqlClientEventSource.Log.TryTraceEvent("<sc.SqlConnectionPoolGroupProviderInfo|INFO> Failover detected. failover partner='{0}'. Clearing PoolGroup", actualFailoverPartner); base.PoolGroup.Clear(); _useFailoverPartner = actualUseFailoverPartner; } // Only construct a new permission set when we're connecting to the // primary data source, not the failover partner. if (!_useFailoverPartner && _failoverPartner != actualFailoverPartner) { // NOTE: we optimisitically generate the permission set to keep // lock short, but we only do this when we get a new // failover partner. // TODO: it seems to me that being optimistic here may not be such a good idea; what if there are 100s of concurrent failovers? System.Security.PermissionSet failoverPermissionSet = CreateFailoverPermission(userConnectionOptions, actualFailoverPartner); lock (this) { if (_failoverPartner != actualFailoverPartner) { _failoverPartner = actualFailoverPartner; _failoverPermissionSet = failoverPermissionSet; } } } }
internal void FailoverCheck(SqlInternalConnection connection, bool actualUseFailoverPartner, SqlConnectionString userConnectionOptions, string actualFailoverPartner) { if (UseFailoverPartner != actualUseFailoverPartner) { // Bid.Trace("<sc.SqlConnectionPoolGroupProviderInfo|INFO> Failover detected. failover partner='%ls'. Clearing PoolGroup\n", actualFailoverPartner); base.PoolGroup.Clear(); _useFailoverPartner = actualUseFailoverPartner; } // Only construct a new permission set when we're connecting to the // primary data source, not the failover partner. if (!_useFailoverPartner && _failoverPartner != actualFailoverPartner) { // NOTE: we optimisitically generate the permission set to keep // lock short, but we only do this when we get a new // failover partner. // System.Security.PermissionSet failoverPermissionSet = CreateFailoverPermission(userConnectionOptions, actualFailoverPartner); lock (this) { if (_failoverPartner != actualFailoverPartner) { _failoverPartner = actualFailoverPartner; _failoverPermissionSet = failoverPermissionSet; } } } }
// NOTE: This is just a private helper because OracleClient V1.1 shipped // with a different argument name and it's a breaking change to not use // the same argument names in V2.0 (VB Named Parameter Binding--Ick) private void EnlistDistributedTransactionHelper(System.EnterpriseServices.ITransaction transaction) { System.Security.PermissionSet permissionSet = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.None); permissionSet.AddPermission(SqlConnection.ExecutePermission); // MDAC 81476 permissionSet.AddPermission(new System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityPermissionFlag.UnmanagedCode)); permissionSet.Demand(); SqlClientEventSource.Log.TryTraceEvent("<prov.DbConnectionHelper.EnlistDistributedTransactionHelper|RES|TRAN> {0}, Connection enlisting in a transaction.", ObjectID); SysTx.Transaction indigoTransaction = null; if (null != transaction) { indigoTransaction = SysTx.TransactionInterop.GetTransactionFromDtcTransaction((SysTx.IDtcTransaction)transaction); } RepairInnerConnection(); // NOTE: since transaction enlistment involves round trips to the // server, we don't want to lock here, we'll handle the race conditions // elsewhere. InnerConnection.EnlistTransaction(indigoTransaction); // NOTE: If this outer connection were to be GC'd while we're // enlisting, the pooler would attempt to reclaim the inner connection // while we're attempting to enlist; not sure how likely that is but // we should consider a GC.KeepAlive(this) here. GC.KeepAlive(this); }
private void yesBtn_Click(object sender, EventArgs e) { try { XmlDocument xDoc = new XmlDocument(); //string sourceFilePath = string.Format("{0}{1}{2}{3}{4}{5}{6}", Environment.Is64BitOperatingSystem ? Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) : Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), System.IO.Path.DirectorySeparatorChar, "bLoyal", System.IO.Path.DirectorySeparatorChar, "Dinerware Integration", System.IO.Path.DirectorySeparatorChar, "DinerwareConfigurationFile.xml"); //if (!System.IO.File.Exists(sourceFilePath)) // sourceFilePath = string.Format("{0}{1}{2}{3}{4}{5}{6}", Environment.Is64BitOperatingSystem ? Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) : Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), System.IO.Path.DirectorySeparatorChar, "bLoyal", System.IO.Path.DirectorySeparatorChar, "Workstation", System.IO.Path.DirectorySeparatorChar, "DinerwareConfigurationFile.xml"); var configuration = new ConfigurationHelper(true); string sourceFilePath = configuration.GetFilePath(); xDoc.Load(@"" + sourceFilePath); xDoc.DocumentElement.SelectSingleNode("EnablebLoyal").InnerText = "true"; var permissionSet = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.None); var writePermission = new System.Security.Permissions.FileIOPermission(System.Security.Permissions.FileIOPermissionAccess.Write, @"" + sourceFilePath); permissionSet.AddPermission(writePermission); if (permissionSet.IsSubsetOf(AppDomain.CurrentDomain.PermissionSet)) { xDoc.Save(@"" + sourceFilePath); } } catch (Exception ex) { _logger.WriteLogError(ex, "yesBtn_Click"); this.Close(); } var config = ConfigurationHelper.NewInstance; // Update the Configuration Instance this.Close(); }
public static void StartADemo(AppWidgetFactory appWidgetFactory) { if (usedMainThread) { System.AppDomainSetup domainSetup = new AppDomainSetup(); domainSetup.ApplicationBase = "."; System.AppDomain newDomain = null; bool usePermissionTest = false; if (usePermissionTest) { System.Security.PermissionSet permissionSet = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.None); permissionSet.AddPermission(new System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityPermissionFlag.Execution)); permissionSet.AddPermission(new System.Security.Permissions.FileIOPermission(System.Security.Permissions.PermissionState.Unrestricted)); newDomain = System.AppDomain.CreateDomain(appWidgetFactory.GetAppParameters().title, null, domainSetup, permissionSet, null); } else { newDomain = System.AppDomain.CreateDomain(appWidgetFactory.GetAppParameters().title); } string[] args = { appWidgetFactory.GetAppParameters().title }; newDomain.ExecuteAssembly("./DemoRunner.exe", args); //System.AppDomain.Unload(newDomain); } else { usedMainThread = true; appWidgetFactory.CreateWidgetAndRunInWindow(); //appWidgetFactory.CreateWidgetAndRunInWindow(AppWidgetFactory.ValidDepthVaules.Depth32, AppWidgetFactory.RenderSurface.OpenGL); } }
public void SetBasePermissionsForSandboxAppDomain(System.Security.PermissionSet permissions) { if (permissions == null) { throw new ArgumentNullException("permissions"); } m_reportRuntimeSetupHandler.SetBasePermissionsForSandboxAppDomain(permissions); }
public static int Load([MarshalAs(UnmanagedType.LPWStr)] String inParam) { try { lock (_lock) { _injectCount++; if (_easyHookDomain == null) { System.Security.PermissionSet ps = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.Unrestricted); ps.AddPermission(new System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityPermissionFlag.AllFlags)); // Evidence of null means use the current appdomain evidence _easyHookDomain = AppDomain.CreateDomain("EasyHook", null, new AppDomainSetup() { ApplicationBase = Path.GetDirectoryName(typeof(Loader).Assembly.Location), // ShadowCopyFiles = "true", // copies assemblies from ApplicationBase into cache, leaving originals unlocked and updatable }, ps); } } int result = -1; // Load the EasyHook assembly in the child AppDomain by using the proxy class Type proxyType = typeof(LoadEasyHookProxy); if (proxyType.Assembly != null) { // This is where the currentDomain.AssemblyResolve that we setup within the static // constructor is required. var proxy = (LoadEasyHookProxy)_easyHookDomain.CreateInstanceFrom( proxyType.Assembly.Location, proxyType.FullName).Unwrap(); // Loads EasyHook.dll into the AppDomain, which in turn loads the target assembly result = proxy.Load(inParam); } //result = new LoadEasyHookProxy().Load(inParam); return(result); } catch (Exception e) { System.Diagnostics.Debug.WriteLine("Exception occured within Loader.Load: " + e.ToString()); } finally { lock (_lock) { _injectCount--; } } // Failed return(-1); }
public static int Load([MarshalAs(UnmanagedType.LPWStr)]String inParam) { try { lock (_lock) { _injectCount++; if (_easyHookDomain == null) { System.Security.PermissionSet ps = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.Unrestricted); ps.AddPermission(new System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityPermissionFlag.AllFlags)); // Evidence of null means use the current appdomain evidence _easyHookDomain = AppDomain.CreateDomain("EasyHook", null, new AppDomainSetup() { ApplicationBase = Path.GetDirectoryName(typeof(Loader).Assembly.Location), // ShadowCopyFiles = "true", // copies assemblies from ApplicationBase into cache, leaving originals unlocked and updatable }, ps); } } int result = -1; // Load the EasyHook assembly in the child AppDomain by using the proxy class Type proxyType = typeof(LoadEasyHookProxy); if (proxyType.Assembly != null) { // This is where the currentDomain.AssemblyResolve that we setup within the static // constructor is required. var proxy = (LoadEasyHookProxy)_easyHookDomain.CreateInstanceFrom( proxyType.Assembly.Location, proxyType.FullName).Unwrap(); // Loads EasyHook.dll into the AppDomain, which in turn loads the target assembly result = proxy.Load(inParam); } //result = new LoadEasyHookProxy().Load(inParam); return result; } catch (Exception e) { System.Diagnostics.Debug.WriteLine("Exception occured within Loader.Load: " + e.ToString()); } finally { lock (_lock) { _injectCount--; } } // Failed return -1; }
internal void FailoverPermissionDemand() { if (_useFailoverPartner) { // Note that we only demand when there is a permission set, which only // happens once we've identified a failover situation in FailoverCheck System.Security.PermissionSet failoverPermissionSet = _failoverPermissionSet; if (null != failoverPermissionSet) { // demand on pooled failover connections failoverPermissionSet.Demand(); } } }
/// <summary/> public static void Transform(System.Xaml.XamlReader reader, System.Xaml.XamlWriter writer, System.Xaml.Permissions.XamlAccessLevel accessLevel, bool requestReflectionPermission) { if (requestReflectionPermission) { System.Security.PermissionSet permissions = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.None); permissions.AddPermission(new System.Xaml.Permissions.XamlLoadPermission(accessLevel)); permissions.AddPermission(new System.Security.Permissions.ReflectionPermission(System.Security.Permissions.ReflectionPermissionFlag.RestrictedMemberAccess)); permissions.Assert(); } else { new System.Xaml.Permissions.XamlLoadPermission(accessLevel).Assert(); } System.Xaml.XamlServices.Transform(reader, writer); }
// ------------ Helper method --------------------------------------- static AppDomain GetInternetSandbox() { // Create the permission set to grant to all assemblies. System.Security.Policy.Evidence hostEvidence = new System.Security.Policy.Evidence(); hostEvidence.AddHostEvidence(new System.Security.Policy.Zone( System.Security.SecurityZone.Internet)); System.Security.PermissionSet pset = System.Security.SecurityManager.GetStandardSandbox(hostEvidence); // Identify the folder to use for the sandbox. AppDomainSetup ads = new AppDomainSetup(); ads.ApplicationBase = System.IO.Directory.GetCurrentDirectory(); // Create the sandboxed application domain. return(AppDomain.CreateDomain("Sandbox", hostEvidence, ads, pset, null)); }
private void LoadReport(string path, List<DailySummary> _Summary, string rptName) { string _Header = rptName; this.ReportViewer1.LocalReport.DisplayName = rptName; ReportViewer1.ProcessingMode = ProcessingMode.Local; ReportViewer1.LocalReport.ReportPath = Server.MapPath(path); System.Security.PermissionSet sec = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.Unrestricted); ReportViewer1.LocalReport.SetBasePermissionsForSandboxAppDomain(sec); ReportDataSource datasource1 = new ReportDataSource("DataSet1", _Summary); ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.DataSources.Add(datasource1); ReportParameter rp = new ReportParameter("CompanyName", "National Highway Authority", false); ReportParameter rp1 = new ReportParameter("Title", rptName, false); ReportParameter rp2 = new ReportParameter("Date", DateTo.ToString("dd-MMM-yyyy") + " to " + DateFrom.ToString("dd-MMM-yyyy"), false); this.ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp, rp1, rp2 }); ReportViewer1.LocalReport.Refresh(); }
//public DateTime DateFrom //{ // get // { // if (dateFrom.Value == "") // return DateTime.Today.Date.AddDays(-1); // else // return DateTime.Parse(dateFrom.Value); // } //} //public DateTime DateTo //{ // get // { // if (dateTo.Value == "") // return DateTime.Today.Date.AddDays(-1); // else // return DateTime.Parse(dateTo.Value); // } //} private void LoadReport(string path, DataTable _LvSummary) { string _Header = "Year wise Leaves Summary"; this.ReportViewer1.LocalReport.DisplayName = "Leave Summary Report"; ReportViewer1.ProcessingMode = ProcessingMode.Local; ReportViewer1.LocalReport.ReportPath = Server.MapPath(path); System.Security.PermissionSet sec = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.Unrestricted); ReportViewer1.LocalReport.SetBasePermissionsForSandboxAppDomain(sec); ReportDataSource datasource1 = new ReportDataSource("DataSet1", _LvSummary); ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.DataSources.Add(datasource1); ReportParameter rp = new ReportParameter("Header", _Header, false); this.ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp }); ReportViewer1.LocalReport.Refresh(); }
private void LoadReport(string PathString, List <DailySummary> _ViewListSum, string date, string title) { string _Header = title; this.ReportViewer1.LocalReport.DisplayName = title; ReportViewer1.ProcessingMode = ProcessingMode.Local; ReportViewer1.LocalReport.ReportPath = Server.MapPath(PathString); System.Security.PermissionSet sec = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.Unrestricted); ReportViewer1.LocalReport.SetBasePermissionsForSandboxAppDomain(sec); ReportDataSource datasource1 = new ReportDataSource("DataSet1", _ViewListSum); ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.DataSources.Add(datasource1); ReportParameter rp = new ReportParameter("CompanyName", "National Highway Authority", false); ReportParameter rp1 = new ReportParameter("Title", title, false); ReportParameter rp2 = new ReportParameter("Date", date, false); this.ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp, rp1, rp2 }); ReportViewer1.LocalReport.Refresh(); }
static void Main(string[] args) { // Thanks to https://blogs.msdn.microsoft.com/shawnfa/2009/06/08/more-implicit-uses-of-cas-policy-loadfromremotesources/ System.Security.PermissionSet trustedLoadFromRemoteSourceGrantSet = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.Unrestricted); AppDomainSetup trustedLoadFromRemoteSourcesSetup = new AppDomainSetup(); trustedLoadFromRemoteSourcesSetup.ApplicationBase = AppDomain.CurrentDomain.SetupInformation.ApplicationBase; AppDomain trustedRemoteLoadDomain = AppDomain.CreateDomain("Trusted LoadFromRemoteSources Domain", null, trustedLoadFromRemoteSourcesSetup, trustedLoadFromRemoteSourceGrantSet); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); MainWindow frm = new MainWindow(args); Application.Run(frm); }
//public DateTime DateFrom //{ // get // { // if (dateFrom.Value == "") // return DateTime.Today.Date.AddDays(-1); // else // return DateTime.Parse(dateFrom.Value); // } //} //public DateTime DateTo //{ // get // { // if (dateTo.Value == "") // return DateTime.Today.Date.AddDays(-1); // else // return DateTime.Parse(dateTo.Value); // } //} private void LoadReport(string path, List <ViewLvConsumed> _Employee) { string _Header = context.Options.FirstOrDefault().CompanyName + " - Anual Leave Report"; ReportViewer1.ProcessingMode = ProcessingMode.Local; ReportViewer1.LocalReport.ReportPath = Server.MapPath(path); System.Security.PermissionSet sec = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.Unrestricted); ReportViewer1.LocalReport.SetBasePermissionsForSandboxAppDomain(sec); IEnumerable <ViewLvConsumed> ie; ie = _Employee.AsQueryable(); ReportDataSource datasource1 = new ReportDataSource("DataSet1", ie); ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.DataSources.Add(datasource1); ReportParameter rp = new ReportParameter("Header", _Header, false); this.ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp }); ReportViewer1.LocalReport.Refresh(); }
//public DateTime DateFrom //{ // get // { // if (dateFrom.Value == "") // return DateTime.Today.Date.AddDays(-1); // else // return DateTime.Parse(dateFrom.Value); // } //} //public DateTime DateTo //{ // get // { // if (dateTo.Value == "") // return DateTime.Today.Date.AddDays(-1); // else // return DateTime.Parse(dateTo.Value); // } //} private void LoadReport(string path, List <EmpView> _Employee) { string _Header = "Employee Detailed Report (Excel Only)"; this.ReportViewer1.LocalReport.DisplayName = "Employee Detail Report"; ReportViewer1.ProcessingMode = ProcessingMode.Local; ReportViewer1.LocalReport.ReportPath = Server.MapPath(path); System.Security.PermissionSet sec = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.Unrestricted); ReportViewer1.LocalReport.SetBasePermissionsForSandboxAppDomain(sec); IEnumerable <EmpView> ie; ie = _Employee.AsQueryable(); ReportDataSource datasource1 = new ReportDataSource("DataSet1", ie); ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.DataSources.Add(datasource1); ReportParameter rp = new ReportParameter("Header", _Header, false); this.ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp }); ReportViewer1.LocalReport.Refresh(); }
private void LoadReport(string path, DataTable _LvSummary) { string _Header = "Monthly Sheet Contactual Employees"; string Date = DateTo.Date.ToString("dd-MMM-yyyy"); this.ReportViewer1.LocalReport.DisplayName = "Leave Balance Report"; string _Date = "Month: " + DateTo.Date.ToString("MMMM") + " , " + DateTo.Year.ToString(); ReportViewer1.ProcessingMode = ProcessingMode.Local; ReportViewer1.LocalReport.ReportPath = Server.MapPath(path); System.Security.PermissionSet sec = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.Unrestricted); ReportViewer1.LocalReport.SetBasePermissionsForSandboxAppDomain(sec); ReportDataSource datasource1 = new ReportDataSource("DataSet1", _LvSummary); ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.DataSources.Add(datasource1); ReportParameter rp = new ReportParameter("Header", _Header, false); ReportParameter rp1 = new ReportParameter("Date", Date, false); this.ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp, rp1 }); ReportViewer1.LocalReport.Refresh(); }
private void yesBtn_Click(object sender, EventArgs e) { try { XmlDocument xDoc = new XmlDocument(); string sourceFilePath = string.Format("{0}{1}{2}{3}{4}{5}{6}", Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), System.IO.Path.DirectorySeparatorChar, "bLoyal", System.IO.Path.DirectorySeparatorChar, "Dinerware Integration", System.IO.Path.DirectorySeparatorChar, "DinerwareConfigurationFile.xml"); xDoc.Load(@"" + sourceFilePath); xDoc.DocumentElement.SelectSingleNode("EnablebLoyal").InnerText = "true"; var permissionSet = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.None); string sourceFolderPath = string.Format("{0}{1}{2}{3}{4}", Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), System.IO.Path.DirectorySeparatorChar, "bLoyal", System.IO.Path.DirectorySeparatorChar, "Dinerware Integration"); var writePermission = new System.Security.Permissions.FileIOPermission(System.Security.Permissions.FileIOPermissionAccess.Write, @"" + sourceFolderPath); permissionSet.AddPermission(writePermission); if (permissionSet.IsSubsetOf(AppDomain.CurrentDomain.PermissionSet)) { xDoc.Save(@"" + sourceFilePath); } } catch (Exception ex) { } this.Close(); }
void CreateAppDomain() { System.AppDomainSetup pythonAppDomainSetup = new AppDomainSetup(); pythonAppDomainSetup.ApplicationBase = "."; bool usePermissionTest = false; if (usePermissionTest) { System.Security.PermissionSet permissionSet = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.None); permissionSet.AddPermission(new System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityPermissionFlag.Execution)); //permissionSet.AddPermission(new System.Security.Permissions.FileIOPermission(System.Security.Permissions.PermissionState.Unrestricted)); compilerAppDomain = System.AppDomain.CreateDomain("Python App Domain", null, pythonAppDomainSetup, permissionSet, null); } else { compilerAppDomain = System.AppDomain.CreateDomain("Python App Domain"); } Dictionary <string, object> options = new Dictionary <string, object>(); options["Debug"] = true; }
public static bool _ctor_System_Xml_XmlSecureResolver_System_Xml_XmlResolver_System_Security_PermissionSet( ) { //Parameters System.Xml.XmlResolver resolver = null; System.Security.PermissionSet permissionSet = null; //Exception Exception exception_Real = null; Exception exception_Intercepted = null; InterceptionMaintenance.disableInterception( ); try { returnValue_Real = System.Xml.XmlSecureResolver.ctor(resolver, permissionSet); } catch (Exception e) { exception_Real = e; } InterceptionMaintenance.enableInterception( ); try { returnValue_Intercepted = System.Xml.XmlSecureResolver.ctor(resolver, permissionSet); } catch (Exception e) { exception_Intercepted = e; } }
private void LoadReport(string PathString, List <DailySummary> list, string p) { string _Header = title; this.ReportViewer1.LocalReport.DisplayName = title; ReportViewer1.ProcessingMode = ProcessingMode.Local; ReportViewer1.LocalReport.ReportPath = Server.MapPath(PathString); System.Security.PermissionSet sec = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.Unrestricted); ReportViewer1.LocalReport.SetBasePermissionsForSandboxAppDomain(sec); IEnumerable <DailySummary> ie; ie = list.AsQueryable(); IEnumerable <DailySummary> companyImage; ReportDataSource datasource1 = new ReportDataSource("DataSet1", ie); ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.EnableExternalImages = true; ReportViewer1.LocalReport.DataSources.Add(datasource1); ReportParameter rp = new ReportParameter("Date", p, false); ReportParameter rp1 = new ReportParameter("Header", _Header, false); this.ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp1, rp }); ReportViewer1.LocalReport.Refresh(); }
private void LoadReport(string PathString, List<LEASOP> data, string p1, int p2) { string _Header = title; this.ReportViewer1.LocalReport.DisplayName = title; ReportViewer1.ProcessingMode = ProcessingMode.Local; ReportViewer1.LocalReport.ReportPath = Server.MapPath(PathString); System.Security.PermissionSet sec = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.Unrestricted); ReportViewer1.LocalReport.SetBasePermissionsForSandboxAppDomain(sec); IEnumerable<LEASOP> ie; ie = data.AsQueryable(); ReportDataSource datasource1 = new ReportDataSource("DataSet1", ie); ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.DataSources.Add(datasource1); ReportParameter rp = new ReportParameter("Header", _Header, false); ReportParameter rp1 = new ReportParameter("Date",p1, false); this.ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp1, rp }); ReportViewer1.LocalReport.Refresh(); }
protected System.Security.PermissionSet InstantiatePermissionAttributes() { System.Security.PermissionSet permissions = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.None); AttributeList permissionAttributes = this.PermissionAttributes; for(int i = 0, n = permissionAttributes == null ? 0 : permissionAttributes.Count; i < n; i++) { //^ assert permissionAttributes != null; object result = this.GetPermissionOrSetOfPermissionsFromAttribute(permissionAttributes[i]); if(result == null) continue; if(result is System.Security.PermissionSet) permissions = permissions.Union((System.Security.PermissionSet)result); else { System.Security.IPermission permission = result as System.Security.IPermission; if(permission == null) continue; permissions.AddPermission(permission); } } return permissions; }
private System.Security.IPermission CreatePermission(System.Security.Permissions.SecurityAttribute/*!*/ secAttr) { //This could execute partially trusted code, so set up a very restrictive execution environment System.Security.PermissionSet perm = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.None); //TODO: add permissions if the attribute is from a trusted assembly perm.PermitOnly(); try { return secAttr.CreatePermission(); } catch { } return null; }
public void AddDeclarativeSecurity(System.Security.Permissions.SecurityAction securityAction, System.Security.PermissionSet permissionSet) { this.ModuleBuilder.AddDeclarativeSecurity(token, securityAction, permissionSet); this.attribs |= TypeAttributes.HasSecurity; }
private void LoadReport(string path, List<ViewMonthlyDataPer> _Employee) { string _Header = "Monthly Summary for Permanent Employees"; this.ReportViewer1.LocalReport.DisplayName = "Monthly Summary Report"; string _Date = "Month: " + DateTo.Date.ToString("MMMM") + " , " + DateTo.Year.ToString(); ReportViewer1.ProcessingMode = ProcessingMode.Local; ReportViewer1.LocalReport.ReportPath = Server.MapPath(path); System.Security.PermissionSet sec = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.Unrestricted); ReportViewer1.LocalReport.SetBasePermissionsForSandboxAppDomain(sec); IEnumerable<ViewMonthlyDataPer> ie; ie = _Employee.AsQueryable(); ReportDataSource datasource1 = new ReportDataSource("DataSet1", ie); ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.DataSources.Add(datasource1); ReportParameter rp = new ReportParameter("Header", _Header, false); ReportParameter rp1 = new ReportParameter("Date", _Date, false); this.ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp, rp1 }); ReportViewer1.LocalReport.Refresh(); }
private void LoadReport(List<EmpMonthlyProductivityEntity> empe, string PathString, string _dateFrom, string _dateTo) { string Header = "Monthly Productivity Sheet"; this.ReportViewer1.LocalReport.DisplayName = "Monthly Productivity Sheet"; this.ReportViewer1.ProcessingMode = ProcessingMode.Local; string Month = Convert.ToDateTime(_dateFrom).Date.ToString("MMMM-yyyy"); Month = "For the Month of " + Month; this.ReportViewer1.LocalReport.ReportPath = Server.MapPath(PathString); System.Security.PermissionSet sec = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.Unrestricted); this.ReportViewer1.LocalReport.SetBasePermissionsForSandboxAppDomain(sec); IEnumerable<EmpMonthlyProductivityEntity> ie; ie = empe.AsQueryable(); IEnumerable<EmpPhoto> companyImage; companyImage = companyimage.AsQueryable(); ReportDataSource datasource1 = new ReportDataSource("DataSet2", companyImage); ReportDataSource datasource2 = new ReportDataSource("DataSet1", ie); this.ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.EnableExternalImages = true; this.ReportViewer1.LocalReport.DataSources.Add(datasource1); ReportViewer1.LocalReport.DataSources.Add(datasource2); ReportParameter rp = new ReportParameter("Date", Month, false); ReportParameter rp1 = new ReportParameter("Header", Header, false); this.ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp1, rp }); this.ReportViewer1.LocalReport.Refresh(); //this.ReportViewer1.LocalReport.DisplayName = title; //ReportViewer1.ProcessingMode = ProcessingMode.Local; //ReportViewer1.LocalReport.ReportPath = Server.MapPath(PathString); //System.Security.PermissionSet sec = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.Unrestricted); //ReportViewer1.LocalReport.SetBasePermissionsForSandboxAppDomain(sec); //IEnumerable<DailySummary> ie; //ie = list.AsQueryable(); //IEnumerable<EmpPhoto> companyImage; //companyImage = companyimage.AsQueryable(); //ReportDataSource datasource1 = new ReportDataSource("DataSet1", ie); //ReportDataSource datasource2 = new ReportDataSource("DataSet2", companyImage); //ReportViewer1.LocalReport.DataSources.Clear(); //ReportViewer1.LocalReport.EnableExternalImages = true; //ReportViewer1.LocalReport.DataSources.Add(datasource1); //ReportViewer1.LocalReport.DataSources.Add(datasource2); //ReportParameter rp = new ReportParameter("Date", p, false); //ReportParameter rp1 = new ReportParameter("Header", Header, false); //this.ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp1, rp }); //ReportViewer1.LocalReport.Refresh(); }
private void LoadReport(string path, List<ViewLvApplication> _Employee, string date) { string _Header = title; this.ReportViewer1.LocalReport.DisplayName = title; ReportViewer1.ProcessingMode = ProcessingMode.Local; ReportViewer1.LocalReport.ReportPath = Server.MapPath(path); System.Security.PermissionSet sec = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.Unrestricted); ReportViewer1.LocalReport.SetBasePermissionsForSandboxAppDomain(sec); IEnumerable<ViewLvApplication> ie; ie = _Employee.AsQueryable(); ReportDataSource datasource1 = new ReportDataSource("DataSet1", ie); ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.DataSources.Add(datasource1); ReportParameter rp = new ReportParameter("Header", _Header, false); this.ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp }); ReportViewer1.LocalReport.Refresh(); }
private void LoadReport(string path, DataTable _LvSummary) { string _Header = "Year wise Leaves Summary"; this.ReportViewer1.LocalReport.DisplayName = "Leave Summary Report"; ReportViewer1.ProcessingMode = ProcessingMode.Local; ReportViewer1.LocalReport.ReportPath = Server.MapPath(path); System.Security.PermissionSet sec = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.Unrestricted); ReportViewer1.LocalReport.SetBasePermissionsForSandboxAppDomain(sec); ReportDataSource datasource1 = new ReportDataSource("DataSet1", _LvSummary); ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.DataSources.Add(datasource1); ReportParameter rp = new ReportParameter("Header", _Header, false); this.ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp }); ReportViewer1.LocalReport.Refresh(); }
private void LoadReport(string path, List<ViewAttData> _Employee) { string DateToFor = ""; if (DateFrom.Date.ToString("d") == DateTo.ToString("d")) { DateToFor = "Date : " + DateFrom.Date.ToString("d"); } else { DateToFor = "From : " + DateFrom.Date.ToString("d") + " To: " + DateTo.Date.ToString("d"); } string _Header = "Overtime Report"; this.ReportViewer1.LocalReport.DisplayName = "OverTime Report"; ReportViewer1.ProcessingMode = ProcessingMode.Local; ReportViewer1.LocalReport.ReportPath = Server.MapPath(path); System.Security.PermissionSet sec = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.Unrestricted); ReportViewer1.LocalReport.SetBasePermissionsForSandboxAppDomain(sec); IEnumerable<ViewAttData> ie; ie = _Employee.AsQueryable(); ReportDataSource datasource1 = new ReportDataSource("DataSet1", ie); ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.DataSources.Add(datasource1); ReportParameter rp = new ReportParameter("Date", DateToFor, false); ReportParameter rp1 = new ReportParameter("Header", _Header, false); this.ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp, rp1 }); ReportViewer1.LocalReport.Refresh(); }
private void LoadReport(string path, List<ViewAttData> _Employee, string date) { string _Header = title; this.ReportViewer1.LocalReport.DisplayName = title; ReportViewer1.ProcessingMode = ProcessingMode.Local; ReportViewer1.LocalReport.ReportPath = Server.MapPath(path); System.Security.PermissionSet sec = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.Unrestricted); ReportViewer1.LocalReport.SetBasePermissionsForSandboxAppDomain(sec); IEnumerable<ViewAttData> ie; ie = _Employee.AsQueryable(); IEnumerable<EmpPhoto> companyImage; companyImage = companyimage.AsQueryable(); ReportViewer1.LocalReport.DataSources.Clear(); ReportDataSource datasource1 = new ReportDataSource("DataSet1", ie); ReportDataSource datasource2 = new ReportDataSource("DataSet2", companyImage); ReportViewer1.HyperlinkTarget = "_blank"; ReportViewer1.LocalReport.DataSources.Add(datasource1); ReportViewer1.LocalReport.DataSources.Add(datasource2); ReportParameter rp = new ReportParameter("Date", date, false); ReportParameter rp1 = new ReportParameter("Header", _Header, false); this.ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp, rp1 }); ReportViewer1.LocalReport.Refresh(); }
private void LoadReport(string PathString, List<TASReportDataSet.SummarizedMonthlyReportDataTable> VMLD, string p) { string _Header = title; this.ReportViewer1.LocalReport.DisplayName = title; ReportViewer1.ProcessingMode = ProcessingMode.Local; ReportViewer1.LocalReport.ReportPath = Server.MapPath(PathString); System.Security.PermissionSet sec = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.Unrestricted); ReportViewer1.LocalReport.SetBasePermissionsForSandboxAppDomain(sec); IEnumerable<TASReportDataSet.SummarizedMonthlyReportDataTable> ie; ie = VMLD.AsQueryable(); IEnumerable<EmpPhoto> companyImage; companyImage = companyimage.AsQueryable(); ReportDataSource datasource1 = new ReportDataSource("DataSet1", ie); ReportDataSource datasource2 = new ReportDataSource("DataSet2", companyImage); ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.EnableExternalImages = true; ReportViewer1.LocalReport.DataSources.Add(datasource1); ReportViewer1.LocalReport.DataSources.Add(datasource2); this.ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { }); ReportViewer1.LocalReport.Refresh(); }
private void LoadReport(string PathString, List<ViewServiceLog> _ViewServiceLog, string date, string title) { string _Header = title; this.ReportViewer1.LocalReport.DisplayName = title; ReportViewer1.ProcessingMode = ProcessingMode.Local; ReportViewer1.LocalReport.ReportPath = Server.MapPath(PathString); System.Security.PermissionSet sec = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.Unrestricted); ReportViewer1.LocalReport.SetBasePermissionsForSandboxAppDomain(sec); ReportDataSource datasource1 = new ReportDataSource("DataSet1", _ViewServiceLog); ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.DataSources.Add(datasource1); ReportParameter rp = new ReportParameter("CompanyName", "National Highway Authority", false); ReportParameter rp1 = new ReportParameter("Title", title, false); ReportParameter rp2 = new ReportParameter("Date", date, false); this.ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp, rp1, rp2 }); ReportViewer1.LocalReport.Refresh(); }
private System.Security.PermissionSet GetPermissionSet(ISecurityAttribute securityAttribute) { var result = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.None); foreach (var attribute in securityAttribute.Attributes) { var permission = this.GetPermission(securityAttribute.Action, attribute); if (permission == null) continue; //not a trusted permission result.AddPermission(permission); } return result; }
private void LoadReport(string PathString, List<AttDeptSummary> AttDept, string date) { string _Header = title; this.ReportViewer1.LocalReport.DisplayName = title; ReportViewer1.ProcessingMode = ProcessingMode.Local; ReportViewer1.LocalReport.ReportPath = Server.MapPath(PathString); System.Security.PermissionSet sec = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.Unrestricted); ReportViewer1.LocalReport.SetBasePermissionsForSandboxAppDomain(sec); IEnumerable<AttDeptSummary> ie; ie = AttDept.AsQueryable(); IEnumerable<EmpPhoto> companyImage; companyImage = companyimage.AsQueryable(); ReportDataSource datasource1 = new ReportDataSource("DataSet1", ie); ReportDataSource datasource2 = new ReportDataSource("DataSet2", companyImage); ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.EnableExternalImages = true; ReportViewer1.LocalReport.DataSources.Add(datasource1); ReportViewer1.LocalReport.DataSources.Add(datasource2); ReportParameter rp = new ReportParameter("Date", date, false); ReportParameter rp1 = new ReportParameter("Title", _Header, false); this.ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp, rp1 }); ReportViewer1.LocalReport.Refresh(); }
string GetFullNameFromProfile() { string FullName = string.Empty; try { System.Security.PermissionSet ps = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.Unrestricted); ps.Assert(); Microsoft.SharePoint.SPServiceContext serviceContext = Microsoft.SharePoint.SPServiceContext.Current; UserProfileManager upm = new Microsoft.Office.Server.UserProfiles.UserProfileManager(serviceContext); ProfileSubtypePropertyManager pspm = upm.DefaultProfileSubtypeProperties; UserProfile profile = upm.GetUserProfile(true); FullName = profile["FirstName"].Value + " " + profile["LastName"].Value; } catch (Exception) { } return FullName; }
private void LoadReport(string path, DataTable _LvSummary, int i) { string _Header = "Monthly Leaves Sheet"; //string Date = Convert.ToDateTime(_dateFrom).Date.ToString("dd-MMM-yyyy"); this.ReportViewer1.LocalReport.DisplayName = "Leave Balance Report"; string Date = "Month: " + Convert.ToDateTime(_dateFrom).Date.ToString("MMMM"); ReportViewer1.ProcessingMode = ProcessingMode.Local; ReportViewer1.LocalReport.ReportPath = Server.MapPath(path); System.Security.PermissionSet sec = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.Unrestricted); ReportViewer1.LocalReport.SetBasePermissionsForSandboxAppDomain(sec); ReportDataSource datasource1 = new ReportDataSource("DataSet1", _LvSummary); ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.HyperlinkTarget = "_blank"; IEnumerable<EmpPhoto> companyImage; companyImage = companyimage.AsQueryable(); ReportDataSource datasource2 = new ReportDataSource("DataSet2", companyImage); ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.EnableExternalImages = true; ReportViewer1.LocalReport.DataSources.Add(datasource1); ReportViewer1.LocalReport.DataSources.Add(datasource2); ReportParameter rp = new ReportParameter("Header", _Header, false); ReportParameter rp1 = new ReportParameter("Date", Date, false); this.ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp, rp1 }); ReportViewer1.LocalReport.Refresh(); }
private void DisplayProfile() { try { System.Security.PermissionSet ps = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.Unrestricted); ps.Assert(); Microsoft.SharePoint.SPServiceContext serviceContext = Microsoft.SharePoint.SPServiceContext.Current; UserProfileManager upm = new Microsoft.Office.Server.UserProfiles.UserProfileManager(serviceContext); ProfileSubtypePropertyManager pspm = upm.DefaultProfileSubtypeProperties; UserProfile profile = upm.GetUserProfile(true); //_accountName); this.Controls.Add(new Literal() { Text = "<table border='0' > <tr><td>Displayname</td><td>Value</td></tr>" }); string[] props = { "UserName", "FirstName", "LastName", "WorkEmail", "Department" }; foreach (string prop in props) { string text = string.Format("<tr><td>{0}</td><td>{1}</td></tr>", profile[prop].ProfileSubtypeProperty.DisplayName, profile[prop].Value); this.Controls.Add(new Literal() { Text = text }); } string txtEdit = "<tr><td colspan='2'>"; btnEdit = new Button() { Text = "Edit" }; this.Controls.Add(new Literal() { Text = txtEdit }); this.Controls.Add(btnEdit); this.Controls.Add(new Literal() { Text = "</td></tr>" }); btnEdit.Click += new EventHandler(btnEdit_Click); /* foreach (ProfileSubtypeProperty prop in pspm.PropertiesWithSection) { if (prop.IsSection) this.Controls.Add(new Literal() { Text = string.Format("<tr><td colspan='3'><b>Section: {0}</b></td></tr>", prop.DisplayName) }); else { string text = string.Format("<tr><td>{0}</td><td>{1}</td><td>{2}</td></tr>", prop.DisplayName, prop.Name, profile[prop.Name].Value); this.Controls.Add(new Literal() { Text = text }); } }*/ this.Controls.Add(new Literal() { Text = "</table>" }); } catch (Exception ex) { this.Controls.Add(new Literal() { Text = ex.ToString() }); } finally { System.Security.CodeAccessPermission.RevertAssert(); } }
public bool IsSubsetOf(System.Security.PermissionSet target) { return(false); }
void CreateAppDomain() { System.AppDomainSetup pythonAppDomainSetup = new AppDomainSetup(); pythonAppDomainSetup.ApplicationBase = "."; bool usePermissionTest = false; if (usePermissionTest) { System.Security.PermissionSet permissionSet = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.None); permissionSet.AddPermission(new System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityPermissionFlag.Execution)); //permissionSet.AddPermission(new System.Security.Permissions.FileIOPermission(System.Security.Permissions.PermissionState.Unrestricted)); compilerAppDomain = System.AppDomain.CreateDomain("Python App Domain", null, pythonAppDomainSetup, permissionSet, null); } else { compilerAppDomain = System.AppDomain.CreateDomain("Python App Domain"); } Dictionary<string, object> options = new Dictionary<string, object>(); options["Debug"] = true; }
private void LoadReport(string path, DataTable _LvSummary,int i) { string _Header = "Monthly Sheet Contactual Employees"; string Date = Convert.ToDateTime(_dateFrom).Date.ToString("dd-MMM-yyyy"); this.ReportViewer1.LocalReport.DisplayName = "Leave Balance Report"; string _Date = "Month: " + Convert.ToDateTime(_dateFrom).Date.ToString("MMMM") + " , " + Convert.ToDateTime(_dateFrom).Year.ToString(); ReportViewer1.ProcessingMode = ProcessingMode.Local; ReportViewer1.LocalReport.ReportPath = Server.MapPath(path); System.Security.PermissionSet sec = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.Unrestricted); ReportViewer1.LocalReport.SetBasePermissionsForSandboxAppDomain(sec); ReportDataSource datasource1 = new ReportDataSource("DataSet1", _LvSummary); ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.DataSources.Add(datasource1); ReportParameter rp = new ReportParameter("Header", _Header, false); ReportParameter rp1 = new ReportParameter("Date", Date, false); this.ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp, rp1 }); ReportViewer1.LocalReport.Refresh(); }
internal void DemandPermission() { if (null == _permissionset) { _permissionset = CreatePermissionSet(); } _permissionset.Demand(); }
public void AddDeclarativeSecurity(System.Security.Permissions.SecurityAction action, System.Security.PermissionSet pset) { }
//public DateTime DateFrom //{ // get // { // if (dateFrom.Value == "") // return DateTime.Today.Date.AddDays(-1); // else // return DateTime.Parse(dateFrom.Value); // } //} //public DateTime DateTo //{ // get // { // if (dateTo.Value == "") // return DateTime.Today.Date.AddDays(-1); // else // return DateTime.Parse(dateTo.Value); // } //} private void LoadReport(string path, List<ViewLvConsumed> _Employee) { string _Header = context.Options.FirstOrDefault().CompanyName + " - Anual Leave Report"; ReportViewer1.ProcessingMode = ProcessingMode.Local; ReportViewer1.LocalReport.ReportPath = Server.MapPath(path); System.Security.PermissionSet sec = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.Unrestricted); ReportViewer1.LocalReport.SetBasePermissionsForSandboxAppDomain(sec); IEnumerable<ViewLvConsumed> ie; ie = _Employee.AsQueryable(); ReportDataSource datasource1 = new ReportDataSource("DataSet1", ie); ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.DataSources.Add(datasource1); ReportParameter rp = new ReportParameter("Header", _Header, false); this.ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp }); ReportViewer1.LocalReport.Refresh(); }
public static int Load([MarshalAs(UnmanagedType.LPWStr)]String inParam) { try { lock (_lock) { try { _injectCount++; if (_easyHookDomain == null) { System.Security.PermissionSet ps = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.Unrestricted); ps.AddPermission(new System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityPermissionFlag.AllFlags)); // Evidence of null means use the current appdomain evidence _easyHookDomain = AppDomain.CreateDomain("EasyHook", null, new AppDomainSetup() { ApplicationBase = Path.GetDirectoryName(typeof(Loader).Assembly.Location), // ShadowCopyFiles = "true", // copies assemblies from ApplicationBase into cache, leaving originals unlocked and updatable }, ps); } } catch (OutOfMemoryException ome) { // Creation of AppDomain failed, so fall back to using default domain (means it cannot be unloaded) // The reason is there could be an issue with the target application's stack commit size. // The default stack commit size must be <= 253952 (or 0x3E000) - due to bug in .NET Framework, // this can be checked with dumpbin.exe and edited with editbin.exe. // Load EasyHook and the target assembly LoadEasyHookProxy lp = new LoadEasyHookProxy(); lp.Load(inParam); return 1; } } int result = -1; // Load the EasyHook assembly in the child AppDomain by using the proxy class Type proxyType = typeof(LoadEasyHookProxy); if (proxyType.Assembly != null) { // This is where the currentDomain.AssemblyResolve that we setup within the static // constructor is required. var proxy = (LoadEasyHookProxy)_easyHookDomain.CreateInstanceFrom( proxyType.Assembly.Location, proxyType.FullName).Unwrap(); // Loads EasyHook.dll into the AppDomain, which in turn loads the target assembly result = proxy.Load(inParam); } //result = new LoadEasyHookProxy().Load(inParam); return result; } catch (Exception e) { System.Diagnostics.Debug.WriteLine("Exception occurred within Loader.Load: " + e.ToString()); } finally { lock (_lock) { _injectCount--; } } // Failed return -1; }
// NOTE: This is just a private helper because OracleClient V1.1 shipped // with a different argument name and it's a breaking change to not use // the same argument names in V2.0 (VB Named Parameter Binding--Ick) private void EnlistDistributedTransactionHelper(System.EnterpriseServices.ITransaction transaction) { System.Security.PermissionSet permissionSet = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.None); permissionSet.AddPermission(CONNECTIONOBJECTNAME.ExecutePermission); // MDAC 81476 permissionSet.AddPermission(new System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityPermissionFlag.UnmanagedCode)); permissionSet.Demand(); Bid.Trace( "<prov.DbConnectionHelper.EnlistDistributedTransactionHelper|RES|TRAN> %d#, Connection enlisting in a transaction.\n", ObjectID); SysTx.Transaction indigoTransaction = null; if (null != transaction) { indigoTransaction = SysTx.TransactionInterop.GetTransactionFromDtcTransaction((SysTx.IDtcTransaction)transaction); } RepairInnerConnection(); // NOTE: since transaction enlistment involves round trips to the // server, we don't want to lock here, we'll handle the race conditions // elsewhere. InnerConnection.EnlistTransaction(indigoTransaction); // NOTE: If this outer connection were to be GC'd while we're // enlisting, the pooler would attempt to reclaim the inner connection // while we're attempting to enlist; not sure how likely that is but // we should consider a GC.KeepAlive(this) here. GC.KeepAlive(this); }
public System.Security.NamedPermissionSet ChangeNamedPermissionSet(string name, System.Security.PermissionSet pSet) { return(default(System.Security.NamedPermissionSet)); }
private void LoadReportLateIn(string path, List<ViewAttData> _Employee, string date) { List<ViewAttData> attData = new List<ViewAttData>(); foreach (var item in _Employee) { TimeSpan dtLateIn = new TimeSpan(); dtLateIn = new TimeSpan(09, 0, 0); if (item.TimeIn.Value.TimeOfDay > dtLateIn || item.WorkMin<480) { attData.Add(item); } } string _Header = title; this.ReportViewer1.LocalReport.DisplayName = title; ReportViewer1.ProcessingMode = ProcessingMode.Local; ReportViewer1.LocalReport.ReportPath = Server.MapPath(path); System.Security.PermissionSet sec = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.Unrestricted); ReportViewer1.LocalReport.SetBasePermissionsForSandboxAppDomain(sec); IEnumerable<ViewAttData> ie; ie = attData.AsQueryable(); ReportDataSource datasource1 = new ReportDataSource("DataSet1", ie); ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.DataSources.Add(datasource1); ReportParameter rp = new ReportParameter("Date", date, false); ReportParameter rp1 = new ReportParameter("Header", _Header, false); this.ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp, rp1 }); ReportViewer1.LocalReport.Refresh(); }
[System.Security.SecuritySafeCritical] // auto-generated private static EraInfo[] GetErasFromRegistry() { // Look in the registry key and see if we can find any ranges int iFoundEras = 0; EraInfo[] registryEraRanges = null; #if !MONO try { // Need to access registry PermissionSet permSet = new PermissionSet(PermissionState.None); permSet.AddPermission(new RegistryPermission(RegistryPermissionAccess.Read, c_japaneseErasHivePermissionList)); permSet.Assert(); RegistryKey key = RegistryKey.GetBaseKey(RegistryKey.HKEY_LOCAL_MACHINE).OpenSubKey(c_japaneseErasHive, false); // Abort if we didn't find anything if (key == null) return null; // Look up the values in our reg key String[] valueNames = key.GetValueNames(); if (valueNames != null && valueNames.Length > 0) { registryEraRanges = new EraInfo[valueNames.Length]; // Loop through the registry and read in all the values for (int i = 0; i < valueNames.Length; i++) { // See if the era is a valid date EraInfo era = GetEraFromValue(valueNames[i], key.GetValue(valueNames[i]).ToString()); // continue if not valid if (era == null) continue; // Remember we found one. registryEraRanges[iFoundEras] = era; iFoundEras++; } } } catch (System.Security.SecurityException) { // If we weren't allowed to read, then just ignore the error return null; } catch (System.IO.IOException) { // If key is being deleted just ignore the error return null; } catch (System.UnauthorizedAccessException) { // Registry access rights permissions, just ignore the error return null; } // // If we didn't have valid eras, then fail // should have at least 4 eras // if (iFoundEras < 4) return null; // // Now we have eras, clean them up. // // Clean up array length Array.Resize(ref registryEraRanges, iFoundEras); // Sort them Array.Sort(registryEraRanges, CompareEraRanges); // Clean up era information for (int i = 0; i < registryEraRanges.Length; i++) { // eras count backwards from length to 1 (and are 1 based indexes into string arrays) registryEraRanges[i].era = registryEraRanges.Length - i; // update max era year if (i == 0) { // First range is 'til the end of the calendar registryEraRanges[0].maxEraYear = GregorianCalendar.MaxYear - registryEraRanges[0].yearOffset; } else { // Rest are until the next era (remember most recent era is first in array) registryEraRanges[i].maxEraYear = registryEraRanges[i-1].yearOffset + 1 - registryEraRanges[i].yearOffset; } } #endif // Return our ranges return registryEraRanges; }
private void LoadReport(string PathString, List<VMPosting> list, string title, string date) { string _Header = "Posting Record"; string Date = Convert.ToDateTime(_dateFrom).Date.ToString("dd-MMM-yyyy"); this.ReportViewer1.LocalReport.DisplayName = PathString; ReportViewer1.ProcessingMode = ProcessingMode.Local; ReportViewer1.LocalReport.ReportPath = Server.MapPath(PathString); System.Security.PermissionSet sec = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.Unrestricted); ReportViewer1.LocalReport.SetBasePermissionsForSandboxAppDomain(sec); IEnumerable<VMPosting> ie; ie = list.AsQueryable(); ReportDataSource datasource1 = new ReportDataSource("DataSet1", ie); ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.DataSources.Add(datasource1); ReportParameter rp = new ReportParameter("Header", _Header, false); ReportParameter rp1 = new ReportParameter("Date", Date, false); this.ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp, rp1 }); ReportViewer1.LocalReport.Refresh(); }
internal void FailoverCheck(SqlInternalConnection connection, bool actualUseFailoverPartner, SqlConnectionString userConnectionOptions, string actualFailoverPartner) { if (UseFailoverPartner != actualUseFailoverPartner) { // Bid.Trace("<sc.SqlConnectionPoolGroupProviderInfo|INFO> Failover detected. failover partner='%ls'. Clearing PoolGroup\n", actualFailoverPartner); base.PoolGroup.Clear(); _useFailoverPartner = actualUseFailoverPartner; } // Only construct a new permission set when we're connecting to the // primary data source, not the failover partner. if (!_useFailoverPartner && _failoverPartner != actualFailoverPartner) { // NOTE: we optimisitically generate the permission set to keep // lock short, but we only do this when we get a new // failover partner. // System.Security.PermissionSet failoverPermissionSet = CreateFailoverPermission(userConnectionOptions, actualFailoverPartner); lock (this) { if (_failoverPartner != actualFailoverPartner) { _failoverPartner = actualFailoverPartner; _failoverPermissionSet = failoverPermissionSet; } } } }
private void LoadReport(string path, List<DailySummary> _Summary,string rptName) { string _Header = rptName; this.ReportViewer1.LocalReport.DisplayName = rptName; ReportViewer1.ProcessingMode = ProcessingMode.Local; ReportViewer1.LocalReport.ReportPath = Server.MapPath(path); System.Security.PermissionSet sec = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.Unrestricted); ReportViewer1.LocalReport.SetBasePermissionsForSandboxAppDomain(sec); ReportDataSource datasource1 = new ReportDataSource("DataSet1", _Summary); ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.DataSources.Add(datasource1); ReportParameter rp = new ReportParameter("CompanyName", "National Highway Authority", false); ReportParameter rp1 = new ReportParameter("Title", rptName, false); ReportParameter rp2 = new ReportParameter("Date", DateTo.ToString("dd-MMM-yyyy") + " to " + DateFrom.ToString("dd-MMM-yyyy"), false); this.ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp,rp1,rp2 }); ReportViewer1.LocalReport.Refresh(); }