public clsQuestionDynamic(string header, int noOfOptions, TypeOfOptions type, List<string> options)
 {
     Header = header;
     NoOfOptions = noOfOptions;
     Type = type;
     Options = options;
 }
Example #2
0
 public clsQuestionDynamic(string header, int noOfOptions, TypeOfOptions type, List <string> options)
 {
     try
     {
         Header      = header;
         NoOfOptions = noOfOptions;
         Type        = type;
         Options     = options;
     }
     catch (Exception ex)
     {
         ex.Data.Add("My Key", "VMukti--:--VmuktiModules--:--Call Center--:--CRMDesigner--:--CRMDesigner.Business--:--ClsQuestionDynamic.cs--:--clsQuestionDynamic()--");
         //ClsException.LogError(ex);
         //ClsException.WriteToErrorLogFile(ex);
         System.Text.StringBuilder sb = new StringBuilder();
         sb.AppendLine(ex.Message);
         sb.AppendLine();
         sb.AppendLine("StackTrace : " + ex.StackTrace);
         sb.AppendLine();
         sb.AppendLine("Location : " + ex.Data["My Key"].ToString());
         sb.AppendLine();
         sb1 = CreateTressInfo();
         sb.Append(sb1.ToString());
         VMuktiAPI.ClsLogging.WriteToTresslog(sb);
     }
 }
Example #3
0
 public clsQuestionDynamic(string header, int noOfOptions, TypeOfOptions type, List <string> options)
 {
     Header      = header;
     NoOfOptions = noOfOptions;
     Type        = type;
     Options     = options;
 }
Example #4
0
        /// <summary>
        /// Determine whether the given type is a tuple type.<br />
        /// 判断给定的类型是否为元组类型
        /// </summary>
        /// <param name="type"></param>
        /// <param name="ofOptions"></param>
        /// <param name="isOptions"></param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException"></exception>
        public static bool IsTupleType(Type type, TypeOfOptions ofOptions = TypeOfOptions.Owner, TypeIsOptions isOptions = TypeIsOptions.Default)
        {
            if (type is null)
            {
                return(false);
            }

            if (isOptions == TypeIsOptions.IgnoreNullable)
            {
                type = TypeConv.GetNonNullableType(type);
            }

            if (type == typeof(Tuple) || type == typeof(ValueTuple))
            {
                return(true);
            }

            while (type != null)
            {
                if (type.IsGenericType)
                {
                    var genType = type.GetGenericTypeDefinition();

                    if (genType == typeof(Tuple <>) ||
                        genType == typeof(Tuple <,>) ||
                        genType == typeof(Tuple <, ,>) ||
                        genType == typeof(Tuple <, , ,>) ||
                        genType == typeof(Tuple <, , , ,>) ||
                        genType == typeof(Tuple <, , , , ,>) ||
                        genType == typeof(Tuple <, , , , , ,>) ||
                        genType == typeof(Tuple <, , , , , , ,>) ||
                        genType == typeof(Tuple <, , , , , , ,>))
                    {
                        return(true);
                    }

                    if (genType == typeof(ValueTuple <>) ||
                        genType == typeof(ValueTuple <,>) ||
                        genType == typeof(ValueTuple <, ,>) ||
                        genType == typeof(ValueTuple <, , ,>) ||
                        genType == typeof(ValueTuple <, , , ,>) ||
                        genType == typeof(ValueTuple <, , , , ,>) ||
                        genType == typeof(ValueTuple <, , , , , ,>) ||
                        genType == typeof(ValueTuple <, , , , , , ,>) ||
                        genType == typeof(ValueTuple <, , , , , , ,>))
                    {
                        return(true);
                    }
                }

                if (ofOptions == TypeOfOptions.Owner)
                {
                    break;
                }

                type = type.BaseType;
            }

            return(false);
        }
Example #5
0
 public static Type Of <T>(TypeOfOptions options = TypeOfOptions.Owner)
 {
     return(options switch
     {
         TypeOfOptions.Owner => typeof(T),
         TypeOfOptions.Underlying => TypeConv.GetNonNullableType <T>(),
         _ => typeof(T)
     });
Example #6
0
 public clsQuestionDynamic(string header, int noOfOptions, TypeOfOptions type, List <string> options)
 {
     try
     {
         Header      = header;
         NoOfOptions = noOfOptions;
         Type        = type;
         Options     = options;
     }
     catch (Exception ex)
     {
         VMuktiHelper.ExceptionHandler(ex, "clsQuestionDynamic()", "clsQuestionDynamic.cs");
     }
 }
 public clsQuestionDynamic(string header, int noOfOptions, TypeOfOptions type, List<string> options)
 {
     try
     {
         Header = header;
         NoOfOptions = noOfOptions;
         Type = type;
         Options = options;
     }
     catch (Exception ex)
     {
         ex.Data.Add("My Key", "VMukti--:--VmuktiModules--:--Call Center--:--CRMDesigner--:--CRMDesigner.Business--:--ClsQuestionDynamic.cs--:--clsQuestionDynamic()--");
         //ClsException.LogError(ex);
         //ClsException.WriteToErrorLogFile(ex);
         System.Text.StringBuilder sb = new StringBuilder();
         sb.AppendLine(ex.Message);
         sb.AppendLine();
         sb.AppendLine("StackTrace : " + ex.StackTrace);
         sb.AppendLine();
         sb.AppendLine("Location : " + ex.Data["My Key"].ToString());
         sb.AppendLine();
         sb1 = CreateTressInfo();
         sb.Append(sb1.ToString());
         VMuktiAPI.ClsLogging.WriteToTresslog(sb);
     }
 }
Example #8
0
 /// <summary>
 /// Determine whether the given parameter is a tuple type.<br />
 /// 判断给定的参数是否为数元组类型
 /// </summary>
 /// <param name="parameter"></param>
 /// <param name="ofOptions"></param>
 /// <param name="isOptions"></param>
 /// <returns></returns>
 public static bool IsTupleType(this ParameterInfo parameter, TypeOfOptions ofOptions = TypeOfOptions.Owner, TypeIsOptions isOptions = TypeIsOptions.Default)
 {
     return(Types.IsTupleType(MemberVisitHelper.GetActualType(parameter), ofOptions, isOptions));
 }
Example #9
0
        public static bool IsValueTupleType <T>(T value, TypeOfOptions ofOptions = TypeOfOptions.Owner, TypeIsOptions isOptions = TypeIsOptions.Default)
        {
            var type = value?.GetUnboxedType();

            return(type is not null && IsValueTupleType(type, ofOptions, isOptions));
        }
Example #10
0
 public static bool IsValueTupleType <T>(TypeOfOptions ofOptions = TypeOfOptions.Owner, TypeIsOptions isOptions = TypeIsOptions.Default)
 {
     return(IsValueTupleType(typeof(T), ofOptions, isOptions));
 }
 public clsQuestionDynamic(string header, int noOfOptions, TypeOfOptions type, List<string> options)
 {
     try
     {
         Header = header;
         NoOfOptions = noOfOptions;
         Type = type;
         Options = options;
     }
     catch (Exception ex)
     {
         VMuktiHelper.ExceptionHandler(ex, "clsQuestionDynamic()", "clsQuestionDynamic.cs");
     }
 }