diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Learun.Application.WebApi.csproj b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Learun.Application.WebApi.csproj index 5c72d0817..255fd4a95 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Learun.Application.WebApi.csproj +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Learun.Application.WebApi.csproj @@ -191,6 +191,7 @@ + diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/Device/LessonShow.cs b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/Device/LessonShow.cs new file mode 100644 index 000000000..2d95860cf --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/Device/LessonShow.cs @@ -0,0 +1,62 @@ +using Learun.Application.Base.SystemModule; +using Learun.Application.TwoDevelopment.EducationalAdministration; +using Microsoft.Ajax.Utilities; +using Nancy; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Learun.Application.WebApi.Modules.Device +{ + public class LessonShow: BaseNoAuthentication + { + + public LessonShow() : base("/app/lesson") + { + Get["/class/list"] = GetClassList; + Get["/arrangelesson"] = GetLesson; + Post["/class/bind"] = BindClass; + } + + DataSourceIBLL dataSourceIBLL = new DataSourceBLL(); + ClassInfoIBLL classInfoIBLL = new ClassInfoBLL(); + + + /// + /// 班级列表 + /// + /// + /// + public Response GetClassList(dynamic _) + { + //var keyValue = this.GetReqData(); 1=1 AND CheckMark=1 order by classno desc + var data = dataSourceIBLL.GetDataTable("bjsj", ""); + return Success(data); + } + + public Response BindClass(dynamic _) + { + var k = this.GetReq(); + classInfoIBLL.BindDevice(k.ClassNo, k.DeviceNo); + return Success("操作成功"); + } + public class BindDevClass + { + public string ClassNo { get; set; } + + public string DeviceNo { get; set; } + } + public Response GetLesson(dynamic _) + { + var bj = this.GetReq(); + var classInfo = classInfoIBLL.GetClassNoByDevice(bj.DeviceNo); + if (classInfo == null) return Fail("未找到班级"); + + return Success(data); + } + + + } +} diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ClassInfo/ClassInfoBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ClassInfo/ClassInfoBLL.cs index 464e8f45d..cabc2fd6d 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ClassInfo/ClassInfoBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ClassInfo/ClassInfoBLL.cs @@ -278,6 +278,45 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } } + public void BindDevice(string classno, string dev) + { + try + { + classInfoService.BindDevice(classno,dev); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + public ClassInfoEntity GetClassNoByDevice(string dev) + { + try + { + var bj= classInfoService.GetClassNoByDevice(dev); + return bj; + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + #endregion } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ClassInfo/ClassInfoEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ClassInfo/ClassInfoEntity.cs index cf4a69230..59f97ccd6 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ClassInfo/ClassInfoEntity.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ClassInfo/ClassInfoEntity.cs @@ -107,6 +107,11 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration /// [Column("CLASSSTATUS")] public string ClassStatus { get; set; } + /// + /// 设备编码 + /// + [Column("DeviceCode")] + public string DeviceCode { get; set; } #endregion #region 扩展操作 diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ClassInfo/ClassInfoIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ClassInfo/ClassInfoIBLL.cs index 603593434..a5d664577 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ClassInfo/ClassInfoIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ClassInfo/ClassInfoIBLL.cs @@ -69,5 +69,9 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration IEnumerable GetAllClass(); IEnumerable GetClassByMajorNo(string majorNo, string nj); + + void BindDevice(string classno, string dev); + + ClassInfoEntity GetClassNoByDevice(string dev); } } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ClassInfo/ClassInfoService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ClassInfo/ClassInfoService.cs index d86d9dbc4..dd946a9ea 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ClassInfo/ClassInfoService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ClassInfo/ClassInfoService.cs @@ -391,5 +391,52 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } } } + + public void BindDevice(string classno,string dev) + { + var db = this.BaseRepository("CollegeMIS"); + try + { + var cn = db.FindEntity(x => x.ClassNo == classno); + if (cn == null) throw new Exception("未找到班级"); + cn.DeviceCode = dev; + db.Update(cn); + + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + public ClassInfoEntity GetClassNoByDevice(string dev) + { + var db = this.BaseRepository("CollegeMIS"); + try + { + var cn = db.FindEntity(x => x.DeviceCode == dev); + if (cn == null) throw new Exception("未找到班级"); + + return cn; + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } } }