开源 企业版 高校版 私有云 模力方舟 AI 队友
代码拉取完成,页面将自动刷新
捐赠
捐赠前请先登录
扫描微信二维码支付
取消
支付完成
支付提示
将跳转至支付宝完成支付
确定
取消
1 Star 0 Fork 319

魏天佑/AI培训学习-题库-考试-视频-直播

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
已有帐号? 立即登录
文件
master
分支 (2)
标签 (8)
master
optimize
2.5.1
v2.4.4.38383
2.3
2.1.1.21041
2.0.8627
2.0.8460
2.0.8355
2.0Beta
master
分支 (2)
标签 (8)
master
optimize
2.5.1
v2.4.4.38383
2.3
2.1.1.21041
2.0.8627
2.0.8460
2.0.8355
2.0Beta
克隆/下载
克隆/下载
提示
下载代码请复制以下命令到终端执行
为确保你提交的代码身份被 Gitee 正确识别,请执行以下命令完成配置
初次使用 SSH 协议进行代码克隆、推送等操作时,需按下述提示完成 SSH 配置
1 生成 RSA 密钥
2 获取 RSA 公钥内容,并配置到 SSH公钥
在 Gitee 上使用 SVN,请访问 使用指南
使用 HTTPS 协议时,命令行会出现如下账号密码验证步骤。基于安全考虑,Gitee 建议 配置并使用私人令牌 替代登录密码进行克隆、推送等操作
Username for 'https://gitee.com': userName
Password for 'https://userName@gitee.com': # 私人令牌
master
分支 (2)
标签 (8)
master
optimize
2.5.1
v2.4.4.38383
2.3
2.1.1.21041
2.0.8627
2.0.8460
2.0.8355
2.0Beta
CourseCom.cs 22.98 KB
一键复制 编辑 原始数据 按行查看 历史
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425

using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WeiSha.Core;
using WeiSha.Data;
using Song.Entities;
using Song.ServiceInterfaces;
namespace Song.DataQuery.SQLite
{
public class CourseCom
{
/// <summary>
/// 学员购买的该课程
/// </summary>
/// <param name="stid">学员Id</param>
/// <param name="sear">用于检索课程的字符</param>
/// <param name="state">0不管是否过期,1必须是购买时效内的,2必须是购买时效外的</param>
/// <param name="enable">是否启用</param>
/// <param name="istry">是否试用,为null时取所有</param>
/// <param name="size"></param>
/// <param name="index"></param>
/// <param name="countSum"></param>
/// <returns></returns>
public List<Course> CourseForStudent(int stid, string sear, int state, bool? enable, bool? istry, int size, int index, out int countSum)
{
//当前学员
Accounts student = Business.Do<IAccounts>().AccountsSingle(stid);
if (student == null) throw new Exception("学员账号不存在");
//试用课程,不包括学员组关联课程
if (istry != null && (bool)istry)
{
WhereClip wc = Student_Course._.Ac_ID == stid;
if (enable != null) wc.And(Student_Course._.Stc_IsEnable == (bool)enable);
wc.And(Student_Course._.Stc_IsTry == (bool)istry);
if (!string.IsNullOrWhiteSpace(sear)) wc.And(Course._.Cou_Name.Contains(sear));
countSum = Gateway.Default.From<Course>()
.InnerJoin<Student_Course>(Student_Course._.Cou_ID == Course._.Cou_ID)
.Where(wc).Count();
return Gateway.Default.From<Course>()
.InnerJoin<Student_Course>(Student_Course._.Cou_ID == Course._.Cou_ID)
.Where(wc).OrderBy(Student_Course._.Stc_StartTime.Desc).ToList<Course>(size, (index - 1) * size);
}
/*
* 时效内课程和所有课程,包括了学员组关联课程,相对复杂,用了sql语句实现
*/
//实现Sqlite的支持
//学员购买课程记录中的课程
string sql1 = @"select cou.* from ""Course"" as cou inner join ""Student_Course"" as sc
on cou.""Cou_ID"" = sc.""Cou_ID""
where sc.""Ac_ID"" = {{acid}} and sc.""Stc_Type""!=5 and {{enable}} and {{istry}}
and {{expired}} ";
sql1 = sql1.Replace("{{acid}}", stid.ToString());
//是否查询禁用课程(在课程购买中的禁用,不是课程禁用)
if (enable != null) sql1 = sql1.Replace("{{enable}}", @"sc.""Stc_IsEnable"" = " + ((bool)enable ? 1 : 0));
else
sql1 = sql1.Replace("{{enable}}", "1=1");
//购买时间内的
if (state == 1)
sql1 = sql1.Replace("{{expired}}", @"(sc.""Stc_StartTime"" < datetime('now') and sc.""Stc_EndTime"" > datetime('now'))");
//过期的
else if (state == 2)
sql1 = sql1.Replace("{{expired}}", @"sc.""Stc_EndTime""<datetime('now')");
else
sql1 = sql1.Replace("{{expired}}", "1=1");
//试用
sql1 = sql1.Replace("{{istry}}", istry != null ? @"sc.""Stc_IsTry"" = " + ((bool)istry ? 1 : 0) : "1=1");
//学员组关联的课程
if (student.Sts_ID > 0)
{
StudentSort sort = Business.Do<IStudent>().SortSingle(student.Sts_ID);
if (sort != null && sort.Sts_IsUse)
{
string sql2 = @"select cou.* from ""Course"" as cou left join ""StudentSort_Course"" as ssc
on cou.""Cou_ID"" = ssc.""Cou_ID""
where ssc.""Sts_ID"" = " + student.Sts_ID;
//如果取过期课程,则去除学员组关联的课程
if (state == 2)
sql1 += "except " + sql2;
//正常情况下,是学员购买课程+学员组关联课程
else
sql1 += "union " + sql2;
}
}
//计算总数
string sql_total = @"select count(*) as count from ({{sql}}) as r";
if (!string.IsNullOrWhiteSpace(sear)) sql_total += @" where ""Cou_Name"" LIKE '%" + sear + "%'";
sql_total = sql_total.Replace("{{sql}}", sql1);
object o = Gateway.Default.FromSql(sql_total).ToScalar();
countSum = o == null ? 0 : Convert.ToInt32(o);
//综合sql1和sql2,主要是查询
string sql3 = @"
select * from (
select muster.*, sc.""Stc_EndTime"",ssc.""Ssc_ID"" from
(
{{sql}}
) as muster
left join
(
select * from ""Student_Course"" as sc
where sc.""Ac_ID""={{acid}} and sc.""Stc_IsEnable""=1 and sc.""Stc_Type""!=5
and (sc.""Stc_StartTime""<datetime('now') and sc.""Stc_EndTime"">datetime('now'))
and sc.""Cou_ID"" not in (select ""Cou_ID"" from ""StudentSort_Course"" where ""Sts_ID""={{stsid}})
) as sc on muster.""Cou_ID"" = sc.""Cou_ID""
left join
(
select * from ""StudentSort_Course"" where ""Sts_ID""={{stsid}}
) as ssc on muster.""Cou_ID"" = ssc.""Cou_ID"" order by muster.""Cou_ID"" desc
) where {{where}} LIMIT {{size}} OFFSET {{index}}";
sql3 = sql3.Replace("{{where}}", !string.IsNullOrWhiteSpace(sear) ? @" ""Cou_Name"" LIKE '%" + sear + "%'" : "1=1");
sql3 = sql3.Replace("{{sql}}", sql1);
sql3 = sql3.Replace("{{acid}}", stid.ToString());
sql3 = sql3.Replace("{{stsid}}", student.Sts_ID.ToString());
//分页
sql3 = sql3.Replace("{{size}}", size.ToString());
sql3 = sql3.Replace("{{index}}", ((index - 1) * size).ToString());
return Gateway.Default.FromSql(sql3).ToList<Course>();
}
/// <summary>
/// 学员购买的该课程,以及学员组关联的课程,不分页,不排序
/// </summary>
/// <param name="stid">学员id</param>
/// <param name="sear"></param>
/// <param name="state">0不管是否过期,1必须是购买时效内的,2必须是购买时效外的</param>
/// <param name="enable">是否启用</param>
/// <param name="istry"></param>
/// <returns></returns>
public List<Course> CourseForStudent(int stid, string sear, int state, bool? enable, bool? istry)
{
//当前学员
Accounts student = Business.Do<IAccounts>().AccountsSingle(stid);
if (student == null) throw new Exception("学员账号不存在");
//试用课程,不包括学员组关联课程
if (istry != null && (bool)istry)
{
WhereClip wc = Student_Course._.Ac_ID == stid;
if (enable != null) wc.And(Student_Course._.Stc_IsEnable == (bool)enable);
wc.And(Student_Course._.Stc_IsTry == (bool)istry);
if (!string.IsNullOrWhiteSpace(sear)) wc.And(Course._.Cou_Name.Contains(sear));
return Gateway.Default.From<Course>()
.InnerJoin<Student_Course>(Student_Course._.Cou_ID == Course._.Cou_ID)
.Where(wc).OrderBy(Student_Course._.Stc_StartTime.Desc).ToList<Course>();
}
/*
* 时效内课程和所有课程,包括了学员组关联课程,相对复杂,用了sql语句实现
*/
//学员购买课程记录中的课程
string sql1 = @"select cou.* from ""Course"" as cou inner join ""Student_Course"" as sc
on cou.""Cou_ID"" = sc.""Cou_ID""
where sc.""Ac_ID"" = {{acid}} and sc.""Stc_Type""!=5 and {{enable}} and {{istry}}
and {{expired}} ";
sql1 = sql1.Replace("{{acid}}", stid.ToString());
//是否查询禁用课程(在课程购买中的禁用,不是课程禁用)
if (enable != null) sql1 = sql1.Replace("{{enable}}", @"sc.""Stc_IsEnable"" = " + ((bool)enable ? 1 : 0));
else
sql1 = sql1.Replace("{{enable}}", "1=1");
//购买时间内的
if (state == 1)
sql1 = sql1.Replace("{{expired}}", @"(sc.""Stc_StartTime"" < datetime('now') and sc.""Stc_EndTime"" > datetime('now'))");
//过期的
else if (state == 2)
sql1 = sql1.Replace("{{expired}}", @"sc.""Stc_EndTime""<datetime('now')");
else
sql1 = sql1.Replace("{{expired}}", "1=1");
//试用
sql1 = sql1.Replace("{{istry}}", istry != null ? @"sc.""Stc_IsTry"" = " + ((bool)istry ? 1 : 0) : "1=1");
//学员组关联的课程
if (student.Sts_ID > 0)
{
StudentSort sort = Business.Do<IStudent>().SortSingle(student.Sts_ID);
if (sort != null && sort.Sts_IsUse)
{
string sql2 = @"select cou.* from ""Course"" as cou left join ""StudentSort_Course"" as ssc
on cou.""Cou_ID"" = ssc.""Cou_ID""
where ssc.""Sts_ID"" = " + student.Sts_ID;
//如果取过期课程,则去除学员组关联的课程
if (state == 2)
sql1 += "except " + sql2;
//正常情况下,是学员购买课程+学员组关联课程
else
sql1 += "union " + sql2;
}
}
return Gateway.Default.FromSql(sql1).ToList<Course>();
}
/// <summary>
/// 获取收入最多的课程
/// </summary>
/// <param name="orgid">机构Id</param>
/// <param name="sbjid">专业id</param>
/// <param name="size"></param>
/// <param name="index"></param>
/// <param name="countSum"></param>
/// <returns></returns>
public List<Course> RankIncome(int orgid, long sbjid, DateTime? start, DateTime? end, int size, int index, out int countSum)
{
countSum = this.CourseOfCount(orgid, sbjid, -1, null, null);
//支持Sqlite
string sql = @"select count as Cou_TryNum, * from (
select IFNULL(b.count,0) as count, c.* from ""Course"" as c left join
(SELECT ""Cou_ID"", sum(""Stc_Money"") as count
FROM ""Student_Course"" where {begin} and {over} group by ""Cou_ID"") as b
on c.""Cou_ID"" = b.""Cou_ID"" where ""Org_ID""= {orgid} and {sbjid}
) order by count desc
LIMIT {size} OFFSET {index}; ";
sql = sql.Replace("{orgid}", orgid.ToString());
sql = sql.Replace("{begin}", start != null ? "Stc_CrtTime>='" + ((DateTime)start).ToString("yyyy-MM-dd HH:mm:ss") + "'" : "1=1");
sql = sql.Replace("{over}", start != null ? "Stc_CrtTime<'" + ((DateTime)end).ToString("yyyy-MM-dd HH:mm:ss") + "'" : "1=1");
//按专业选取(包括专业的下级专业)
string sbjWhere = string.Empty;
if (sbjid > 0)
{
List<long> sbjids = Business.Do<ISubject>().TreeID(sbjid, orgid);
for (int i = 0; i < sbjids.Count; i++)
{
sbjWhere += @"""Sbj_ID""=" + sbjids[i] + " ";
if (i < sbjids.Count - 1) sbjWhere += " or ";
}
}
sql = sql.Replace("{sbjid}", sbjid > 0 ? "(" + sbjWhere + ")" : "1=1");
//分页
sql = sql.Replace("{size}", size.ToString());
sql = sql.Replace("{index}", ((index - 1) * size).ToString());
return Gateway.Default.FromSql(sql).ToList<Course>();
}
/// <summary>
/// 获取选学人数最多的课程列表,从多到少
/// </summary>
/// <param name="orgid">机构Id</param>
/// <param name="sbjid">专业id</param>
/// <returns></returns>
public List<Course> RankHot(int orgid, long sbjid, DateTime? start, DateTime? end, int size, int index, out int countSum)
{
countSum = this.CourseOfCount(orgid, sbjid, -1, null, null);
//支持sqlite
string sql = @"select count as Cou_TryNum, * from (
select IFNULL(b.count,0) as count, c.* from ""Course"" as c left join
(SELECT ""Cou_ID"", count(""Cou_ID"") as count
FROM ""Student_Course"" where 1 = 1 and 1 = 1 group by ""Cou_ID"") as b
on c.""Cou_ID"" = b.""Cou_ID"" where ""Org_ID"" = {orgid} and {sbjid}
) order by Cou_TryNum desc LIMIT {size} OFFSET {index}; ";
sql = sql.Replace("{orgid}", orgid.ToString());
sql = sql.Replace("{begin}", start != null ? @"""Stc_CrtTime"">='" + ((DateTime)start).ToString("yyyy-MM-dd HH:mm:ss") + "'" : "1=1");
sql = sql.Replace("{over}", start != null ? @"""Stc_CrtTime""<'" + ((DateTime)end).ToString("yyyy-MM-dd HH:mm:ss") + "'" : "1=1");
//按专业选取(包括专业的下级专业)
string sbjWhere = string.Empty;
if (sbjid > 0)
{
List<long> sbjids = Business.Do<ISubject>().TreeID(sbjid, orgid);
for (int i = 0; i < sbjids.Count; i++)
{
sbjWhere += @"""Sbj_ID""=" + sbjids[i] + " ";
if (i < sbjids.Count - 1) sbjWhere += " or ";
}
}
sql = sql.Replace("{sbjid}", sbjid > 0 ? "(" + sbjWhere + ")" : "1=1");
//分页
sql = sql.Replace("{size}", size.ToString());
sql = sql.Replace("{index}", ((index - 1) * size).ToString());
return Gateway.Default.FromSql(sql).ToList<Course>();
}
/// <summary>
/// 分页获取当前课程的学员(即学习该课程的学员),并计算出完成度
/// </summary>
/// <param name="couid"></param>
/// <param name="stsid"></param>
/// <param name="acc">学员账号或姓名</param>
/// <param name="name">学员的姓名</param>
/// <param name="idcard"></param>
/// <param name="mobi"></param>
/// <param name="start"></param>
/// <param name="end"></param>
/// <param name="size"></param>
/// <param name="index"></param>
/// <param name="countSum"></param>
/// <returns></returns>
public DataTable StudentLogPager(long couid, long stsid, string acc, string name, string idcard, string mobi,
DateTime? start, DateTime? end, int size, int index, out int countSum)
{
//支持sqlite
//计算总数的脚本
string sqlsum = @"select COUNT(*) as total from
(select * from ""Student_Course"" where {{where4sc}} and ({{start}} and {{end}}) ) as sc inner join
""Accounts"" as a on sc.""Ac_ID"" = a.""Ac_ID"" {{where4acc}}";
//购买记录的条件
string where4sc = "{{couid}} and {{stsid}}";
where4sc = where4sc.Replace("{{couid}}", couid > 0 ? @"""Student_Course"".""Cou_ID""=" + couid.ToString() : "1=1");
where4sc = where4sc.Replace("{{stsid}}", stsid > 0 ? @"""Student_Course"".""Sts_ID""=" + stsid.ToString() : "1=1");
//学员查询条件
string where4acc = "where {{acc}} and {{name}} and {{idcard}} and {{mobi}}";
where4acc = where4acc.Replace("{{acc}}", string.IsNullOrWhiteSpace(acc) ? "1=1" : @"a.""Ac_AccName"" LIKE '%" + acc + "%'");
where4acc = where4acc.Replace("{{name}}", string.IsNullOrWhiteSpace(name) ? "1=1" : @"a.""Ac_Name"" LIKE '%" + name + "%'");
where4acc = where4acc.Replace("{{idcard}}", string.IsNullOrWhiteSpace(idcard) ? "1=1" : @"a.""Ac_IDCardNumber"" LIKE '%" + idcard + "%'");
where4acc = where4acc.Replace("{{mobi}}", string.IsNullOrWhiteSpace(mobi) ? "1=1" : @"a.""Ac_MobiTel1"" LIKE '%" + mobi + "%'");
//计算满足条件的记录总数
sqlsum = sqlsum.Replace("{{start}}", start == null ? "1=1" : @"""Stc_StartTime"">='" + ((DateTime)start).ToString("yyyy-MM-dd HH:mm:ss") + "'");
sqlsum = sqlsum.Replace("{{end}}", end == null ? "1=1" : @"""Stc_StartTime""<'" + ((DateTime)end).ToString("yyyy-MM-dd HH:mm:ss") + "'");
sqlsum = sqlsum.Replace("{{where4acc}}", where4acc);
sqlsum = sqlsum.Replace("{{where4sc}}", where4sc);
object o = Gateway.Default.FromSql(sqlsum).ToScalar();
countSum = o == null ? 0 : Convert.ToInt32(o);
//分页查询的脚本
string sqljquery = string.Empty;
sqljquery = @" select * from
(select a.*,sc.""Cou_ID"",sc.""Stc_QuesScore"",sc.""Stc_StudyScore"",sc.""Stc_ExamScore"",sc.""Stc_ResultScore"",sc.""Stc_ID"" from
(select * from ""Student_Course"" where {{where4sc}} and {{start}} and {{end}}) as sc inner join
""Accounts"" as a on sc.""Ac_ID"" = a.""Ac_ID"" {{where4acc}} order by ""Ac_ID"" desc LIMIT {{size}} OFFSET {{index}} )
as acc
left join
(SELECT ""Ac_ID"", MAX(""Cou_ID"") as Cou_ID, MAX(""Lss_LastTime"") as lastTime,
SUM(""Lss_StudyTime"") as studyTime, SUM(""Lss_Duration"") / 1000 as totalTime, MAX(""Lss_PlayTime"") / 100 as playTime,
(CASE WHEN MAX(""Lss_Duration"")> 0 THEN
(1000 * sum(""Lss_StudyTime"") / sum(""Lss_Duration"")) * 100
ELSE 0 END
) AS complete
FROM ""LogForStudentStudy"" where {{couid}} group by ""Ac_ID"") as lss
on acc.""Ac_ID"" = lss.""Ac_ID"" and acc.""Cou_ID"" = lss.Cou_ID";
sqljquery = sqljquery.Replace("{{couid}}", couid > 0 ? @"""Cou_ID""=" + couid : "1=1");
sqljquery = sqljquery.Replace("{{start}}", start == null ? "1=1" : @"""Stc_StartTime"">='" + ((DateTime)start).ToString("yyyy-MM-dd HH:mm:ss") + "'");
sqljquery = sqljquery.Replace("{{end}}", end == null ? "1=1" : @"""Stc_StartTime""<'" + ((DateTime)end).ToString("yyyy-MM-dd HH:mm:ss") + "'");
sqljquery = sqljquery.Replace("{{where4acc}}", where4acc);
sqljquery = sqljquery.Replace("{{where4sc}}", where4sc);
sqljquery = sqljquery.Replace("{{size}}", size.ToString());
sqljquery = sqljquery.Replace("{{index}}", ((index - 1) * size).ToString());
DataSet ds = Gateway.Default.FromSql(sqljquery).ToDataSet();
//完成度大于100,则等于100
DataTable dt = ds.Tables[0];
foreach (DataRow dr in dt.Rows)
{
for (int i = 0; i < dt.Columns.Count; i++)
{
if (dt.Columns[i].ColumnName == "complete")
{
if (dr[i].ToString() != "")
{
double complete = 0;
double.TryParse(dr[i].ToString(), out complete);
complete = complete >= 100 ? 100 : complete;
dr[i] = complete;
}
}
}
}
return dt;
}
/// <summary>
/// 课程收益汇总
/// </summary>
/// <param name="orgid">机构id</param>
/// <param name="sbjid">专业id</param>
/// <param name="start">起始时间</param>
/// <param name="end">结束时间</param>
/// <returns></returns>
public decimal Income(int orgid, long sbjid, DateTime? start, DateTime? end)
{
//按专业选取(包括专业的下级专业)
string sql = @"select IFNULL(SUM(total),0) from (select IFNULL(b.total,0) as 'total' from course as c left join
(SELECT cou_id, sum(Stc_Money) as 'total'
FROM[Student_Course] where {start} and {end} group by cou_id) as b
on c.cou_id = b.cou_id where org_id={orgid} and {sbjid} ) as tm ";
sql = sql.Replace("{orgid}", orgid.ToString());
sql = sql.Replace("{start}", start != null ? "Stc_CrtTime>='" + ((DateTime)start).ToString("yyyy-MM-dd HH:mm:ss") + "'" : "1=1");
sql = sql.Replace("{end}", start != null ? "Stc_CrtTime<'" + ((DateTime)end).ToString("yyyy-MM-dd HH:mm:ss") + "'" : "1=1");
string sbjWhere = string.Empty;
if (sbjid > 0)
{
List<long> sbjids = Business.Do<ISubject>().TreeID(sbjid, orgid);
for (int i = 0; i < sbjids.Count; i++)
{
sbjWhere += "sbj_id=" + sbjids[i] + " ";
if (i < sbjids.Count - 1) sbjWhere += " or ";
}
}
sql = sql.Replace("{sbjid}", sbjid > 0 ? "(" + sbjWhere + ")" : "1=1");
object obj = Gateway.Default.FromSql(sql).ToScalar();
return obj == null ? 0 : Convert.ToDecimal(obj);
}
#region 相关方法
/// <summary>
/// 课程数量
/// </summary>
/// <param name="orgid">机构id</param>
/// <param name="sbjid">专业id</param>
/// <param name="thid">教师id</param>
/// <param name="isuse">是否包括启用的课程,null取所有,true取启用的,false取未启用的</param>
/// <param name="isfree">是否免费</param>
/// <returns></returns>
public int CourseOfCount(int orgid, long sbjid, int thid, bool? isuse, bool? isfree)
{
WhereClip wc = new WhereClip();
if (orgid > 0) wc.And(Course._.Org_ID == orgid);
if (sbjid > 0)
{
WhereClip wcSbjid = new WhereClip();
List<long> list = Business.Do<ISubject>().TreeID(sbjid, orgid);
foreach (long l in list)
wcSbjid.Or(Course._.Sbj_ID == l);
wc.And(wcSbjid);
}
if (thid > 0) wc.And(Course._.Th_ID == thid);
if (isuse != null) wc.And(Course._.Cou_IsUse == (bool)isuse);
if (isfree != null) wc.And(Course._.Cou_IsFree == (bool)isfree);
return Gateway.Default.Count<Course>(wc);
}
#endregion
}
}
Loading...
举报
举报成功
我们将于2个工作日内通过站内信反馈结果给你!
请认真填写举报原因,尽可能描述详细。
请选择举报类型
取消
发送
误判申诉

此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。

如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。

取消
提交

简介

集成AI,更智能。适用于培训学习、在线教育、网校、知识付费、企业内训、员工考评、继续教育、资格考试等。"学、练、考"一体,直播、视频学习、试题练习、测试、考试、学习证明、成绩打印。社区版功能完整,供开源社区交流学习。
取消

发行版

暂无发行版

贡献者

全部

近期动态

不能加载更多了
编辑仓库简介
简介内容
主页
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C#
1
https://gitee.com/weity/LearningSystem.git
git@gitee.com:weity/LearningSystem.git
weity
LearningSystem
AI培训学习-题库-考试-视频-直播
master
点此查找更多帮助

搜索帮助

评论
仓库举报
回到顶部
登录提示
该操作需登录 Gitee 帐号,请先登录后再操作。
立即登录
没有帐号,去注册

AltStyle によって変換されたページ (->オリジナル) /