|
@@ -24,7 +24,7 @@ namespace TEAMModelFunction
|
|
MQActivity activity = null;
|
|
MQActivity activity = null;
|
|
try
|
|
try
|
|
{
|
|
{
|
|
- var aactivity = await client.GetContainer(Constant.TEAMModelOS, "Common").ReadItemStreamAsync(id, new Azure.Cosmos.PartitionKey(code));
|
|
|
|
|
|
+ var aactivity = await client.GetContainer("TEAMModelOS", "Common").ReadItemStreamAsync(id, new Azure.Cosmos.PartitionKey(code));
|
|
using var da = await JsonDocument.ParseAsync(aactivity.ContentStream);
|
|
using var da = await JsonDocument.ParseAsync(aactivity.ContentStream);
|
|
activity = da.ToObject<MQActivity>();
|
|
activity = da.ToObject<MQActivity>();
|
|
}
|
|
}
|
|
@@ -59,7 +59,7 @@ namespace TEAMModelFunction
|
|
taskStatus = -1,
|
|
taskStatus = -1,
|
|
classIds = classes
|
|
classIds = classes
|
|
};
|
|
};
|
|
- await client.GetContainer(Constant.TEAMModelOS, "Student").UpsertItemAsync(stucourse, new PartitionKey(stucourse.code));
|
|
|
|
|
|
+ await client.GetContainer("TEAMModelOS", "Teacher").UpsertItemAsync(stucourse, new PartitionKey(stucourse.code));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (students.IsNotEmpty())
|
|
if (students.IsNotEmpty())
|
|
@@ -86,7 +86,7 @@ namespace TEAMModelFunction
|
|
taskStatus = -1,
|
|
taskStatus = -1,
|
|
classIds = classes
|
|
classIds = classes
|
|
};
|
|
};
|
|
- await client.GetContainer(Constant.TEAMModelOS, "Student").UpsertItemAsync(stucourse, new PartitionKey(stucourse.code));
|
|
|
|
|
|
+ await client.GetContainer("TEAMModelOS", "Student").UpsertItemAsync(stucourse, new PartitionKey(stucourse.code));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -98,14 +98,14 @@ namespace TEAMModelFunction
|
|
{
|
|
{
|
|
foreach (var x in stuActivities)
|
|
foreach (var x in stuActivities)
|
|
{
|
|
{
|
|
- await client.GetContainer(Constant.TEAMModelOS, "Student").UpsertItemAsync(x, new PartitionKey(x.code));
|
|
|
|
|
|
+ await client.GetContainer("TEAMModelOS", "Student").UpsertItemAsync(x, new PartitionKey(x.code));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (tmdActivities.IsNotEmpty())
|
|
if (tmdActivities.IsNotEmpty())
|
|
{
|
|
{
|
|
foreach (var x in tmdActivities)
|
|
foreach (var x in tmdActivities)
|
|
{
|
|
{
|
|
- await client.GetContainer(Constant.TEAMModelOS, "Student").UpsertItemAsync(x, new PartitionKey(x.code));
|
|
|
|
|
|
+ await client.GetContainer("TEAMModelOS", "Teacher").UpsertItemAsync(x, new PartitionKey(x.code));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} catch (Exception ex) {
|
|
} catch (Exception ex) {
|
|
@@ -131,13 +131,13 @@ namespace TEAMModelFunction
|
|
string sql = string.Join(" , ", sqlList);
|
|
string sql = string.Join(" , ", sqlList);
|
|
if (!string.IsNullOrEmpty(school))
|
|
if (!string.IsNullOrEmpty(school))
|
|
{
|
|
{
|
|
- await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<ClassInfo>(queryText: $"select c.id,c.name ,c.periodId,c.year from c where c.id in ({sql})",
|
|
|
|
|
|
+ await foreach (var item in client.GetContainer("TEAMModelOS", "School").GetItemQueryIterator<ClassInfo>(queryText: $"select c.id,c.name ,c.periodId,c.year from c where c.id in ({sql})",
|
|
requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"Class-{school}") }))
|
|
requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"Class-{school}") }))
|
|
{
|
|
{
|
|
|
|
|
|
classInfos.Add(item);
|
|
classInfos.Add(item);
|
|
}
|
|
}
|
|
- await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<ClassInfo>(queryText: $"select c.id,c.name from c where c.id in ({sql})",
|
|
|
|
|
|
+ await foreach (var item in client.GetContainer("TEAMModelOS", "School").GetItemQueryIterator<ClassInfo>(queryText: $"select c.id,c.name from c where c.id in ({sql})",
|
|
requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"StuList-{school}") }))
|
|
requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"StuList-{school}") }))
|
|
{
|
|
{
|
|
//item.from = "SchStuList";
|
|
//item.from = "SchStuList";
|
|
@@ -145,7 +145,7 @@ namespace TEAMModelFunction
|
|
}
|
|
}
|
|
}
|
|
}
|
|
List<StuList> tchLists = new List<StuList>();
|
|
List<StuList> tchLists = new List<StuList>();
|
|
- await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Teacher").GetItemQueryIterator<ClassInfo>(queryText: $"select c.id,c.name from c where c.id in ({sql})",
|
|
|
|
|
|
+ await foreach (var item in client.GetContainer("TEAMModelOS", "Teacher").GetItemQueryIterator<ClassInfo>(queryText: $"select c.id,c.name from c where c.id in ({sql})",
|
|
requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"StuList") }))
|
|
requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"StuList") }))
|
|
{
|
|
{
|
|
// item.from = "TchStuList";
|
|
// item.from = "TchStuList";
|
|
@@ -180,19 +180,19 @@ namespace TEAMModelFunction
|
|
List<Student> students = new List<Student>();
|
|
List<Student> students = new List<Student>();
|
|
if (!string.IsNullOrEmpty(school))
|
|
if (!string.IsNullOrEmpty(school))
|
|
{
|
|
{
|
|
- await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<StuList>(queryText: $"select value(c) from c where c.id in ({sql})",
|
|
|
|
|
|
+ await foreach (var item in client.GetContainer("TEAMModelOS", "School").GetItemQueryIterator<StuList>(queryText: $"select value(c) from c where c.id in ({sql})",
|
|
requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"StuList-{school}") }))
|
|
requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"StuList-{school}") }))
|
|
{
|
|
{
|
|
schList.Add(item);
|
|
schList.Add(item);
|
|
}
|
|
}
|
|
- await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Student").GetItemQueryIterator<Student>(queryText: $"select value(c) from c where c.classId in ({sql})",
|
|
|
|
|
|
+ await foreach (var item in client.GetContainer("TEAMModelOS", "Student").GetItemQueryIterator<Student>(queryText: $"select value(c) from c where c.classId in ({sql})",
|
|
requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"Base-{school}") }))
|
|
requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"Base-{school}") }))
|
|
{
|
|
{
|
|
students.Add(item);
|
|
students.Add(item);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
List<StuList> tchLists = new List<StuList>();
|
|
List<StuList> tchLists = new List<StuList>();
|
|
- await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Teacher").GetItemQueryIterator<StuList>(queryText: $"select value(c) from c where c.id in ({sql})",
|
|
|
|
|
|
+ await foreach (var item in client.GetContainer("TEAMModelOS", "Teacher").GetItemQueryIterator<StuList>(queryText: $"select value(c) from c where c.id in ({sql})",
|
|
requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"StuList") }))
|
|
requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"StuList") }))
|
|
{
|
|
{
|
|
tchLists.Add(item);
|
|
tchLists.Add(item);
|
|
@@ -230,7 +230,7 @@ namespace TEAMModelFunction
|
|
tmdids.ForEach(x => { inids.Add($"'{x}'"); });
|
|
tmdids.ForEach(x => { inids.Add($"'{x}'"); });
|
|
var insql = string.Join(",", inids);
|
|
var insql = string.Join(",", inids);
|
|
var queryslt = $"SELECT value(c) FROM c where c.id in ({insql})";
|
|
var queryslt = $"SELECT value(c) FROM c where c.id in ({insql})";
|
|
- await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Student").GetItemQueryIterator<TmdInfo>(queryText: queryslt, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base") }))
|
|
|
|
|
|
+ await foreach (var item in client.GetContainer("TEAMModelOS", "Teacher").GetItemQueryIterator<TmdInfo>(queryText: queryslt, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base") }))
|
|
{
|
|
{
|
|
infos.Add(item);
|
|
infos.Add(item);
|
|
}
|
|
}
|
|
@@ -245,7 +245,7 @@ namespace TEAMModelFunction
|
|
PartitionKey partitionKey = new PartitionKey($"Base-{gp.key.Replace("Base-", "")}");
|
|
PartitionKey partitionKey = new PartitionKey($"Base-{gp.key.Replace("Base-", "")}");
|
|
var insqlstu = string.Join(",", inidstus);
|
|
var insqlstu = string.Join(",", inidstus);
|
|
var querystu = $"SELECT c.id,c.code,c.name,c.picture,c.classId,c.year,c.schoolId FROM c where c.id in ({insqlstu})";
|
|
var querystu = $"SELECT c.id,c.code,c.name,c.picture,c.classId,c.year,c.schoolId FROM c where c.id in ({insqlstu})";
|
|
- await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Student").GetItemQueryIterator<StuInfo>(queryText: querystu, requestOptions: new QueryRequestOptions() { PartitionKey= partitionKey }))
|
|
|
|
|
|
+ await foreach (var item in client.GetContainer("TEAMModelOS", "Student").GetItemQueryIterator<StuInfo>(queryText: querystu, requestOptions: new QueryRequestOptions() { PartitionKey= partitionKey }))
|
|
{
|
|
{
|
|
stuInfos.Add(item);
|
|
stuInfos.Add(item);
|
|
}
|
|
}
|
|
@@ -347,19 +347,19 @@ namespace TEAMModelFunction
|
|
List<StuList> schList = new List<StuList>();
|
|
List<StuList> schList = new List<StuList>();
|
|
List<Student> students = new List<Student>();
|
|
List<Student> students = new List<Student>();
|
|
if (!string.IsNullOrEmpty(school)) {
|
|
if (!string.IsNullOrEmpty(school)) {
|
|
- await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<StuList>(queryText: $"select value(c) from c where c.id in ({sql})",
|
|
|
|
|
|
+ await foreach (var item in client.GetContainer("TEAMModelOS", "School").GetItemQueryIterator<StuList>(queryText: $"select value(c) from c where c.id in ({sql})",
|
|
requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"StuList-{school}") }))
|
|
requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"StuList-{school}") }))
|
|
{
|
|
{
|
|
schList.Add(item);
|
|
schList.Add(item);
|
|
}
|
|
}
|
|
- await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Student").GetItemQueryIterator<Student>(queryText: $"select value(c) from c where c.classId in ({sql})",
|
|
|
|
|
|
+ await foreach (var item in client.GetContainer("TEAMModelOS", "Student").GetItemQueryIterator<Student>(queryText: $"select value(c) from c where c.classId in ({sql})",
|
|
requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"Base-{school}") }))
|
|
requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"Base-{school}") }))
|
|
{
|
|
{
|
|
students.Add(item);
|
|
students.Add(item);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
List<StuList> tchLists = new List<StuList>();
|
|
List<StuList> tchLists = new List<StuList>();
|
|
- await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Teacher").GetItemQueryIterator<StuList>(queryText: $"select value(c) from c where c.id in ({sql})",
|
|
|
|
|
|
+ await foreach (var item in client.GetContainer("TEAMModelOS", "Teacher").GetItemQueryIterator<StuList>(queryText: $"select value(c) from c where c.id in ({sql})",
|
|
requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"StuList") }))
|
|
requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"StuList") }))
|
|
{
|
|
{
|
|
tchLists.Add(item);
|
|
tchLists.Add(item);
|
|
@@ -394,7 +394,7 @@ namespace TEAMModelFunction
|
|
tmdids.ForEach(x => { inids.Add($"'{x}'"); });
|
|
tmdids.ForEach(x => { inids.Add($"'{x}'"); });
|
|
var insql = string.Join(",", inids);
|
|
var insql = string.Join(",", inids);
|
|
var queryslt = $"SELECT value(c) FROM c where c.id in ({insql})";
|
|
var queryslt = $"SELECT value(c) FROM c where c.id in ({insql})";
|
|
- await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Student").GetItemQueryIterator<TmdInfo>(queryText: queryslt, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base") }))
|
|
|
|
|
|
+ await foreach (var item in client.GetContainer("TEAMModelOS", "Teacher").GetItemQueryIterator<TmdInfo>(queryText: queryslt, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base") }))
|
|
{
|
|
{
|
|
infos.Add(item);
|
|
infos.Add(item);
|
|
}
|
|
}
|
|
@@ -404,7 +404,7 @@ namespace TEAMModelFunction
|
|
List<string> inidstus = new List<string>();
|
|
List<string> inidstus = new List<string>();
|
|
foreach (Students stu in studentss) {
|
|
foreach (Students stu in studentss) {
|
|
var querystu = $"SELECT c.id,c.code,c.name,c.picture,c.classId,c.year,c.schoolId FROM c where c.id = '{stu.id}'";
|
|
var querystu = $"SELECT c.id,c.code,c.name,c.picture,c.classId,c.year,c.schoolId FROM c where c.id = '{stu.id}'";
|
|
- await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Student").GetItemQueryIterator<StuInfo>(queryText: querystu, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"{stu.code}") }))
|
|
|
|
|
|
+ await foreach (var item in client.GetContainer("TEAMModelOS", "Student").GetItemQueryIterator<StuInfo>(queryText: querystu, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"{stu.code}") }))
|
|
{
|
|
{
|
|
stuInfos.Add(item);
|
|
stuInfos.Add(item);
|
|
}
|
|
}
|
|
@@ -412,7 +412,7 @@ namespace TEAMModelFunction
|
|
/*studentss.Select(x => x.id).ToList().ForEach(x => { inidstus.Add($"'{x}'"); });
|
|
/*studentss.Select(x => x.id).ToList().ForEach(x => { inidstus.Add($"'{x}'"); });
|
|
var insqlstu = string.Join(",", inidstus);
|
|
var insqlstu = string.Join(",", inidstus);
|
|
var querystu = $"SELECT c.id,c.code,c.name,c.picture,c.classId,c.year,c.schoolId FROM c where c.id in ({insqlstu})";
|
|
var querystu = $"SELECT c.id,c.code,c.name,c.picture,c.classId,c.year,c.schoolId FROM c where c.id in ({insqlstu})";
|
|
- await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Student").GetItemQueryIterator<StuInfo>(queryText: querystu, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base-{school}") }))
|
|
|
|
|
|
+ await foreach (var item in client.GetContainer("TEAMModelOS", "Student").GetItemQueryIterator<StuInfo>(queryText: querystu, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base-{school}") }))
|
|
{
|
|
{
|
|
stuInfos.Add(item);
|
|
stuInfos.Add(item);
|
|
}*/
|
|
}*/
|