本文整理汇总了C#中Fwk.Exceptions.TechnicalException类的典型用法代码示例。如果您正苦于以下问题:C# TechnicalException类的具体用法?C# TechnicalException怎么用?C# TechnicalException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TechnicalException类属于Fwk.Exceptions命名空间,在下文中一共展示了TechnicalException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetApplicationID
/// <summary>
/// Retorna el GUID de la aplicación busca en la bse de datos configurada por defecto
/// </summary>
/// <param name="pCompanyId">Nombre de la aplicación </param>
/// <param name="providerName">Nombre del proveedor de membership</param>
/// <returns>GUID de la aplicacion</returns>
public static string GetApplicationID(String pCompanyId, string providerName)
{
String wApplicationId = String.Empty;
Database wDataBase = null;
DbCommand wCmd = null;
try
{
wDataBase = DatabaseFactory.CreateDatabase(GetProvider_ConnectionStringName(providerName));
wCmd = wDataBase.GetStoredProcCommand("[aspnet_Personalization_GetApplicationId]");
// ApplicationName
wDataBase.AddInParameter(wCmd, "ApplicationName", System.Data.DbType.String, pCompanyId);
wDataBase.AddOutParameter(wCmd, "ApplicationId", System.Data.DbType.Guid, 64);
wDataBase.ExecuteScalar(wCmd);
wApplicationId = Convert.ToString(wDataBase.GetParameterValue(wCmd, "ApplicationId"));
return wApplicationId;
}
catch (Exception ex)
{
TechnicalException te = new TechnicalException(Fwk.Security.Properties.Resource.MembershipSecurityGenericError, ex);
ExceptionHelper.SetTechnicalException<FwkMembership>(te);
te.ErrorId = "4000";
throw te;
}
}
示例2: GetProperty
/// <summary>
/// Obtiene una propiedad determinada de un archivo de configuracion .-
/// </summary>
/// <param name="configProvider">Proveedor de configuuracion</param>
/// <param name="pGroupName">Nombre del grupo donde se encuentra la propiedad</param>
/// <param name="pPropertyName">Nombre de la propiedad a obtener</param>
/// <returns>String con la propiedad</returns>
/// <Author>Marcelo Oviedo</Author>
internal static string GetProperty(string configProvider, string pGroupName, string pPropertyName)
{
string wBaseConfigFile = String.Empty;
ConfigProviderElement provider = ConfigurationManager.GetProvider(configProvider);
ConfigurationFile wConfigurationFile = GetConfig(provider);
Group wGroup = wConfigurationFile.Groups.GetFirstByName(pGroupName);
if (wGroup == null)
{
TechnicalException te = new TechnicalException(string.Concat(new String[] { "No se encuentra el grupo ", pGroupName, " en la de configuración: ", wBaseConfigFile }));
te.ErrorId = "8006";
Fwk.Exceptions.ExceptionHelper.SetTechnicalException(te, typeof(LocalFileConfigurationManager));
throw te;
}
Key wKey = wGroup.Keys.GetFirstByName(pPropertyName);
if (wKey == null)
{
TechnicalException te = new TechnicalException(string.Concat(new String[] { "No se encuentra la propiedad ", pPropertyName, " en el grupo de propiedades: ", pGroupName, " en la de configuración: ", wBaseConfigFile }));
te.ErrorId = "8007";
Fwk.Exceptions.ExceptionHelper.SetTechnicalException(te, typeof(LocalFileConfigurationManager));
throw te;
}
return wKey.Value.Text;
}
示例3: ProcessWebException
internal static void ProcessWebException(string msg)
{
TechnicalException te = new TechnicalException(msg);
HttpContext.Current.Session["Error"] = te;
HttpContext.Current.Response.Redirect("~/ErrorMessageViewer.aspx");
}
示例4: GetRulesByRole
/// <summary>
/// Retorna las reglas en las que esta vinculado un Rol
/// </summary>
/// <param name="roleName">Nombre del rol.</param>
/// <param name="applicationName">Nombre de la aplicacion. Coincide con CompanyId en la arquitectura</param>
/// <param name="connectionStringName">Nombre de cadena de coneccion del archivo de configuracion.-</param>
/// <returns></returns>
public static List<FwkAuthorizationRule> GetRulesByRole(string roleName, string applicationName, string connectionStringName)
{
List<FwkAuthorizationRule> wAllRules = null;
try
{
wAllRules = GetRulesAuxList(applicationName, connectionStringName);
var rules_byRol = from s in wAllRules where s.Expression.Contains(string.Concat("R:", roleName.Trim())) select s;
return rules_byRol.ToList<FwkAuthorizationRule>();
}
catch (TechnicalException tx)
{ throw tx; }
catch (InvalidOperationException)
{
TechnicalException te = new TechnicalException(string.Format(Resource.Role_WithoutRules, roleName));
te.ErrorId = "4002";
Fwk.Exceptions.ExceptionHelper.SetTechnicalException<FwkMembership>(te);
throw te;
}
catch (Exception ex)
{
TechnicalException te = new TechnicalException(Fwk.Security.Properties.Resource.MembershipSecurityGenericError, ex);
ExceptionHelper.SetTechnicalException<FwkMembership>(te);
te.ErrorId = "4000";
throw te;
}
}
示例5: GetApplication
/// <summary>
/// Obtiene de la bases de datos aspnet y tabla aspnet_Applications el Guid de la Aplicacion
/// </summary>
/// <param name="applicationName">Nombre de la aplicacion. Coincide con CompanyId en la arquitectura</param>
/// <param name="cnnstringName"></param>
/// <returns></returns>
public static Guid GetApplication(string applicationName, string cnnstringName)
{
Guid wApplicationNameId = new Guid();
try
{
using (Fwk.Security.RuleProviderDataContext dc = new Fwk.Security.RuleProviderDataContext(System.Configuration.ConfigurationManager.ConnectionStrings[cnnstringName].ConnectionString))
{
aspnet_Application app = dc.aspnet_Applications.Where(p => p.LoweredApplicationName.Equals(applicationName.ToLower())).FirstOrDefault<aspnet_Application>();
if (app != null)
wApplicationNameId = app.ApplicationId;
else
{
TechnicalException te = new TechnicalException(String.Format(Fwk.Security.Properties.Resource.ApplicationName_NotExist, applicationName, cnnstringName));
ExceptionHelper.SetTechnicalException<FwkMembership>(te);
te.ErrorId = "4002";
throw te;
}
}
return wApplicationNameId;
}
catch (TechnicalException tx)
{ throw tx; }
catch (Exception ex)
{
TechnicalException te = new TechnicalException(Fwk.Security.Properties.Resource.MembershipSecurityGenericError, ex);
ExceptionHelper.SetTechnicalException<FwkMembership>(te);
te.ErrorId = "4000"; throw te;
}
}
示例6: LogDispatcherErrorConfig
/// <summary>
/// Log error from dispatcher on xml File
/// </summary>
/// <param name="ex"></param>
internal static TechnicalException LogDispatcherErrorConfig(Exception ex)
{
StringBuilder s = new StringBuilder("Se ha intentado levantar el despachador de servicios.");
s.AppendLine("Verifique que esten correctamente configurados en el .config los AppSettings.");
s.AppendLine("ServiceDispatcherName y ServiceDispatcherConnection");
if (ex != null)
{
s.AppendLine("..................................");
s.AppendLine("Error Interno:");
s.AppendLine(Fwk.Exceptions.ExceptionHelper.GetAllMessageException(ex));
}
TechnicalException te = new TechnicalException(s.ToString());
te.ErrorId = "7007";
Fwk.Exceptions.ExceptionHelper.SetTechnicalException<FacadeHelper>(te);
try
{
// TODO: ver prefijo del log
Fwk.Logging.Event ev = new Fwk.Logging.Event(EventType.Error,
Fwk.Bases.ConfigurationsHelper.HostApplicationName,
s.ToString(), Environment.MachineName, Environment.UserName);
Fwk.Logging.Targets.XmlTarget target = new Logging.Targets.XmlTarget();
target.FileName = String.Concat(Fwk.HelperFunctions.DateFunctions.Get_Year_Mont_Day_String(DateTime.Now,'-') ,"_", "DispatcherErrorsLog.xml");
target.Write(ev);
}
catch { }
return te;
}
示例7: Create
/// <summary>
/// Crea un nuevo usuario.
/// </summary>
/// <param name="pUser">UsuarioBE a crear</param>
/// <returns>UserId del nuevo usuario.</returns>
public void Create(User pUser)
{
//TODO: Ver tema de nuevo GUID para el usuario
//Guid wUserGUID = Guid.NewGuid();
MembershipCreateStatus pStatus = MembershipCreateStatus.UserRejected;
// se inserta en las membership el nuevo usuario
User wNewUser = FwkMembership.CreateUser(pUser.UserName, pUser.Password, pUser.Email,
pUser.QuestionPassword, pUser.AnswerPassword,
pUser.IsApproved, out pStatus, _ProviderName);
// se inserta el usuario custom
if (pStatus == MembershipCreateStatus.Success)
{
//UsersDAC.Create(pUser, CustomParameters, _ProviderName, pCustomUserTable);
// Se insertan los roles
if (pUser.Roles != null)
{
RolList roleList = pUser.GetRolList();
FwkMembership.CreateRolesToUser(roleList, pUser.UserName, _ProviderName);
}
pUser.ProviderId = wNewUser.ProviderId;
wNewUser = null;
}
else
{
TechnicalException te = new TechnicalException(string.Format(Fwk.Security.Properties.Resource.User_Created_Error_Message, pUser.UserName, pStatus));
ExceptionHelper.SetTechnicalException<FwkMembership>(te);
te.ErrorId = "4008";
throw te;
}
}
示例8: LoadAllServices
/// <summary>
/// Busca el archivo lo carga a _Services que es un ServiceConfigurationCollection
/// </summary>
///<param name="xmlConfigFile"></param>
/// <returns></returns>
/// <date>2007-07-13T00:00:00</date>
/// <author>moviedo</author>
static ServiceConfigurationCollection LoadAllServices(string xmlConfigFile)
{
try
{
if (!System.IO.File.Exists(xmlConfigFile))
{
//Application.StartupPath
xmlConfigFile = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), xmlConfigFile);
}
String xml = FileFunctions.OpenTextFile(xmlConfigFile);
return (ServiceConfigurationCollection)SerializationFunctions.DeserializeFromXml(typeof(ServiceConfigurationCollection), xml);
}
catch (System.IO.IOException ioex)
{
TechnicalException te = new TechnicalException(Fwk.Bases.Properties.Resources.ServiceManagement_SourceInfo_Error, ioex);
if (string.IsNullOrEmpty(ConfigurationsHelper.HostApplicationName))
te.Source = string.Concat("Despachador de servicios en ", Environment.MachineName);
else
te.Source = ConfigurationsHelper.HostApplicationName;
te.ErrorId = "7004";
te.Assembly = typeof(XmlServiceConfigurationManager).AssemblyQualifiedName;
te.Class = typeof(XmlServiceConfigurationManager).Name;
te.Namespace = typeof(XmlServiceConfigurationManager).Namespace;
throw te;
}
catch (TechnicalException te)
{
throw te;
}
catch (Exception ex)
{
string strError = string.Concat("Error al inicializar la metadata de los servicios \r\n ",
"Nombre de archivo :", xmlConfigFile, Environment.NewLine);
Fwk.Exceptions.TechnicalException te = new Fwk.Exceptions.TechnicalException(strError, ex);
if (string.IsNullOrEmpty(ConfigurationsHelper.HostApplicationName))
te.Source = string.Concat("Despachador de servicios en ", Environment.MachineName);
else
te.Source = ConfigurationsHelper.HostApplicationName;
te.ErrorId = "7004";
te.Assembly = typeof(XmlServiceConfigurationManager).AssemblyQualifiedName;
te.Class = typeof(XmlServiceConfigurationManager).Name;
te.Namespace = typeof(XmlServiceConfigurationManager).Namespace;
throw te;
}
}
示例9: ExecuteService
/// <summary>
/// Ejecuta un servicio de negocio.
/// </summary>
/// <param name="providerName">Nombre del proveedor de metadata de servicios.-</param>
/// <param name="pRequest">Request con datos de entrada para la ejecución del servicio.</param>
/// <returns>XML con el resultado de la ejecución del servicio.</returns>
/// <date>2008-04-07T00:00:00</date>
/// <author>moviedo</author>
public IServiceContract ExecuteService(string providerName, IServiceContract pRequest)
{
IServiceContract wResult = null;
if (string.IsNullOrEmpty(pRequest.ServiceName))
{
TechnicalException te = new TechnicalException("El despachador de servicio no pudo continuar debido\r\n a que el nombre del servicio no fue establecido");
Fwk.Exceptions.ExceptionHelper.SetTechnicalException<SimpleFacade>(te);
te.ErrorId = "7005";
throw te;
}
Boolean wExecuteOndispatcher = true;
IRequest req = (IRequest)pRequest;
ServiceConfiguration wServiceConfiguration = FacadeHelper.GetServiceConfiguration(providerName, pRequest.ServiceName);
//establezco el nombre del proveedor de seguridad al request
req.SecurityProviderName = FacadeHelper.GetProviderInfo(providerName).SecurityProviderName;
req.ContextInformation.SetProviderName(providerName);
//if (String.IsNullOrEmpty(req.ContextInformation.DefaultCulture))
// req.ContextInformation.DefaultCulture = FacadeHelper.GetProviderInfo(providerName).DefaultCulture;
// Validación de disponibilidad del servicio.
FacadeHelper.ValidateAvailability(wServiceConfiguration, out wResult);
if (wResult != null)
if (wResult.Error != null) return wResult;
// Caching del servicio.
if (req.CacheSettings != null && req.CacheSettings.CacheOnServerSide) //--------->>> Implement the cache factory
{
wResult = GetCaheDataById(req, wServiceConfiguration);
if (wResult != null) wExecuteOndispatcher = false;
}
// Realiza la ejecucion del servicio
if (wExecuteOndispatcher)
{
// ejecución del servicio.
if (wServiceConfiguration.TransactionalBehaviour == Fwk.Transaction.TransactionalBehaviour.Suppres)
wResult = FacadeHelper.RunNonTransactionalProcess(pRequest, wServiceConfiguration);
else
wResult = FacadeHelper.RunTransactionalProcess(pRequest, wServiceConfiguration);
}
return wResult;
}
示例10: ConfigurationManager
/// <summary>
/// Constructor estatico del bloque de configuracion del framework
/// </summary>
static ConfigurationManager()
{
TechnicalException te;
try
{
_ConfigProvider = System.Configuration.ConfigurationManager.GetSection("FwkConfigProvider") as ConfigProviderSection;
if (_ConfigProvider == null)
{
te = new TechnicalException("No se puede cargar el proveedor de configuracion del framework fwk, verifique si existe la seccion [FwkConfigProvider] en el archivo de configuracion.");
te.ErrorId = "8000";
te.Namespace = "Fwk.Configuration";
te.Class = "Fwk.Configuration.ConfigurationManager [static constructor --> ConfigurationManager()]";
te.UserName = Environment.UserName;
te.Machine = Environment.MachineName;
if (string.IsNullOrEmpty(ConfigurationsHelper.HostApplicationName))
te.Source = "Sistema de Configuration del framework en ";
else
te.Source = ConfigurationsHelper.HostApplicationName;
throw te;
}
}
catch (System.Exception ex)
{
te = new TechnicalException("No se puede cargar el proveedor de configuracion del framework fwk, verifique si existe la seccion [FwkConfigProvider] en el archivo de configuracion. \r\n", ex);
te.ErrorId = "8000";
te.Namespace = "Fwk.Configuration";
te.Class = "Fwk.Configuration.ConfigurationManager [static constructor --> ConfigurationManager()]";
te.UserName = Environment.UserName;
te.Machine = Environment.MachineName;
if (string.IsNullOrEmpty(ConfigurationsHelper.HostApplicationName))
te.Source = "Sistema de Configuration del framework en ";
else
te.Source = ConfigurationsHelper.HostApplicationName;
throw te;
}
_DefaultProvider = _ConfigProvider.DefaultProvider;
}
示例11: GetRoleProvider
/// <summary>
///
/// </summary>
/// <param name="providerName"></param>
/// <returns></returns>
public static RoleProvider GetRoleProvider(string providerName)
{
try
{
RoleProvider rol = Roles.Providers[providerName];
if (rol == null)
{
TechnicalException te = new TechnicalException(string.Format(Resource.ProviderNameNotFound, providerName, "rol"));
te.ErrorId = "4001";
//te.Source = "FwkMembership block";
Fwk.Exceptions.ExceptionHelper.SetTechnicalException<FwkMembership>(te);
throw te;
}
return rol;
}
catch (System.Configuration.Provider.ProviderException pe)
{
StringBuilder err = new StringBuilder("El la configuracion RoleProvider lanzo el siguiente error:");
err.AppendLine( pe.Message);
err.AppendLine("Revise la configuraciopn del porveedor por defecto que este correcta (cadena de conexion, application Name, etc)" );
//if (pe.Message.Contains("The connection name") || pe.Message.Contains("was not found in the applications configuration or the connection string is empty."))
//{
//}
TechnicalException te = new TechnicalException(err.ToString());
ExceptionHelper.SetTechnicalException<FwkMembership>(te);
te.ErrorId = "4000";
throw te;
}
catch (System.Configuration.ConfigurationException c)
{
TechnicalException te = new TechnicalException(Resource.RoleProviderConfigError, c);
te.ErrorId = "4001";
//te.Source = "FwkMembership block";
Fwk.Exceptions.ExceptionHelper.SetTechnicalException<FwkMembership>(te);
throw te;
}
}
示例12: ValidateUser
/// <summary>
/// Verifican que usuario y password sean validos
/// </summary>
/// <param name="userName"></param>
/// <param name="password"></param>
/// <param name="providerName">Nombre del proveedor de membership</param>
/// <returns></returns>
public static Boolean ValidateUser(string userName, string password, string providerName)
{
SqlMembershipProvider wProvider = GetSqlMembershipProvider(providerName);
TechnicalException te = null;
bool isValid = wProvider.ValidateUser(userName, password);
if (!isValid)
{
MembershipUser user = wProvider.GetUser(userName,true);
if (user != null)
{
//User exists
if (!user.IsApproved)
{
//Account Unapproved
te = new TechnicalException("Your account is not approved.");
te.ErrorId = "4011";
throw te;
}
else if (user.IsLockedOut)
{
//Account Locked
te= new TechnicalException("Your account is locked.");
te.ErrorId = "4012";
throw te;
}
else
{
te = new TechnicalException("Invalid username or password.");
te.ErrorId = "4013";
throw te;
}
}
else
{
te = new TechnicalException("Invalid username or password.");
te.ErrorId = "4013";
throw te;
}
}
return isValid;
}
示例13: GetAllRoles_FullInfo
public static RolList GetAllRoles_FullInfo(string applicationName, string connectionStringName)
{
RolList wRolList = null;
Rol wRol = null;
try
{
Guid wApplicationId = GetApplication(applicationName, connectionStringName);
using (Fwk.Security.RuleProviderDataContext dc = new Fwk.Security.RuleProviderDataContext(System.Configuration.ConfigurationManager.ConnectionStrings[connectionStringName].ConnectionString))
{
var roles = from s in dc.aspnet_Roles where s.ApplicationId == wApplicationId select s;
wRolList = new RolList();
foreach (aspnet_Role aspnet_rol in roles)
{
wRol = new Rol();
wRol.Description = aspnet_rol.Description;
wRol.RolName = aspnet_rol.RoleName;
wRolList.Add(wRol);
}
}
return wRolList;
}
catch (TechnicalException tx)
{ throw tx; }
catch (Exception ex)
{
TechnicalException te = new TechnicalException(Fwk.Security.Properties.Resource.MembershipSecurityGenericError, ex);
ExceptionHelper.SetTechnicalException<FwkMembership>(te);
te.ErrorId = "4000";
throw te;
}
}
示例14: CreateCategory
/// <summary>
///
/// </summary>
/// <param name="pFwkCategory"></param>
/// <param name="connectionStringName">Nombre de cadena de coneccion del archivo de configuracion.-</param>
/// <param name="applicationName">Nombre de la aplicacion. Coincide con CompanyId en la arquitectura</param>
public static void CreateCategory(FwkCategory pFwkCategory, string applicationName, string connectionStringName)
{
Database wDataBase = null;
DbCommand wCmd = null;
try
{
Guid wApplicationId = GetApplication(applicationName, connectionStringName);
wDataBase = DatabaseFactory.CreateDatabase(connectionStringName);
StringBuilder str = new StringBuilder(FwkMembershipScripts.Category_i);
str.Replace("[ApplicationId]", wApplicationId.ToString());
if (pFwkCategory.ParentId == null) pFwkCategory.ParentId = 0;
str.Replace("[ParentCategoryId]", pFwkCategory.ParentId.ToString());
str.Replace("[CategoryName]", pFwkCategory.Name.ToLower());
wCmd = wDataBase.GetSqlStringCommand(str.ToString());
wCmd.CommandType = CommandType.Text;
pFwkCategory.CategoryId = Convert.ToInt32(wDataBase.ExecuteScalar(wCmd));
if (pFwkCategory.FwkRulesInCategoryList != null)
if (pFwkCategory.FwkRulesInCategoryList.Count != 0)
CreateRuleInCategory(pFwkCategory, applicationName.ToLower(), connectionStringName);
}
catch (TechnicalException tx)
{ throw tx; }
catch (Exception ex)
{
TechnicalException te = new TechnicalException(Fwk.Security.Properties.Resource.MembershipSecurityGenericError, ex);
ExceptionHelper.SetTechnicalException<FwkMembership>(te);
te.ErrorId = "4000";
throw te;
}
}
示例15: Logger
/// <summary>
/// Constructor de Logger.
/// </summary>
public Logger()
{
appId = Fwk.Bases.ConfigurationsHelper.HostApplicationName;
try
{
_LoggingSection = ConfigurationManager.GetSection("FwkLogging") as LoggingSection;
}
catch (System.Configuration.ConfigurationException ex)
{
TechnicalException te = new
TechnicalException("Hay problemas al intentar cargar la configuracion FwkLogging. \r\n ", ex);
te.Assembly = "Fwk.Logging";
te.Class = "LoginSection";
te.ErrorId = "9002";
te.Namespace = "Fwk.Logging";
te.UserName = Environment.UserName;
te.Machine = Environment.MachineName;
throw te;
}
}