private object GetParameterCode(ICodeBase codeBase, DCEntityParametersModel parameterModel, EntityPropertyModel entityProperty) { e_ConvertType e_Convert = e_ConvertType.String; string pn = parameterModel.ParameterName; switch (this.MethodType) { case e_MethodType.Create: e_Convert = this.ConvertStrToType(entityProperty.DbType); break; case e_MethodType.Update: e_Convert = this.ConvertStrToType(entityProperty.DbType); break; case e_MethodType.Delete: e_Convert = this.ConvertStrToType(entityProperty.DbType); break; } return(parameterModel.GetRendered(codeBase, e_Convert, entityProperty.Required)); }
/// <summary> /// this method would return variable convert type like string,int,boo,... according to variable name /// </summary> public static e_ConvertType GetVariableConvertType(string variableName, Guid?processId, Guid?applicationPageId, IUnitOfWork unitOfWork) { e_ConvertType e_Convert = e_ConvertType.Integer; sysBpmsVariable sysBpmsVariable = unitOfWork.Repository <IVariableRepository>().GetInfo(processId, applicationPageId, variableName.Split('.')[0], null);; if (sysBpmsVariable != null) { switch ((sysBpmsVariable.e_VarTypeLU)sysBpmsVariable.VarTypeLU) { case sysBpmsVariable.e_VarTypeLU.String: e_Convert = e_ConvertType.String; break; case sysBpmsVariable.e_VarTypeLU.Uniqueidentifier: e_Convert = e_ConvertType.Uniqueidentifier; break; case sysBpmsVariable.e_VarTypeLU.Integer: e_Convert = e_ConvertType.Integer; break; case sysBpmsVariable.e_VarTypeLU.Decimal: e_Convert = e_ConvertType.Decimal; break; case sysBpmsVariable.e_VarTypeLU.List: break; case sysBpmsVariable.e_VarTypeLU.Object: switch ((sysBpmsVariable.e_RelationTypeLU)sysBpmsVariable.RelationTypeLU) { case sysBpmsVariable.e_RelationTypeLU.Entity: sysBpmsEntityDef sysEntity = unitOfWork.Repository <IEntityDefRepository>().GetInfo(sysBpmsVariable.EntityDefID.Value); if (sysEntity != null && variableName.Split('.').Count() == 2) { EntityPropertyModel propertyModel = sysEntity.AllProperties.FirstOrDefault(c => c.Name == variableName.Split('.')[1]); if (propertyModel != null) { switch (propertyModel.DbType) { case EntityPropertyModel.e_dbType.String: e_Convert = e_ConvertType.String; break; case EntityPropertyModel.e_dbType.Integer: e_Convert = e_ConvertType.Integer; break; case EntityPropertyModel.e_dbType.Decimal: e_Convert = e_ConvertType.Decimal; break; case EntityPropertyModel.e_dbType.Long: e_Convert = e_ConvertType.Long; break; case EntityPropertyModel.e_dbType.DateTime: e_Convert = e_ConvertType.DateTime; break; case EntityPropertyModel.e_dbType.Uniqueidentifier: e_Convert = e_ConvertType.Uniqueidentifier; break; case EntityPropertyModel.e_dbType.boolean: e_Convert = e_ConvertType.Boolean; break; } } } break; } break; case sysBpmsVariable.e_VarTypeLU.DateTime: e_Convert = e_ConvertType.DateTime; break; case sysBpmsVariable.e_VarTypeLU.Boolean: e_Convert = e_ConvertType.Boolean; break; } } return(e_Convert); }