public BrowserSender(HttpListenerContext context) { Context = context; Request = context.Request; Response = context.Response; User = context.User; }
public HsmEventHolder(QEventManagerBase eventManager, IQHsm hsm, IQEvent ev) { _EventManager = eventManager; _Hsm = hsm; _Event = ev; _Principal = System.Threading.Thread.CurrentPrincipal; }
public CapturedHttpContext(System.Web.HttpContext httpContext) { Url = httpContext.Request.Url; UrlReferrer = httpContext.Request.UrlReferrer; User = httpContext.User; HttpMethod = httpContext.Request.HttpMethod; Headers = new System.Collections.Specialized.NameValueCollection(httpContext.Request.Headers); }
public void Setup() { _mockContainer = new Data.Mocks.MockContainer(); _teamRepo = new Continuum.Data.TeamRepo(_mockContainer); var identity = new System.Security.Principal.GenericIdentity("*****@*****.**"); _currentUser = new System.Security.Principal.GenericPrincipal(identity, new string[] { }); WebApi.Controllers.UserController.CurrentUser = _currentUser; _controller = new WebApi.Controllers.UserController(_teamRepo); _controller.User = _currentUser; }
public static AccountType UserAccountType(System.Security.Principal.IPrincipal principal) { if (principal.Identity.IsAuthenticated) { var roles = GetRoles(principal); if (roles.Contains(Definitions.Account.Roles.Administrator)) { return(AccountType.Administrator); } if (roles.Contains(Definitions.Account.Roles.Consumer)) { return(AccountType.Consumer); } if (roles.Contains(Definitions.Account.Roles.Provider)) { return(AccountType.Provider); } } return(AccountType.None); }
public long m_lngCheckHasStorage(System.Security.Principal.IPrincipal p_objPrincipal, string p_strMedicineID, string p_strStorageID, out bool p_blnHasDetail, out long p_lngSeriesID) { p_lngSeriesID = 0; p_blnHasDetail = false; long lngRes = 0; if (string.IsNullOrEmpty(p_strMedicineID) || string.IsNullOrEmpty(p_strStorageID)) { return(-1); } try { string strSQL = @"select seriesid_int from t_ds_storage where medicineid_chr = ? and drugstoreid_chr = ?"; clsHRPTableService objHRPServ = new clsHRPTableService(); IDataParameter[] objDPArr = null; objHRPServ.CreateDatabaseParameter(2, out objDPArr); objDPArr[0].Value = p_strMedicineID; objDPArr[1].Value = p_strStorageID; DataTable dtbValue = null; lngRes = objHRPServ.lngGetDataTableWithParameters(strSQL, ref dtbValue, objDPArr); objHRPServ.Dispose(); objHRPServ = null; if (dtbValue != null && dtbValue.Rows.Count > 0) { p_blnHasDetail = true; p_lngSeriesID = Convert.ToInt64(dtbValue.Rows[0][0]); } } catch (Exception objEx) { com.digitalwave.Utility.clsLogText objLogger = new com.digitalwave.Utility.clsLogText(); bool blnRes = objLogger.LogError(objEx); } return(lngRes); }
public long m_lngDeleteCheckItemCustomOrder(System.Security.Principal.IPrincipal p_objPrincipal, string p_strCheckItemID) { long lngRes = 0; clsPrivilegeHandleService objPrivilege = new clsPrivilegeHandleService(); lngRes = objPrivilege.m_lngCheckCallPrivilege(p_objPrincipal, strClassName, "m_lngDeleteCheckItemCustomOrder"); if (lngRes <= 0) { return(lngRes); } string strSQL = null; clsHRPTableService objHRPSvc = null; try { strSQL = @"delete t_bse_lis_check_item_cutomorde t where t.check_item_id_chr = ?"; IDataParameter[] objDPArr = null; objHRPSvc = new clsHRPTableService(); objHRPSvc.CreateDatabaseParameter(1, out objDPArr); objDPArr[0].Value = p_strCheckItemID; long lngEff = 0; lngRes = objHRPSvc.lngExecuteParameterSQL(strSQL, ref lngEff, objDPArr); } catch (Exception objEx) { clsLogText objLogger = new clsLogText(); objLogger.LogDetailError(objEx, true); } finally { strSQL = null; objPrivilege = null; objHRPSvc = null; } return(lngRes); }
public long m_lngGetCheckMedicineOrder(System.Security.Principal.IPrincipal p_objPrincipal, string p_strStorageID, string p_strStoragePackID, out DataTable p_dtbData) { p_dtbData = null; long lngRes = 0; try { string strSQL = @"select t.checkmedicineorder_chr, t.medicineid_chr, t.storagerackid_chr, t.storageid_chr, a.assistcode_chr, a.medicinename_vchr, a.medspec_vchr, a.opunit_chr from t_ms_checkmedicineorder t inner join t_bse_medicine a on t.medicineid_chr = a.medicineid_chr where t.storageid_chr = ? and t.storagerackid_chr = ? order by checkmedicineorder_chr"; clsHRPTableService objHRPServ = new clsHRPTableService(); IDataParameter[] objDPArr = null; objHRPServ.CreateDatabaseParameter(2, out objDPArr); objDPArr[0].Value = p_strStorageID; objDPArr[1].Value = p_strStoragePackID; lngRes = objHRPServ.lngGetDataTableWithParameters(strSQL, ref p_dtbData, objDPArr); } catch (Exception objEx) { com.digitalwave.Utility.clsLogText objLogger = new com.digitalwave.Utility.clsLogText(); bool blnRes = objLogger.LogError(objEx); } return(lngRes); }
public long m_lngGetSpecialRemarkID(System.Security.Principal.IPrincipal p_objPrincipal, ref string m_strSpecialRemarkID) { long m_lngRes = -1; clsPrivilegeHandleService objPrivilege = new clsPrivilegeHandleService(); m_lngRes = objPrivilege.m_lngCheckCallPrivilege(p_objPrincipal, "com.digitalwave.iCare.middletier.BIHOrderServer.clsSpecialRemarkDicService", "m_lngGetSpecialRemarkID"); if (m_lngRes < 0) { return(-1); } string m_strSQL = @"SELECT MAX (TO_NUMBER (a.remarkid_chr)) + 1 AS maxid FROM t_bse_bih_specremark a"; try { DataTable m_objTable = new DataTable(); com.digitalwave.iCare.middletier.HRPService.clsHRPTableService m_objHRP = new clsHRPTableService(); m_lngRes = m_objHRP.lngGetDataTableWithoutParameters(m_strSQL, ref m_objTable); if (m_lngRes > 0) { m_strSpecialRemarkID = m_objTable.Rows[0][0].ToString().Trim(); if (m_strSpecialRemarkID == string.Empty) { m_strSpecialRemarkID = "0000001"; } } } catch (Exception ex) { string strTmp = ex.Message; com.digitalwave.Utility.clsLogText objLogger = new clsLogText(); bool blnRes = objLogger.LogError(ex); } return(m_lngRes); }
protected void DoFactory(System.Security.Principal.IPrincipal pi) { System.Threading.Thread.CurrentPrincipal = pi; WebRuntime.Current = this; if ((this.Response.ClientEvent & WebEvent.Error) == WebEvent.Error) { return; } if (String.IsNullOrEmpty(UMC.Security.AccessToken.Get("Debug"))) { try { DoFactory(); } catch (UMC.Web.WebAbortException) { } catch (Exception ex) { this.Response.ClientEvent = WebEvent.Error; this.Response.Headers["Error"] = ex.Message; UMC.Data.Utility.Error("POS", DateTime.Now, this.Request.Url.AbsoluteUri, ex.ToString()); } } else { try { DoFactory(); } catch (UMC.Web.WebAbortException) { } } }
/// <summary> /// 判断用户是否满足一定的规则(按照实际规则) /// </summary> /// <param name="ruleExpression">规则</param> /// <returns></returns> public static bool AuthorizeByRule(string ruleExpression, System.Security.Principal.IPrincipal principal = null) { if (string.IsNullOrEmpty(ruleExpression)) { return(false); } if (principal == null) { principal = System.Threading.Thread.CurrentPrincipal; } //if (m_isDevelopers) // return true; string key = "Authority.AuthorizeByRule:" + ruleExpression; return(Cache.TryGetCache <bool>(key, new Func <bool>(delegate() { if (ruleExpression.ToUpper() == "TRUE") { return true; } if (ruleExpression.ToUpper() == "FALSE") { return false; } ruleExpression = ruleExpression.Replace("or", "OR").Replace("and", "AND").Replace("not", "NOT"); Parser parser = new Parser(); BooleanExpression booleanExpression = parser.Parse(ruleExpression); if (booleanExpression == null) { throw new InvalidOperationException("Invalid rule format " + ruleExpression); } bool result = booleanExpression.Evaluate(principal); return result; }))); }
public long m_lngFind(System.Security.Principal.IPrincipal p_objPrincipal, int p_intSeq, out clsLisCheckMethodVO p_objCheckMethod) { long lngRes = 0; p_objCheckMethod = null; clsPrivilegeHandleService objPrivilege = new clsPrivilegeHandleService(); lngRes = objPrivilege.m_lngCheckCallPrivilege(p_objPrincipal, "com.digitalwave.iCare.middletier.LIS.clsTmdCheckMethodSvc", "m_lngFind"); if (lngRes <= 0) { return(-1); } com.digitalwave.iCare.middletier.HRPService.clsHRPTableService objHRPSvc = new clsHRPTableService(); string strSQL = @"SELECT * FROM T_BSE_LIS_CHECKMETHOD WHERE METHOD_SEQ_INT = ?"; try { System.Data.IDataParameter[] objODPArr = clsPublicSvc.m_objConstructIDataParameterArr( p_intSeq); DataTable dtbResult = null; lngRes = 0; lngRes = objHRPSvc.lngGetDataTableWithParameters(strSQL, ref dtbResult, objODPArr); objHRPSvc.Dispose(); if (lngRes == 1 && dtbResult != null && dtbResult.Rows.Count > 0) { p_objCheckMethod = new clsLisCheckMethodVO(); this.ConstructVO(dtbResult.Rows[0], ref p_objCheckMethod); } } catch (Exception objEx) { new clsLogText().LogError(objEx); } return(lngRes); }
public long m_lngChargeMnothReport(System.Security.Principal.IPrincipal p_objPrincipal, string finddate, string finddateLast, out System.Data.DataTable p_tabReport) { string strSQL; p_tabReport = new DataTable(); long lngRes = 0; //权限类 clsPrivilegeHandleService objPrivilege = new clsPrivilegeHandleService(); //检查是否有使用些函数的权限 lngRes = objPrivilege.m_lngCheckCallPrivilege(p_objPrincipal, "com.digitalwave.iCare.middletier.HIS.clsReckoningReport", "m_lngChargeMnothReport"); if (lngRes < 0) //没有使用的权限 { return(-1); } strSQL = "select t1.*,t2.LASTNAME_VCHR as strTemp1 " + " FROM t_opr_outpatientrecipeinv t1, t_bse_employee t2 " + " WHERE t1.opremp_chr = t2.empid_chr " + " AND t1.RECORDDATE_DAT BETWEEN TO_DATE('" + finddate + "','yyyy-mm-dd hh24:mi:ss') " + " AND TO_DATE('" + finddateLast + " 23:59:59','yyyy-mm-dd hh24:mi:ss')" + " order by t1.OPREMP_CHR "; try { com.digitalwave.iCare.middletier.HRPService.clsHRPTableService objHRPSvc = new clsHRPTableService(); lngRes = objHRPSvc.lngGetDataTableWithoutParameters(strSQL, ref p_tabReport); objHRPSvc.Dispose(); } catch (Exception objEx) { com.digitalwave.Utility.clsLogText objLogger = new clsLogText(); bool blnRes = objLogger.LogError(objEx); } return(lngRes); }
public long m_lngGetAllPropertyId(System.Security.Principal.IPrincipal p_objPrincipal, out string[] p_strResultArr) { p_strResultArr = null; long lngRes = 0; // clsPrivilegeHandleService objPrivilege = new clsPrivilegeHandleService(); // lngRes = objPrivilege.m_lngCheckCallPrivilege(p_objPrincipal,"com.digitalwave.iCare.middletier.LIS.clsLisDeviceSvc","m_lngGetAllPropertyId"); // if(lngRes < 0) // { // return -1; // } string strSQL = @"SELECT * FROM t_aid_lis_unit_property WHERE inuse_flag_num = 1 ORDER BY property_priority_num"; try { DataTable dtbResult = new DataTable(); com.digitalwave.iCare.middletier.HRPService.clsHRPTableService objHRPSvc = new clsHRPTableService(); lngRes = objHRPSvc.lngGetDataTableWithoutParameters(strSQL, ref dtbResult); if (lngRes > 0 && dtbResult.Rows.Count > 0) { p_strResultArr = new string[dtbResult.Rows.Count]; for (int i1 = 0; i1 < p_strResultArr.Length; i1++) { p_strResultArr[i1] = dtbResult.Rows[i1]["PROPERTY_ID_CHR"].ToString(); } } } catch (Exception objEx) { string strTmp = objEx.Message; com.digitalwave.Utility.clsLogText objLogger = new clsLogText(); bool blnRes = objLogger.LogError(objEx); } return(lngRes); }
public long m_lngGetReportGroupVOByReportGroupID(System.Security.Principal.IPrincipal p_objPrincipal, string p_strReportGroupID, out clsReportGroup_VO p_objResultVO) { long lngRes = 0; p_objResultVO = null; clsPrivilegeHandleService objPrivilege = new clsPrivilegeHandleService(); lngRes = objPrivilege.m_lngCheckCallPrivilege(p_objPrincipal, "com.digitalwave.iCare.middletier.LIS.clsReportGroupSvc", "m_lngGetReportGroupVOByReportGroupID"); if (lngRes < 0) { return(-1); } string strSQL = @"SELECT * FROM T_AID_LIS_REPORT_GROUP WHERE report_group_id_chr = '" + p_strReportGroupID + "'"; DataTable dtbResult = new DataTable(); try { com.digitalwave.iCare.middletier.HRPService.clsHRPTableService objHRPSvc = new clsHRPTableService(); lngRes = objHRPSvc.lngGetDataTableWithoutParameters(strSQL, ref dtbResult); objHRPSvc.Dispose(); if (lngRes > 0 && dtbResult.Rows.Count > 0) { p_objResultVO = new clsReportGroup_VO(); ConstructReportGroupVO(dtbResult.Rows[0], ref p_objResultVO); } } catch (Exception objEx) { com.digitalwave.Utility.clsLogText objLogger = new clsLogText(); bool blnRes = objLogger.LogError(objEx); //要在LogError方法中抛出异常。 } return(lngRes); }
public long m_lngSaveStorageShelf(System.Security.Principal.IPrincipal p_objPrincipal, DataTable p_dtbModify) { long lngRes = 0; try { string strSQL = @"update t_ms_storage a set a.storagerackid_chr = ? where a.seriesid_int = ?"; clsHRPTableService objHRPServ = new clsHRPTableService(); DbType[] dbTypes = new DbType[] { DbType.String, DbType.Int64 }; object[][] objValues = new object[2][]; int intItemCount = p_dtbModify.Rows.Count; for (int j = 0; j < objValues.Length; j++) { objValues[j] = new object[intItemCount];//初始化 } for (int i1 = 0; i1 < p_dtbModify.Rows.Count; i1++) { objValues[0][i1] = Convert.ToString(p_dtbModify.Rows[i1]["storagerackid_chr"]); objValues[1][i1] = Convert.ToInt64(p_dtbModify.Rows[i1]["seriesid_int"]); } lngRes = objHRPServ.m_lngSaveArrayWithParameters(strSQL, objValues, dbTypes); objHRPServ.Dispose(); objHRPServ = null; } catch (Exception objEx) { com.digitalwave.Utility.clsLogText objLogger = new com.digitalwave.Utility.clsLogText(); bool blnRes = objLogger.LogError(objEx); } return(lngRes); }
public static IHtmlString KIndexLabelLink(this HtmlHelper htmlHelper, string ico, string style, bool showNone = false, int?rok = null, bool linkToKindex = false) { if (string.IsNullOrEmpty(ico)) { return(htmlHelper.Raw("")); } ico = HlidacStatu.Util.ParseTools.NormalizeIco(ico); System.Security.Principal.IPrincipal user = htmlHelper.ViewContext.RequestContext.HttpContext.User; if (ShowKIndex(user)) { var kidx = Lib.Analysis.KorupcniRiziko.KIndex.Get(ico); if (kidx == null) { kidx = Lib.Analysis.KorupcniRiziko.KIndexData.Empty(ico); } var ann = kidx.ForYear(rok ?? Lib.Analysis.KorupcniRiziko.Consts.CalculationYears.Max()); Lib.Analysis.KorupcniRiziko.KIndexData.KIndexLabelValues lbl = ann.KIndexLabel; return(htmlHelper.KIndexLabelLink(ico, lbl, style, showNone, rok, linkToKindex: linkToKindex)); } return(htmlHelper.Raw("")); }
protected override bool UserAuthorized(System.Security.Principal.IPrincipal user) { if (user == null) { throw new ArgumentException("Invalid User"); } var principal = user as ClaimsPrincipal; if (principal == null) { return(false); } Claim authenticated = principal.FindFirst(ClaimTypes.Authentication); if (authenticated == null && !authenticated.Value.Equals("true")) { return(false); } return(true); }
public long m_lngGetAllMedicine(System.Security.Principal.IPrincipal p_objPrincipal, string p_strStorageID, out DataTable p_dtbMedicine) { p_dtbMedicine = null; long lngRes = -1; try { string strSQL = @"select t.medicineid_chr,t.assistcode_chr, t.medicinename_vchr, t.medspec_vchr, t.opunit_chr from t_bse_medicine t where t.assistcode_chr like ? and exists (select r.medicineroomid from t_ms_medicinestoreroomset r where r.medicinetypeid_chr = t.medicinetypeid_chr and r.medicineroomid = ?) order by t.assistcode_chr"; clsHRPTableService objHRPServ = new clsHRPTableService(); IDataParameter[] objDPArr = null; objHRPServ.CreateDatabaseParameter(2, out objDPArr); //objDPArr[0].Value = p_strStorageID; objDPArr[0].Value = "%"; objDPArr[1].Value = p_strStorageID; lngRes = objHRPServ.lngGetDataTableWithParameters(strSQL, ref p_dtbMedicine, objDPArr); // p_dtbMedicine = m_dtbGetMedicineWithoutLastCheckZero(p_objPrincipal, p_strStorageID, p_dtbMedicine); } catch (Exception objEx) { com.digitalwave.Utility.clsLogText objLogger = new com.digitalwave.Utility.clsLogText(); bool blnRes = objLogger.LogError(objEx); } return(lngRes); }
public long m_lngDoAddNewCookMethod(System.Security.Principal.IPrincipal p_objPrincipal, string p_strName, string p_strMNemonic, out string p_strID) { long lngRes = 0; p_strID = ""; //权限类 clsPrivilegeHandleService objPrivilege = new clsPrivilegeHandleService(); //检查是否有使用些函数的权限 lngRes = objPrivilege.m_lngCheckCallPrivilege(p_objPrincipal, "com.digitalwave.iCare.middletier.HIS.clsRegTypeSvc", "m_lngDoAddNewCookMethod"); if (lngRes < 0) //没有使用的权限 { return(-1); } com.digitalwave.iCare.middletier.HRPService.clsHRPTableService objHRPSvc = new clsHRPTableService(); //返回一最大的计划号 lngRes = objHRPSvc.lngGenerateID(4, "COOKINGMETHODID_CHR", "T_AID_CMCOOKINGMETHOD", out p_strID); if (lngRes < 0) { return(-1); } string strSQL = "INSERT INTO T_AID_CMCOOKINGMETHOD (COOKINGMETHODID_CHR, COOKINGMETHODNAME_VCHR, MNEMONIC_CHR) VALUES " + " ('" + p_strID + "' , '" + p_strName + "', '" + p_strMNemonic + "')"; try { lngRes = objHRPSvc.DoExcute(strSQL); objHRPSvc.Dispose(); } catch (Exception objEx) { com.digitalwave.Utility.clsLogText objLogger = new clsLogText(); bool blnRes = objLogger.LogError(objEx); } return(lngRes); }
public static ManageAcctContent ObtainManageAcctContent(System.Security.Principal.IPrincipal User, UmbracoHelper Umbraco, IPublishedContent ipCurrentPg) { //Instantiate variables Models.ManageAcctContent PgContent = new ManageAcctContent(); PgContent.Inactive = "inactive"; if (!User.Identity.IsAuthenticated) { //Redirect to login page. PgContent.Redirect = true; PgContent.RedirectTo = Umbraco.TypedContent((int)(Models.Common.siteNode.Login)).Url; } else if (ipCurrentPg.DocumentTypeAlias == Common.docType.ManageAccount) { PgContent.Redirect = true; PgContent.RedirectTo = ipCurrentPg.Children.First().Url; } else { //Instantiate variables. IPublishedContent ipHome = Umbraco.TypedContent((int)(Common.siteNode.Home)); PgContent.CredentialsUrl = Umbraco.TypedContent((int)(Models.Common.siteNode.EditAccount)).Url; PgContent.IlluminationStoryUrl = Umbraco.TypedContent((int)(Models.Common.siteNode.AddEditIlluminationStory)).Url; //Make fields active if Illumination has occured. if (ipHome.GetPropertyValue <Boolean>(Common.NodeProperties.activateIlluminationControls) == true) { PgContent.Inactive = string.Empty; } } PgContent.IsManageAcctPg = (ipCurrentPg.DocumentTypeAlias == Common.docType.ManageAccount); return(PgContent); }
bool Init(System.Security.Principal.IPrincipal CurrentUser) { if (!CurrentUser.Identity.IsAuthenticated) { return(false); } var identity = (ClaimsIdentity)CurrentUser.Identity; IEnumerable <Claim> claims = identity.Claims.Where(m => m.Type == "sub"); IEnumerable <Claim> nameIdentifiers = identity.Claims.Where(m => m.Type == ClaimTypes.NameIdentifier); if (claims.Count() == 0 && nameIdentifiers.Count() == 0) { return(false); } if (claims.Count() > 0) { AspNetId = claims.First().Value; } else { AspNetId = nameIdentifiers.First().Value; } AspNetId = claims.First().Value; var users = _context.USER_TABLE.Where(m => m.AspNetUserId == AspNetId); if (users.Count() == 0) { return(false); } UserTable = users.First(); userTableId = longNullableToint(users.First().user_auto); return(true); }
protected void DoFactory(System.Security.Principal.IPrincipal pi) { System.Threading.Thread.CurrentPrincipal = pi; WebRuntime.Current = this; if ((this.Response.ClientEvent & WebEvent.Error) == WebEvent.Error) { return; } if (String.Equals(Reflection.Instance().Provider["debug"], "true") == false) { try { DoFactory(); } catch (UMC.Web.WebAbortException) { } catch (Exception ex) { this.Response.ClientEvent = WebEvent.Error; this.Response.Headers["Error"] = ex.Message; UMC.Data.Utility.Error("UMC", DateTime.Now, this.Request.Url.AbsoluteUri, ex.ToString()); } } else { try { DoFactory(); } catch (UMC.Web.WebAbortException) { } } }
internal void Execute() { System.Diagnostics.Debug.Assert(dg != null); // save old principal System.Security.Principal.IPrincipal oldPrincipal = System.Threading.Thread.CurrentPrincipal; try { // set new principal System.Threading.Thread.CurrentPrincipal = principal; ret = dg.DynamicInvoke(args); } catch (Exception ex) { exception = ex; } finally { dg = null; // restore old principal System.Threading.Thread.CurrentPrincipal = oldPrincipal; sem.Release(); } }
public static bool IfInRoles(System.Security.Principal.IPrincipal user, params string[] roles) { bool show = false; if (roles.Count() > 0) { if (user?.Identity?.IsAuthenticated == true) { foreach (var r in roles) { if (user.IsInRole(r)) { show = true; break; } } } } else { show = true; } return(show); }
} // End Function ParseAuthHeader // http://blogs.msdn.com/b/odatateam/archive/2010/07/21/odata-and-authentication-part-6-custom-basic-authentication.aspx public static bool Authenticate(HttpContext context) { // One should be able to test on a developer system without https // if (!context.Request.IsSecureConnection) return false; string authHeader = context.Request.Headers["Authorization"]; if (string.IsNullOrEmpty(authHeader)) { return(false); } string[] credentials = ParseAuthHeader(authHeader); System.Console.WriteLine(credentials); System.Security.Principal.IPrincipal principal = default(System.Security.Principal.IPrincipal); if (TryGetPrincipal(credentials, out principal)) { HttpContext.Current.User = principal; return(true); } return(false); } // End Function Authenticate
public long m_lngGetSequence(System.Security.Principal.IPrincipal p_objPrincipal, string p_strSEQName, out long p_lngSEQ) { p_lngSEQ = 0; if (string.IsNullOrEmpty(p_strSEQName)) { return(-1); } long lngRes = 0; try { if (clsHRPTableService.bytDatabase_Selector == (byte)clsHRPTableService.enumDatabase_Selector.bytOracle) { string strSQL = "select " + p_strSEQName + ".nextval from dual"; clsHRPTableService objHRPServ = new clsHRPTableService(); DataTable dtValue = null; lngRes = objHRPServ.DoGetDataTable(strSQL, ref dtValue); if (dtValue != null && dtValue.Rows.Count == 1) { p_lngSEQ = Convert.ToInt64(dtValue.Rows[0][0]); } else { p_lngSEQ = 1; } } } catch (Exception objEx) { com.digitalwave.Utility.clsLogText objLogger = new com.digitalwave.Utility.clsLogText(); bool blnRes = objLogger.LogError(objEx); } return(lngRes); }
public long m_lngDelUsageSet(System.Security.Principal.IPrincipal p_objPrincipal, string p_usageID) { long lngRes = 0; //权限类 clsPrivilegeHandleService objPrivilege = new clsPrivilegeHandleService(); //检查是否有使用些函数的权限 lngRes = objPrivilege.m_lngCheckCallPrivilege(p_objPrincipal, "com.digitalwave.iCare.middletier.HIS.clsRegChargeTypeSvc", "m_lngDelUsageSet"); if (lngRes < 0)//没有使用的权限 { return(-1); } com.digitalwave.iCare.middletier.HRPService.clsHRPTableService objHRPSvc = new clsHRPTableService(); //返回一最大的计划号 if (lngRes < 0) { return(lngRes); } string strSQL = "DELETE t_opr_setusage " + "WHERE usageid_chr = '" + p_usageID + "'"; try { lngRes = objHRPSvc.DoExcute(strSQL); objHRPSvc.Dispose(); } catch (Exception objEx) { string strTmp = objEx.Message; com.digitalwave.Utility.clsLogText objLogger = new clsLogText(); bool blnRes = objLogger.LogError(objEx); } return(lngRes); }
/// <summary> /// Checks a user's authorization against a given rule /// </summary> /// <param name="principal">The user to authorize</param> /// <param name="context">The name of the rule to check</param> /// <returns>boolean indicating whether the user is authorized</returns> public override bool Authorize(System.Security.Principal.IPrincipal principal, string context) { if (principal == null) { throw new ArgumentNullException("principal"); } if (context == null || context.Length == 0) { throw new ArgumentNullException("context"); } if (mgr == null) { mgr = new DbRulesManager(database); } //SecurityAuthorizationCheckEvent.Fire(principal.Identity.Name, context); InstrumentationProvider.FireAuthorizationCheckPerformed(principal.Identity.Name, context); BooleanExpression expression = GetParsedExpression(context, mgr); if (expression == null) { //todo : better exception throw new ApplicationException(String.Format("Authorization Rule {0} not found in the database.", context)); } bool result = expression.Evaluate(principal); if (result == false) { //SecurityAuthorizationFailedEvent.Fire(principal.Identity.Name, context); InstrumentationProvider.FireAuthorizationCheckFailed(principal.Identity.Name, context); } return(result); }
public ContextHolder( ContextHolder other ) { this.prior = other; this.tracing = other.tracing; this.logging = other.logging; this.outWriter = other.outWriter; this.errorWriter = other.errorWriter; this.traceWriter = other.traceWriter; this.logCapture = other.logCapture; this.testCaseTimeout = other.testCaseTimeout; this.currentDirectory = Environment.CurrentDirectory; this.currentCulture = CultureInfo.CurrentCulture; this.currentUICulture = CultureInfo.CurrentUICulture; this.currentPrincipal = System.Threading.Thread.CurrentPrincipal; }
public static long RegisterNewUser(string Username, string Password, string Email, bool IsApproved, string FirstName, string LastName, long organizationId, string token, DateTime? DateOfBirth = null, string Title = null) { MembershipCreateStatus CreateStatus; Membership.CreateUser(Username, Password, Email, null, null, IsApproved, Guid.NewGuid(), out CreateStatus); if (CreateStatus == MembershipCreateStatus.Success) { StudentTracker.Core.Entities.User User = null; using (StudentContext Context = new StudentContext()) { User = Context.Users.FirstOrDefault(Usr => Usr.Username == Username); User.FirstName = FirstName; User.LastName = LastName; User.ConfirmPassword = User.Password; User.OrganizationId = organizationId; User.RegistrationToken = token; Context.SaveChanges(); } if (IsApproved) { FormsAuthentication.SetAuthCookie(Username, false); } return User.UserId; } return -1; }
public long m_lngGetDeviceQCDataBySampleID(System.Security.Principal.IPrincipal p_objPrincipal, string p_strSampleID, string p_strStartDat, string p_strEndDat, int[] p_intBatchSeqArr, out clsLisQCDataVO[] p_objQCDataArr) { p_objQCDataArr = null; long lngRes = 0; if (string.IsNullOrEmpty(p_strSampleID) || string.IsNullOrEmpty(p_strStartDat) || string.IsNullOrEmpty(p_strEndDat) || p_intBatchSeqArr == null || p_intBatchSeqArr.Length <= 0) { return(lngRes); } com.digitalwave.security.clsPrivilegeHandleService objPrivilege = new clsPrivilegeHandleService(); lngRes = objPrivilege.m_lngCheckCallPrivilege(p_objPrincipal, "com.digitalwave.iCare.middletier.LIS.clsTmdQCLisServ", "m_lngGetDeviceQCDataBySampleID"); objPrivilege = null; if (lngRes <= 0) { return(lngRes); } try { StringBuilder strSQLBuilder = new StringBuilder(512); strSQLBuilder.Append(@"select t.result_vchr, t.check_dat, d.qcbatch_seq_int from t_opr_lis_result t inner join t_bse_lis_device_check_item a on a.device_check_item_name_vchr = t.device_check_item_name_vchr and a.is_qc_item_int = 1 and a.has_graph_result_int = 0 inner join t_bse_lis_check_item_dev_item b on b.device_check_item_id_chr = a.device_check_item_id_chr and b.device_model_id_chr = a.device_model_id_chr inner join t_bse_lis_device c on c.device_model_id_chr = b.device_model_id_chr inner join t_opr_lis_qcbatch d on d.check_item_id_chr = b.check_item_id_chr where t.device_sampleid_chr = ? and t.deviceid_chr = c.deviceid_chr and t.check_dat between ? and ? and (d.qcbatch_seq_int = ?"); for (int index = 1; index < p_intBatchSeqArr.Length; index++) { strSQLBuilder.Append(" or d.qcbatch_seq_int = ?"); } strSQLBuilder.Append(")"); clsHRPTableService objHRPServ = new clsHRPTableService(); IDataParameter[] objDPArr = null; objHRPServ.CreateDatabaseParameter(p_intBatchSeqArr.Length + 3, out objDPArr); objDPArr[0].Value = p_strSampleID; objDPArr[1].DbType = DbType.DateTime; objDPArr[1].Value = Convert.ToDateTime(p_strStartDat); objDPArr[2].DbType = DbType.DateTime; objDPArr[2].Value = Convert.ToDateTime(p_strEndDat); for (int index = 0; index < p_intBatchSeqArr.Length; index++) { objDPArr[3 + index].Value = p_intBatchSeqArr[index]; } DataTable dtResult = null; lngRes = objHRPServ.lngGetDataTableWithParameters(strSQLBuilder.ToString(), ref dtResult, objDPArr); if (lngRes > 0 && dtResult != null && dtResult.Rows.Count > 0) { int iRowCount = dtResult.Rows.Count; List <clsLisQCDataVO> lstQCData = new List <clsLisQCDataVO>(); clsLisQCDataVO objTemp = null; DataRow drTemp = null; double dblTemp = 0d; for (int iRow = 0; iRow < iRowCount; iRow++) { drTemp = dtResult.Rows[iRow]; if (double.TryParse(drTemp["result_vchr"].ToString(), out dblTemp) && drTemp["check_dat"] != DBNull.Value) { objTemp = new clsLisQCDataVO(); objTemp.m_dlbResult = dblTemp; objTemp.m_datQCDate = Convert.ToDateTime(Convert.ToDateTime(drTemp["check_dat"]).ToString("yyyy-MM-dd")); objTemp.m_intSeq = -1; int.TryParse(drTemp["qcbatch_seq_int"].ToString(), out objTemp.m_intQCBatchSeq); objTemp.m_intConcentrationSeq = -1; lstQCData.Add(objTemp); } } if (lstQCData.Count > 0) { p_objQCDataArr = lstQCData.ToArray(); } } } catch (Exception objEx) { clsLogText objLogger = new clsLogText(); objLogger.LogDetailError(objEx, true); objLogger = null; } finally { p_intBatchSeqArr = null; p_strEndDat = null; p_strSampleID = null; p_strStartDat = null; } return(lngRes); }
internal Message(Delegate d, params object[] args) { dg = d; this.args = args; principal = System.Threading.Thread.CurrentPrincipal; sem = new System.Threading.Semaphore(0, 1); }
/// <summary> /// Initializes a new instance of the <see cref="TravelAndTrainingRequest"/> class. /// </summary> /// <param name="context">The context.</param> public TravelAndTrainingRequest(System.Security.Principal.IPrincipal context) { this.applicationContext = context; Initialize(); }
public List <GETEquipmentListVM> getEquipmentListByCustomerAndJobsite(long customerAuto, int jobsiteAuto, System.Security.Principal.IPrincipal User) { var Equipments = getEquipmentListByCustomer(customerAuto, User); using (var dataEntitiesShared = new DAL.SharedContext()) { var jobsiteEquipments = dataEntitiesShared.EQUIPMENT.Where(m => m.crsf_auto == jobsiteAuto).Select(m => m.equipmentid_auto); return(Equipments.Where(m => jobsiteEquipments.Any(k => k == m.equipmentid_auto)).ToList()); } }
public ContextHolder() { this.prior = null; this.tracing = false; this.logging = false; this.outWriter = Console.Out; this.errorWriter = Console.Error; this.traceWriter = null; this.logCapture = new Log4NetCapture(); this.testCaseTimeout = 0; this.currentDirectory = Environment.CurrentDirectory; this.currentCulture = CultureInfo.CurrentCulture; this.currentUICulture = CultureInfo.CurrentUICulture; this.currentPrincipal = System.Threading.Thread.CurrentPrincipal; }
protected void Init(QSystemTimer qTimer, string name, TimeSpan duration, IQHsm hsm, IQEvent ev, TimeOutType timeOutType) { _QTimer = qTimer; _Name = name; _Hsm = hsm; _Event = ev; _TimeOutType = timeOutType; double ms = duration.TotalMilliseconds; double msInterval = ms > 0 ? ms : TimeSpan.MaxValue.TotalMilliseconds; _Timer = new System.Timers.Timer (msInterval); _Timer.Elapsed += new System.Timers.ElapsedEventHandler(_Timer_Elapsed); _Timer.Enabled = ms > 0; _Principal = System.Threading.Thread.CurrentPrincipal; }
/// <summary> /// Record any changed values in the current context /// </summary> public void Update() { this.currentDirectory = Environment.CurrentDirectory; this.currentCulture = CultureInfo.CurrentCulture; this.currentUICulture = CultureInfo.CurrentUICulture; this.currentPrincipal = System.Threading.Thread.CurrentPrincipal; }
public RequestOfficer(System.Security.Principal.IPrincipal principal) { this.userContext = principal; }
public List <Core.Domain.IdAndDate> getEquipmentIdAndDateByCustomer(long customerAuto, System.Security.Principal.IPrincipal User) { List <Core.Domain.IdAndDate> result = new List <Core.Domain.IdAndDate>(); if (customerAuto == 0) { return(result); } List <int> Ids = getEquipmentIdsByCustomer(customerAuto, User); using (var _context = new DAL.UndercarriageContext()) { foreach (var EqId in Ids) { var inspections = _context.ACTION_TAKEN_HISTORY.Where(m => m.equipmentid_auto == EqId && m.recordStatus == (int)BLL.Core.Domain.RecordStatus.Available && (m.action_type_auto == (int)Core.Domain.ActionType.InsertInspection || m.action_type_auto == (int)Core.Domain.ActionType.UpdateInspection)); if (inspections.Count() == 0) { result.Add(new Core.Domain.IdAndDate { Id = EqId, Date = DateTime.MinValue }); } else { result.Add(new Core.Domain.IdAndDate { Id = EqId, Date = inspections.OrderByDescending(m => m.event_date).Select(m => m.event_date).FirstOrDefault() }); } } } return(result); }
public LogicBase(System.Security.Principal.IPrincipal principal) { if(principal == null) throw new ArgumentException("Value cannot be null.", "principal"); _principal = principal; }
public List <EquipmentListVM> getCompatibleEquipmentForImplementByJobsite(long jobsiteId, int getAuto, System.Security.Principal.IPrincipal User) { List <EquipmentListVM> result = new List <EquipmentListVM>(); using (var context = new DAL.GETContext()) { // Get implement id long implementAuto = context.GET.Find(getAuto).implement_auto ?? 0; if (implementAuto == 0) { return(result); } // Find valid models for implement. var validModels = context.GET_IMPLEMENT_MAKE_MODEL.Where(w => w.implement_auto == implementAuto) .Select(s => new { equipmentModel = s.model_auto }).ToList(); // Find all equipment at the specified jobsite for which the user has permissions to access. var allEquipmentAtJobsite = new BLL.Core.Domain.UserAccess(new SharedContext(), User) .getAccessibleEquipments().Where(e => e.crsf_auto == jobsiteId) .Select(s => new { equipmentId = s.equipmentid_auto, equipmentSerialNo = s.serialno, equipmentSMU = s.currentsmu.Value, equipmentModel = s.LU_MMTA.model_auto }).ToList(); // Filter results by valid models for the specified jobsite. for (int i = 0; i < allEquipmentAtJobsite.Count; i++) { for (int j = 0; j < validModels.Count; j++) { if (allEquipmentAtJobsite[i].equipmentModel == validModels[j].equipmentModel) { result.Add(new EquipmentListVM { equipmentId = allEquipmentAtJobsite[i].equipmentId, equipmentSerialNo = allEquipmentAtJobsite[i].equipmentSerialNo, equipmentSMU = allEquipmentAtJobsite[i].equipmentSMU }); } } } } return(result); }
public CurrentPrincipalChange() { _saved = System.Threading.Thread.CurrentPrincipal; System.Threading.Thread.CurrentPrincipal = CreateNewCurrentPrincipal(); }
public long m_lngGetDeviceQCCheckItemByID(System.Security.Principal.IPrincipal p_objPrincipal, string p_strDeviceID, out clsLISCheckItemNode[] p_objResultArr) { p_objResultArr = null; long lngRes = 0; if (string.IsNullOrEmpty(p_strDeviceID)) { return(lngRes); } com.digitalwave.security.clsPrivilegeHandleService objPrivilege = new clsPrivilegeHandleService(); lngRes = objPrivilege.m_lngCheckCallPrivilege(p_objPrincipal, "com.digitalwave.iCare.middletier.LIS.clsTmdQCLisServ", "m_lngGetDeviceQCCheckItemByID"); objPrivilege = null; if (lngRes <= 0) { return(lngRes); } try { string strSQL = @"select a.check_item_id_chr, a.rptno_chr from t_bse_lis_check_item a inner join t_bse_lis_check_item_dev_item b on b.check_item_id_chr = a.check_item_id_chr inner join t_bse_lis_device_check_item c on c.device_check_item_id_chr = b.device_check_item_id_chr and c.device_model_id_chr = b.device_model_id_chr and c.is_qc_item_int = 1 inner join t_bse_lis_device d on d.device_model_id_chr = c.device_model_id_chr and d.deviceid_chr = ?"; clsHRPTableService objHRPServ = new clsHRPTableService(); IDataParameter[] objDPArr = null; objHRPServ.CreateDatabaseParameter(1, out objDPArr); objDPArr[0].Value = p_strDeviceID; DataTable dtResult = null; lngRes = objHRPServ.lngGetDataTableWithParameters(strSQL, ref dtResult, objDPArr); objHRPServ = null; objDPArr = null; if (lngRes > 0 && dtResult != null && dtResult.Rows.Count > 0) { DataRow drTemp = null; clsLISCheckItemNode objTemp = null; int iRowCount = dtResult.Rows.Count; p_objResultArr = new clsLISCheckItemNode[iRowCount]; for (int iRow = 0; iRow < iRowCount; iRow++) { drTemp = dtResult.Rows[iRow]; objTemp = new clsLISCheckItemNode(); objTemp.strID = drTemp["check_item_id_chr"].ToString().Trim(); objTemp.strName = drTemp["rptno_chr"].ToString().Trim(); p_objResultArr[iRow] = objTemp; } } } catch (Exception objEx) { com.digitalwave.Utility.clsLogText objLogger = new clsLogText(); objLogger.LogDetailError(objEx, true); objLogger = null; } finally { p_strDeviceID = null; } return(lngRes); }
public TravelAndTrainingRequestFinder(System.Security.Principal.IPrincipal user) { this.user = user; this.provider = DataAccessFactory.CreateTTRRepository(); }