Ejemplo n.º 1
0
        public static PropertyInstance GetCacheModificationPI(IClassVisitor cv)
        {
            Object           bean = State.BeanContext.GetService <ICacheModification>();
            PropertyInstance pi   = State.GetProperty(cacheModificationName, NewType.GetType(bean.GetType()));

            if (pi != null)
            {
                return(pi);
            }
            return(cv.ImplementAssignedReadonlyProperty(cacheModificationName, bean));
        }
        public static PropertyInstance GetEmbeddedMemberTemplatePI(IClassVisitor cv)
        {
            Object           bean = State.BeanContext.GetService(templateType);
            PropertyInstance pi   = State.GetProperty(templatePropertyName, NewType.GetType(bean.GetType()));

            if (pi != null)
            {
                return(pi);
            }
            return(cv.ImplementAssignedReadonlyProperty(templatePropertyName, bean));
        }
Ejemplo n.º 3
0
        public override void Generate(IndentedStringBuilder stringBuilder)
        {
            var argBuilders = Arguments.Select(t => {
                var b = new IndentedStringBuilder();
                t.Generate(b);
                return(b.Builder.ToString());
            });
            var arguments = string.Join(", ", argBuilders);

            stringBuilder.Append($"new {NewType.GetRightFullName()}({arguments})");
        }
Ejemplo n.º 4
0
        public static PropertyInstance GetConversionHelperPI(IClassVisitor cv)
        {
            Object           bean = State.BeanContext.GetService <IConversionHelper>();
            PropertyInstance pi   = State.GetProperty("ConversionHelper", NewType.GetType(bean.GetType()));

            if (pi != null)
            {
                return(pi);
            }
            return(cv.ImplementAssignedReadonlyProperty("ConversionHelper", bean));
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="item">NewType</param>
        /// <returns></returns>
        public static int AddNewType(NewType item)
        {
            string spName = "cudo_createnewtype";

            SqlParameter[] paramvalues = new SqlParameter[]
            {
                new SqlParameter("@classname", item.ClassName),
                new SqlParameter("@parentid", item.ParentId),
                new SqlParameter("@sortid", item.SortId)
            };
            return(SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionString, CommandType.StoredProcedure, spName, paramvalues));
        }
Ejemplo n.º 6
0
        static void Main(string[] args)
        {
            int TestNum = OnePlus(100);

            Console.WriteLine(TestNum);

            NewType aNewType = new NewType(OnePlus);

            TestNum = aNewType(1000);
            Console.WriteLine(TestNum);

            aNewType = new NewType(TenPlus);
            TestNum  = aNewType(1000);
            Console.WriteLine(TestNum);
        }
Ejemplo n.º 7
0
        public static PropertyInstance FindByTemplate(String propertyName, NewType propertyType, bool tryOnly)
        {
            IBytecodeBehaviorState state = BytecodeBehaviorState.State;
            PropertyInstance       pi    = state.GetProperty(propertyName, propertyType);

            if (pi != null)
            {
                return(pi);
            }
            if (tryOnly)
            {
                return(null);
            }
            throw new ArgumentException("No property found on class hierarchy: " + propertyName + ". Start type: " + state.NewType);
        }
Ejemplo n.º 8
0
        protected void ImplementValueHolderCode(PropertyInstance p_valueHolderContainerTemplate, PropertyInstance p_targetCache, PropertyInstance p_relationMembers)
        {
            RelationMember[] relationMembers = metaData.RelationMembers;
            NewType          owner           = State.NewType;

            for (int relationIndex = relationMembers.Length; relationIndex-- > 0;)
            {
                RelationMember relationMember = relationMembers[relationIndex];

                relationMember = (RelationMember)GetApplicableMember(relationMember);
                if (relationMember == null)
                {
                    // member is handled in another type
                    continue;
                }
                String           propertyName = relationMember.Name;
                IPropertyInfo    propertyInfo = propertyInfoProvider.GetProperty(relationMember.DeclaringType, propertyName);
                PropertyInstance prop         = PropertyInstance.FindByTemplate(propertyInfo, true);
                MethodInstance   m_get        = prop != null ? prop.Getter : new MethodInstance(((MethodPropertyInfo)propertyInfo).Getter);
                MethodInstance   m_set        = prop != null ? prop.Setter : new MethodInstance(((MethodPropertyInfo)propertyInfo).Setter);

                FieldInstance f_objRefs          = GetObjRefsFieldByPropertyName(propertyName);
                FieldInstance f_objRefs_existing = State.GetAlreadyImplementedField(f_objRefs.Name);

                FieldInstance f_initialized          = GetInitializedFieldByPropertyName(propertyName);
                FieldInstance f_initialized_existing = State.GetAlreadyImplementedField(f_initialized.Name);

                if (f_objRefs_existing == null)
                {
                    f_objRefs_existing = ImplementField(f_objRefs);
                    ImplementGetter(new MethodInstance(null, MethodAttributes.Public, f_objRefs_existing.Type, "get_" + f_objRefs_existing.Name),
                                    f_objRefs_existing);
                    ImplementSetter(
                        new MethodInstance(null, MethodAttributes.Public, NewType.VOID_TYPE, "set_" + f_objRefs_existing.Name, f_objRefs_existing.Type),
                        f_objRefs_existing);
                }
                if (f_initialized_existing == null)
                {
                    f_initialized_existing = ImplementField(f_initialized);
                    ImplementGetter(new MethodInstance(null, MethodAttributes.Public, f_initialized_existing.Type, "get_" + f_initialized_existing.Name),
                                    f_initialized_existing);
                    ImplementSetter(new MethodInstance(null, MethodAttributes.Public, NewType.VOID_TYPE, "set_" + f_initialized_existing.Name, f_initialized_existing.Type), f_initialized_existing);
                }

                ImplementRelationGetter(propertyName, m_get, m_set, relationIndex, p_valueHolderContainerTemplate, p_targetCache, p_relationMembers, f_initialized_existing, f_objRefs_existing);
                ImplementRelationSetter(propertyName, m_set, f_initialized_existing, f_objRefs_existing);
            }
        }
Ejemplo n.º 9
0
 public int Compare(NewType <NEWTYPE, A> mx, NewType <NEWTYPE, A> my)
 {
     if (ReferenceEquals(mx, my))
     {
         return(0);
     }
     if (ReferenceEquals(mx, null))
     {
         return(-1);
     }
     if (ReferenceEquals(my, null))
     {
         return(1);
     }
     return(default(ORD).Compare((A)mx, (A)my));
 }
        public async Task <ActionResult <JobType> > CreateType(NewType newType)
        {
            var tenant = (await _tenantService.GetTenantFromHostAsync());

            if (tenant != null)
            {
                Console.WriteLine($"creating type for {tenant.Id} : {tenant.Name}");
                using (var context = _tenantService.CreateContext(tenant))
                {
                    var jobExtrasService = new JobExtrasService(context);
                    return(Ok(await jobExtrasService.CreateJobType(newType)));
                }
            }

            return(BadRequest("Tenant doesn't exist"));
        }
Ejemplo n.º 11
0
        protected void ImplementHashCodeMethod(PropertyInstance p_entityEqualsTemplate)
        {
            MethodInstance methodTemplate = new MethodInstance(null, typeof(Object), typeof(int), "GetHashCode");
            MethodInstance method         = MethodInstance.FindByTemplate(methodTemplate, true);

            if (NewType.GetType(typeof(Object)).Equals(method.Owner) || method.Access.HasFlag(MethodAttributes.Abstract))
            {
                IMethodVisitor mg = VisitMethod(methodTemplate);
                mg.CallThisGetter(p_entityEqualsTemplate);
                mg.LoadThis();
                mg.LoadArgs();
                mg.InvokeVirtual(entityEquals_HashCode);
                mg.ReturnValue();
                mg.EndMethod();
            }
        }
Ejemplo n.º 12
0
 /// <summary>
 /// Equality test
 /// </summary>
 /// <param name="x">The left hand side of the equality operation</param>
 /// <param name="y">The right hand side of the equality operation</param>
 /// <returns>True if x and y are equal</returns>
 public bool Equals(NewType <NEWTYPE, A> x, NewType <NEWTYPE, A> y)
 {
     if (ReferenceEquals(x, y))
     {
         return(true);
     }
     if (ReferenceEquals(x, null))
     {
         return(false);
     }
     if (ReferenceEquals(y, null))
     {
         return(false);
     }
     return(default(EQ).Equals((A)x, (A)y));
 }
Ejemplo n.º 13
0
 private void PageInit()
 {
     if (action == "edit")
     {
         ltltitle.Text = "修改类别";
         ddl_type.Text = "0";
         NewType ClassItem = bll.GetNewTypeItem(classId);
         txt_ClassName.Text     = ClassItem.ClassName;
         ddl_type.SelectedValue = ClassItem.ParentId.ToString();
         txt_SortId.Value       = ClassItem.SortId.ToString();
     }
     else
     {
         ddl_type.SelectedValue = classId.ToString();
     }
 }
Ejemplo n.º 14
0
        private void CompareInterfaces()
        {
            IEnumerable <string> referenceInterfaces = ReferenceType.GetInterfaces().Select(@interface => @interface.GetCompareableName()).ToList();
            IEnumerable <string> newInterfaces       = NewType.GetInterfaces().Select(@interface => @interface.GetCompareableName()).ToList();

            // missing interfaces
            foreach (string @interface in referenceInterfaces.Except(newInterfaces))
            {
                ComparerResult.AddRemovedItem(ResultContext.Interface, @interface, Severity.Error);
            }

            // new interfaces
            foreach (string @interface in newInterfaces.Except(referenceInterfaces))
            {
                ComparerResult.AddAddedItem(ResultContext.Interface, @interface, Severity.Warning);
            }
        }
Ejemplo n.º 15
0
    static void Main(string[] args)
    {
        int TestNum = OnePlus(100);

        Console.WriteLine(TestNum);

        // NewType() 에 메서드 이름을 넣은것이 포인트!
        NewType aNewType = new NewType(OnePlus); // aNewType과 onePlus는 같아지는 거임

        TestNum = aNewType(1000);                // aNewType이 OnePlus에 값을 받음
        Console.WriteLine(TestNum);


        aNewType = new NewType(TenPlus);
        TestNum  = aNewType(1000);
        Console.WriteLine(TestNum);
    }
Ejemplo n.º 16
0
        static void Main(string[] args)
        {
            using (var db = new NewContext())
            {
                Console.WriteLine("请输入Name:");
                var name = Console.ReadLine();

                var newType = new NewType {
                    Name = name
                };
                db.NewTypes.Add(newType);
                db.SaveChanges();

                Console.WriteLine("Save successfully");
                Console.Read();
            }
        }
Ejemplo n.º 17
0
        public virtual void InvokeInterface(MethodInstance method)
        {
            if (method.Access.HasFlag(MethodAttributes.Static))
            {
                throw new ArgumentException("Given method is not virtual: " + method);
            }
            NewType owner = method.Owner;

            if (owner == null)
            {
                InvokeVirtual(method.DeriveOwner());
            }
            else
            {
                InvokeVirtual(method);
            }
        }
Ejemplo n.º 18
0
        public virtual IMethodVisitor StartOverrideWithSuperCall(MethodInstance superMethod)
        {
            IBytecodeBehaviorState state = State;

            NewType superType = NewType.GetType(state.CurrentType);

            if (!superType.Equals(superMethod.Owner))
            {
                throw new ArgumentException("Not a method of " + state.CurrentType + ": " + superMethod);
            }
            IMethodVisitor mg = VisitMethod(superMethod);

            mg.LoadThis();
            mg.LoadArgs();
            mg.InvokeSuper(superMethod);

            return(mg);
        }
Ejemplo n.º 19
0
        protected override void InternalProcessRecord()
        {
            bool test = false;
            ShouldProcessReason reason;

            if (!base.ShouldProcess(null, null, null, out reason))
            {
                if (reason == ShouldProcessReason.WhatIf)
                {
                    test = true;
                }
            }

            string fileUrl = File.FileUrl;

            SetWebPart(fileUrl, OldType.Read(), NewType.Read(), Title, Properties, Publish, test);

            base.InternalProcessRecord();
        }
Ejemplo n.º 20
0
        public ProductType AddType(NewType newType)
        {
            using (var db = new SqlConnection(_connectionString))
            {
                string selectQuery = @"INSERT Into ProductType (Name)
                                       OUTPUT inserted.*
                                       VALUES (@name)";

                var parameters = new { name = newType.Name };

                var productType = db.QueryFirstOrDefault <ProductType>(selectQuery, parameters);

                if (productType != null)
                {
                    return(productType);
                }
            }
            throw new Exception("error getting product types");
        }
Ejemplo n.º 21
0
 public PropertyInstance(NewType owner, PropertyAttributes access, String propertyName, MethodInstance getter, MethodInstance setter)
 {
     this.owner  = owner;
     this.access = access;
     this.name   = propertyName;
     this.getter = getter;
     this.setter = setter;
     if (getter != null)
     {
         propertyType = getter.ReturnType;
     }
     else if (setter != null)
     {
         propertyType = setter.Parameters[0];
     }
     else
     {
         throw new ArgumentException("Either a getter or a setter must be specified");
     }
 }
Ejemplo n.º 22
0
 protected void ImplementSelfGetter(PropertyInstance p_valueHolderContainerTemplate)
 {
     NewType        owner     = State.NewType;
     MethodInstance m_getSelf = new MethodInstance(owner, typeof(IValueHolderContainer), typeof(IObjRelation), "Get__Self", typeof(int));
     {
         // public IObjRelation getSelf(String memberName)
         // {
         // return ValueHolderContainerTemplate.GetSelf(this, relationIndex);
         // }
         IMethodVisitor mv = VisitMethod(m_getSelf);
         mv.CallThisGetter(p_valueHolderContainerTemplate);
         // this
         mv.LoadThis();
         // relationIndex
         mv.LoadArgs();
         mv.InvokeVirtual(m_template_getSelf);
         mv.ReturnValue();
         mv.EndMethod();
     }
 }
Ejemplo n.º 23
0
        protected override IList ExecuteCrawl(bool crawlAll)
        {
            IList list = new ArrayList();
            //GetCorpStaffDui(crawlAll, list);
            //GetCorpStaffShuili(crawlAll, list);
            //GetCorpStaffXiao(crawlAll, list);
            NewType      newType1 = new NewType(GetCorpStaffDui);
            IAsyncResult irr1     = newType1.BeginInvoke(crawlAll, list, null, null);
            NewType      newTypw2 = new NewType(GetCorpStaffShuili);
            IAsyncResult irr2     = newTypw2.BeginInvoke(crawlAll, list, null, null);
            NewType      newType3 = new NewType(GetCorpStaffXiao);
            IAsyncResult irr3     = newType3.BeginInvoke(crawlAll, list, null, null);
            NewMethod    newMeth1 = new NewMethod(GetCorpStaffJzao);
            IAsyncResult ir1      = newMeth1.BeginInvoke(2, crawlAll, list, null, null);
            NewMethod    newMeth2 = new NewMethod(GetCorpStaffJLi);
            IAsyncResult ir2      = newMeth2.BeginInvoke(3, crawlAll, list, null, null);
            NewMethod    newMeth3 = new NewMethod(GetCorpStaffZJia);
            IAsyncResult ir3      = newMeth3.BeginInvoke(4, crawlAll, list, null, null);
            NewMethod    newMeth4 = new NewMethod(GetCorpStaffZLZR);
            IAsyncResult ir4      = newMeth4.BeginInvoke(7, crawlAll, list, null, null);
            NewMethod    newMeth5 = new NewMethod(GetCorpStaffAQZR);
            IAsyncResult ir5      = newMeth5.BeginInvoke(8, crawlAll, list, null, null);
            NewMethod    newMeth6 = new NewMethod(GetCorpStaffXXXM);
            IAsyncResult ir6      = newMeth6.BeginInvoke(1, crawlAll, list, null, null);
            NewMethod    newMeth7 = new NewMethod(GetCorpStaffJZGCS);
            IAsyncResult ir7      = newMeth7.BeginInvoke(5, crawlAll, list, null, null);
            NewMethod    newMeth8 = new NewMethod(GetCorpStaffJGGCS);
            IAsyncResult ir8      = newMeth8.BeginInvoke(6, crawlAll, list, null, null);



            //GetCorpStaffJzao(2, crawlAll, list);//采集建造工程师
            //GetCorpStaffJLi(3, crawlAll, list);//采集监理工程师
            //GetCorpStaffZJia(4, crawlAll, list); //采集造价工程师
            //GetCorpStaffZLZR(7, crawlAll, list);//采集质量主任
            //GetCorpStaffAQZR(8, crawlAll, list);//采集安全主任
            //GetCorpStaffXXXM(1, crawlAll, list);// 采集小型工程项目负责人
            //GetCorpStaffJZGCS(5, crawlAll, list);// 采集建筑工程师
            //GetCorpStaffJGGCS(6, crawlAll, list);//采集结构工程师
            return(list);
        }
Ejemplo n.º 24
0
        public virtual void InvokeVirtual(MethodInstance method)
        {
            if (method.Access.HasFlag(MethodAttributes.Static))
            {
                throw new ArgumentException("Given method is not virtual: " + method);
            }
            NewType owner = method.Owner;

            if (owner == null)
            {
                owner = BytecodeBehaviorState.State.NewType;
            }
            if (method is ConstructorInstance)
            {
                gen.Emit(OpCodes.Callvirt, (ConstructorInfo)method.Method);
            }
            else
            {
                gen.Emit(OpCodes.Callvirt, (MethodInfo)method.Method);
            }
        }
Ejemplo n.º 25
0
        protected void ImplementEmbeddedConstructor(FieldInstance f_parentObject, ConstructorInstance superConstructor)
        {
            if (superConstructor.Parameters.Length > 0 && superConstructor.Parameters[0].Equals(f_parentObject.Type))
            {
                // super constructor already enhanced
                return;
            }
            bool baseIsEnhanced = false;//EntityEnhancer.IsEnhancedType(vs.CurrentType);

            NewType[] parameters = superConstructor.Parameters;
            NewType[] types;
            if (baseIsEnhanced)
            {
                // Only Pass-through constructors necessary. So signature remains the same
                types = null;//TypeUtil.GetClassesToTypes(..GetTypes(parameters);
            }
            else
            {
                types = new NewType[parameters.Length + 1];
                for (int a = parameters.Length + 1; a-- > 1;)
                {
                    types[a] = parameters[a - 1];
                }
                types[0] = f_parentObject.Type;
            }
            IMethodVisitor mv = VisitMethod(new ConstructorInstance(MethodAttributes.Public, types));

            mv.LoadThis();
            for (int a = 1, size = types.Length; a < size; a++)
            {
                mv.LoadArg(a); // Load constructor argument one by one, starting with the 2nd constructor argument
            }
            mv.InvokeConstructor(superConstructor);
            mv.PutThisField(f_parentObject, delegate(IMethodVisitor mv2)
            {
                mv2.LoadArg(0);
            });
            mv.ReturnValue();
            mv.EndMethod();
        }
Ejemplo n.º 26
0
        public dlgNewLayer(NewType Type)
        {
            InitializeComponent();
            this._type = Type;

            if (_type == NewType.Map) //Anpassen des Dialogs auf MAP - Standard ist LAYER!
            {
                this.Text = "New Map";
                this.label_LayerHeight.Text = "Map Height";
                this.label_LayerWidth.Text = "Map Width";
                this.label_ParallaxHeaderString.Text = "The base parallax scrolling value is:";
                this.groupBox_LayerDimensions.Text = "Map Dimensions";
                this.groupBox_Scrolling.Text = "Base scrolling value";
                this.button_AddLayer.Text = "Generate";
                this.groupBox_LayerInformation.Text = "General map information";
            }
            if (_type == NewType.EditLayer) //Anpassen des Dialogs auf MAP - Standard ist LAYER!
            {
                this.Text = "Edit Layer";
                this.button_AddLayer.Text = "Save";
            }
        }
Ejemplo n.º 27
0
        public static T SetState <T>(Type originalType, Type currentType, NewType newType, IServiceContext beanContext,
                                     IEnhancementHint context, IResultingBackgroundWorkerDelegate <T> runnable)
        {
            IBytecodeBehaviorState oldState = stateTL.Value;

            stateTL.Value = new BytecodeBehaviorState(currentType, newType, originalType, beanContext, context);
            try
            {
                return(runnable.Invoke());
            }
            finally
            {
                if (oldState != null)
                {
                    stateTL.Value = oldState;
                }
                else
                {
                    stateTL.Value = null;
                }
            }
        }
Ejemplo n.º 28
0
        private void CompareTypes()
        {
            IEnumerable <string> referenceTypes = GetTypeNames(() => ReferenceType.DefinedTypes).ToList();
            IEnumerable <string> newTypes       = GetTypeNames(() => NewType.DefinedTypes).ToList();

            // Missing types
            foreach (string type in referenceTypes.Except(newTypes))
            {
                ComparerResult.AddRemovedItem(GetItemType(ReferenceType.GetType(type)), type, Severities.TypeRemoved);
            }

            // New types
            foreach (string type in newTypes.Except(referenceTypes))
            {
                ComparerResult.AddAddedItem(GetItemType(NewType.GetType(type)), type, Severities.TypeAdded);
            }

            // Equal types
            foreach (string type in referenceTypes.Intersect(newTypes))
            {
                ComparerResult.AddComparerResult(ComparerContext.CreateComparer(ReferenceType.GetType(type), NewType.GetType(type)).Compare());
            }
        }
Ejemplo n.º 29
0
 public override IComparerResult Compare()
 {
     ComparerContext.LogDetail(string.Format("Comparing field '{0}'", ReferenceType));
     if (ReferenceType.FieldType.GetCompareableName() != NewType.FieldType.GetCompareableName())
     {
         ComparerResult.AddChangedProperty("Type", ReferenceType.FieldType.GetCompareableName(), NewType.FieldType.GetCompareableName(), Severity.Error);
     }
     if (ReferenceType.IsStatic != NewType.IsStatic)
     {
         ComparerResult.AddChangedFlag("Static", ReferenceType.IsStatic, Severity.Error);
     }
     if (ReferenceType.IsStatic && NewType.IsStatic && ReferenceType.FieldType.IsEnum)
     {
         // compare numeric enum values
         object referenceValue = ReferenceType.GetRawConstantValue();
         object newValue       = NewType.GetRawConstantValue();
         if (Convert.ToInt32(referenceValue) != Convert.ToInt32(newValue))
         {
             ComparerResult.AddChangedProperty("Value", referenceValue.ToString(), newValue.ToString(), Severity.Error);
         }
     }
     return(ComparerResult);
 }
Ejemplo n.º 30
0
        protected void ImplementToString()
        {
            PropertyInstance p_objRefTemplate = GetObjRefTemplatePI(this);

            MethodInstance methodSb;
            {
                methodSb = MethodInstance.FindByTemplate(template_m_toStringSb, true);
                if (methodSb == null || methodSb.Access.HasFlag(MethodAttributes.Abstract))
                {
                    IMethodVisitor mg = VisitMethod(template_m_toStringSb);
                    mg.CallThisGetter(p_objRefTemplate);
                    mg.LoadThis();
                    mg.LoadArgs();
                    mg.InvokeVirtual(m_objRef_toStringSb);
                    mg.ReturnValue();
                    mg.EndMethod();
                    methodSb = mg.Method;
                }
            }
            {
                MethodInstance method = MethodInstance.FindByTemplate(template_m_toString, true);
                if (method == null || NewType.GetType(typeof(Object)).Equals(method.Owner) || methodSb.Access.HasFlag(MethodAttributes.Abstract))
                {
                    IMethodVisitor    mg     = VisitMethod(template_m_toString);
                    LocalVariableInfo loc_sb = mg.NewLocal(typeof(StringBuilder));
                    mg.LoadThis();
                    mg.NewInstance(c_stringBuilder, null);
                    mg.StoreLocal(loc_sb);
                    mg.LoadLocal(loc_sb);
                    mg.InvokeVirtual(methodSb);
                    mg.LoadLocal(loc_sb);
                    mg.InvokeVirtual(new MethodInstance(null, typeof(StringBuilder), typeof(String), "ToString"));
                    mg.ReturnValue();
                    mg.EndMethod();
                }
            }
        }
Ejemplo n.º 31
0
        public ActionResult NewMetricType(NewType newType)
        {
            string JsonQuery = "{" +
                               "\"MetricClassId\":\"" + newType.MetricClassId + "\"," +
                               "\"MetricType\":\"" + newType.MetricType + "\"," +
                               "\"MetricUnitId\":\"" + newType.MetricUnitId + "\"," +
                               "}";


            JObject jObj = QueryMicroService(CreateNewMetricTypeEndpoint, "POST", JsonQuery);

            string message = "";

            if (jObj["status"].ToString() == "OK")
            {
                message = "New type created successfully!";
            }
            else
            {
                message = $"Failed to create new type.\n{jObj["result"].ToString()}";
            }

            return(Json(new { message }, JsonRequestBehavior.AllowGet));
        }