public IActionResult EditDelegateCourseAdminField( int progressId, int promptNumber, DelegateAccessRoute accessedVia, ReturnPageQuery?returnPageQuery = null ) { var delegateCourseProgress = progressService.GetDetailedCourseProgress(progressId); var courseAdminField = courseAdminFieldsService.GetCourseAdminFieldsForCourse( delegateCourseProgress !.CustomisationId ).AdminFields.Find(caf => caf.PromptNumber == promptNumber); if (courseAdminField == null) { return(new NotFoundResult()); } var model = new EditDelegateCourseAdminFieldViewModel( progressId, promptNumber, delegateCourseProgress, accessedVia, returnPageQuery ); return(View(model)); }
/// <summary> /// 判断字段是否存在 /// </summary> /// <param name="list">列表</param> /// <param name="field">字段</param> /// <returns>返回true存在,否则不存在</returns> public static bool IsExistField(List<AdminFields> list, AdminFields field) { foreach ( AdminFields f in list ) { if ( f == field ) { return true; } } return false; }
/// <summary> /// 设置SqlParameterWrapperCollection /// </summary> /// <param name="collection">SqlParameterWrapperCollection</param> /// <param name="field">字段</param> /// <param name="fieldVariable">字段变量</param> /// <param name="fieldValue">值</param> public static void SetSqlParameterWrapperCollection(SqlParameterWrapperCollection collection, AdminFields field, string fieldVariable, object fieldValue) { switch ( field ) { case AdminFields.AId: collection.Add(new SqlParameterWrapper("@" + fieldVariable, fieldValue, SqlDbType.Int)); break; case AdminFields.AName: collection.Add(new SqlParameterWrapper("@" + fieldVariable, fieldValue, SqlDbType.NVarChar)); break; case AdminFields.APassword: collection.Add(new SqlParameterWrapper("@" + fieldVariable, fieldValue, SqlDbType.NVarChar)); break; case AdminFields.AEmail: collection.Add(new SqlParameterWrapper("@" + fieldVariable, fieldValue, SqlDbType.NVarChar)); break; case AdminFields.ATelephone: collection.Add(new SqlParameterWrapper("@" + fieldVariable, fieldValue, SqlDbType.NVarChar)); break; case AdminFields.ARowValid: collection.Add(new SqlParameterWrapper("@" + fieldVariable, fieldValue, SqlDbType.TinyInt)); break; case AdminFields.ACreateTime: collection.Add(new SqlParameterWrapper("@" + fieldVariable, fieldValue, SqlDbType.DateTime)); break; case AdminFields.AScenicId: collection.Add(new SqlParameterWrapper("@" + fieldVariable, fieldValue, SqlDbType.NVarChar)); break; case AdminFields.AUserId: collection.Add(new SqlParameterWrapper("@" + fieldVariable, fieldValue, SqlDbType.NVarChar)); break; case AdminFields.AUserLimit: collection.Add(new SqlParameterWrapper("@" + fieldVariable, fieldValue, SqlDbType.TinyInt)); break; } }
/// <summary> /// 获取对象 /// </summary> /// <param name="dbType">数据库类型</param> /// <param name="showField">字段</param> /// <param name="whereFields">条件字段</param> /// <returns>返回Admin表格</returns> public object GetObject(DataBaseType dbType, AdminFields showField, List<AdminWhereFields> whereFields) { string sqlDescription = "/*" + DatabaseManager.SqlDescription + "/Author:TCSmartFrameWork自动生成/For:Admin表查询操作/File:AdminAccess.cs/Fun:GetTopAdminTable*/"; StringBuilder sql = new StringBuilder(); sql.Append(sqlDescription); sql.Append("select "+ showField.ToString()+" from ["+ DatabaseManager.Db_JQEBookingDataBase+"].[dbo].[Admin] with(nolock)"); SqlParameterWrapperCollection collection = new SqlParameterWrapperCollection(); if ( whereFields != null && whereFields.Count > 0 ) { sql.Append(" where "); sql.Append(GetSqlString(null, whereFields)); } GetSqlParameterWrapperCollection(collection, null, whereFields); return SqlHelper.ExecuteScalar(DatabaseManager.GetDataBase(DatabaseManager.Db_JQEBookingConfig,dbType),sql.ToString(),collection); }
/// <summary> /// 获取对象 /// </summary> /// <param name="showField">字段</param> /// <param name="whereFields">条件字段</param> /// <returns>返回Admin表格</returns> public object GetObject(AdminFields showField, List<AdminWhereFields> whereFields) { return GetObject(DataBaseType.Read,showField,whereFields); }
/// <summary> ///Admin字段值 /// </summary> /// <param name="field">Admin字段</param> /// <param name="fieldValue">字段值</param> /// <param name="queryOperator">条件操作类型</param> /// <param name="queryCondition">条件关系</param> public AdminWhereFields(AdminFields field,object fieldValue, QueryCondition queryCondition,QueryOperator queryOperator) { this.field = field; this.fieldValue = fieldValue; this.queryOperator = queryOperator; this.queryCondition = queryCondition; }
/// <summary> ///Admin字段值 /// </summary> /// <param name="field">Admin字段</param> /// <param name="fieldValue">字段值</param> public AdminWhereFields(AdminFields field,object fieldValue) { this.field = field; this.fieldValue = fieldValue; this.queryOperator = QueryOperator.And; this.queryCondition = QueryCondition.Equal; }
/// <summary> ///Admin排序字段 /// </summary> /// <param name="field">Admin字段</param> /// <param name="order">排序类型</param> public AdminOrderFields(AdminFields field, OrderType order) { this.field = field; this.order = order; }
/// <summary> ///Admin排序字段 /// </summary> /// <param name="field">Admin字段</param> public AdminOrderFields(AdminFields field) { this.field = field; this.order = OrderType.Asc; }
/// <summary> ///Admin字段值 /// </summary> /// <param name="field">Admin字段</param> /// <param name="fieldValue">字段值</param> public AdminFieldValuePair(AdminFields field,object fieldValue) { this.field = field; this.fieldValue = fieldValue; }