/// <summary> /// Fixed: /// </summary> private static void InitializeIssues( Context context, DemoModel demoModel, string parentId, Dictionary <string, long> idHash) { Def.DemoDefinitionCollection .Where(o => o.ParentId == parentId) .Where(o => o.Type == "Issues") .ForEach(demoDefinition => { var issueId = Rds.ExecuteScalar_response( context: context, selectIdentity: true, statements: new SqlStatement[] { Rds.InsertItems( setIdentity: true, param: Rds.ItemsParam() .ReferenceType("Issues") .Creator(idHash.Get(demoDefinition.Creator)) .Updator(idHash.Get(demoDefinition.Updator)) .CreatedTime(demoDefinition.CreatedTime.DemoTime(demoModel)) .UpdatedTime(demoDefinition.CreatedTime.DemoTime(demoModel)), addUpdatorParam: false), Rds.InsertIssues( param: Rds.IssuesParam() .SiteId(idHash.Get(demoDefinition.ParentId)) .IssueId(raw: Def.Sql.Identity) .Title(demoDefinition.Title) .Body(demoDefinition.Body.Replace(idHash)) .StartTime(demoDefinition.StartTime.DemoTime(demoModel)) .CompletionTime(demoDefinition.CompletionTime .AddDays(1).DemoTime(demoModel)) .WorkValue(demoDefinition.WorkValue) .ProgressRate(0) .Status(demoDefinition.Status) .Manager(idHash.Get(demoDefinition.Manager)) .Owner(idHash.Get(demoDefinition.Owner)) .ClassA(demoDefinition.ClassA.Replace(idHash)) .ClassB(demoDefinition.ClassB.Replace(idHash)) .ClassC(demoDefinition.ClassC.Replace(idHash)) .ClassD(demoDefinition.ClassD.Replace(idHash)) .ClassE(demoDefinition.ClassE.Replace(idHash)) .ClassF(demoDefinition.ClassF.Replace(idHash)) .ClassG(demoDefinition.ClassG.Replace(idHash)) .ClassH(demoDefinition.ClassH.Replace(idHash)) .ClassI(demoDefinition.ClassI.Replace(idHash)) .ClassJ(demoDefinition.ClassJ.Replace(idHash)) .ClassK(demoDefinition.ClassK.Replace(idHash)) .ClassL(demoDefinition.ClassL.Replace(idHash)) .ClassM(demoDefinition.ClassM.Replace(idHash)) .ClassN(demoDefinition.ClassN.Replace(idHash)) .ClassO(demoDefinition.ClassO.Replace(idHash)) .ClassP(demoDefinition.ClassP.Replace(idHash)) .ClassQ(demoDefinition.ClassQ.Replace(idHash)) .ClassR(demoDefinition.ClassR.Replace(idHash)) .ClassS(demoDefinition.ClassS.Replace(idHash)) .ClassT(demoDefinition.ClassT.Replace(idHash)) .ClassU(demoDefinition.ClassU.Replace(idHash)) .ClassV(demoDefinition.ClassV.Replace(idHash)) .ClassW(demoDefinition.ClassW.Replace(idHash)) .ClassX(demoDefinition.ClassX.Replace(idHash)) .ClassY(demoDefinition.ClassY.Replace(idHash)) .ClassZ(demoDefinition.ClassZ.Replace(idHash)) .NumA(demoDefinition.NumA) .NumB(demoDefinition.NumB) .NumC(demoDefinition.NumC) .NumD(demoDefinition.NumD) .NumE(demoDefinition.NumE) .NumF(demoDefinition.NumF) .NumG(demoDefinition.NumG) .NumH(demoDefinition.NumH) .NumI(demoDefinition.NumI) .NumJ(demoDefinition.NumJ) .NumK(demoDefinition.NumK) .NumL(demoDefinition.NumL) .NumM(demoDefinition.NumM) .NumN(demoDefinition.NumN) .NumO(demoDefinition.NumO) .NumP(demoDefinition.NumP) .NumQ(demoDefinition.NumQ) .NumR(demoDefinition.NumR) .NumS(demoDefinition.NumS) .NumT(demoDefinition.NumT) .NumU(demoDefinition.NumU) .NumV(demoDefinition.NumV) .NumW(demoDefinition.NumW) .NumX(demoDefinition.NumX) .NumY(demoDefinition.NumY) .NumZ(demoDefinition.NumZ) .DateA(demoDefinition.DateA) .DateB(demoDefinition.DateB) .DateC(demoDefinition.DateC) .DateD(demoDefinition.DateD) .DateE(demoDefinition.DateE) .DateF(demoDefinition.DateF) .DateG(demoDefinition.DateG) .DateH(demoDefinition.DateH) .DateI(demoDefinition.DateI) .DateJ(demoDefinition.DateJ) .DateK(demoDefinition.DateK) .DateL(demoDefinition.DateL) .DateM(demoDefinition.DateM) .DateN(demoDefinition.DateN) .DateO(demoDefinition.DateO) .DateP(demoDefinition.DateP) .DateQ(demoDefinition.DateQ) .DateR(demoDefinition.DateR) .DateS(demoDefinition.DateS) .DateT(demoDefinition.DateT) .DateU(demoDefinition.DateU) .DateV(demoDefinition.DateV) .DateW(demoDefinition.DateW) .DateX(demoDefinition.DateX) .DateY(demoDefinition.DateY) .DateZ(demoDefinition.DateZ) .DescriptionA(demoDefinition.DescriptionA) .DescriptionB(demoDefinition.DescriptionB) .DescriptionC(demoDefinition.DescriptionC) .DescriptionD(demoDefinition.DescriptionD) .DescriptionE(demoDefinition.DescriptionE) .DescriptionF(demoDefinition.DescriptionF) .DescriptionG(demoDefinition.DescriptionG) .DescriptionH(demoDefinition.DescriptionH) .DescriptionI(demoDefinition.DescriptionI) .DescriptionJ(demoDefinition.DescriptionJ) .DescriptionK(demoDefinition.DescriptionK) .DescriptionL(demoDefinition.DescriptionL) .DescriptionM(demoDefinition.DescriptionM) .DescriptionN(demoDefinition.DescriptionN) .DescriptionO(demoDefinition.DescriptionO) .DescriptionP(demoDefinition.DescriptionP) .DescriptionQ(demoDefinition.DescriptionQ) .DescriptionR(demoDefinition.DescriptionR) .DescriptionS(demoDefinition.DescriptionS) .DescriptionT(demoDefinition.DescriptionT) .DescriptionU(demoDefinition.DescriptionU) .DescriptionV(demoDefinition.DescriptionV) .DescriptionW(demoDefinition.DescriptionW) .DescriptionX(demoDefinition.DescriptionX) .DescriptionY(demoDefinition.DescriptionY) .DescriptionZ(demoDefinition.DescriptionZ) .CheckA(demoDefinition.CheckA) .CheckB(demoDefinition.CheckB) .CheckC(demoDefinition.CheckC) .CheckD(demoDefinition.CheckD) .CheckE(demoDefinition.CheckE) .CheckF(demoDefinition.CheckF) .CheckG(demoDefinition.CheckG) .CheckH(demoDefinition.CheckH) .CheckI(demoDefinition.CheckI) .CheckJ(demoDefinition.CheckJ) .CheckK(demoDefinition.CheckK) .CheckL(demoDefinition.CheckL) .CheckM(demoDefinition.CheckM) .CheckN(demoDefinition.CheckN) .CheckO(demoDefinition.CheckO) .CheckP(demoDefinition.CheckP) .CheckQ(demoDefinition.CheckQ) .CheckR(demoDefinition.CheckR) .CheckS(demoDefinition.CheckS) .CheckT(demoDefinition.CheckT) .CheckU(demoDefinition.CheckU) .CheckV(demoDefinition.CheckV) .CheckW(demoDefinition.CheckW) .CheckX(demoDefinition.CheckX) .CheckY(demoDefinition.CheckY) .CheckZ(demoDefinition.CheckZ) .Comments(Comments(demoModel, idHash, demoDefinition.Id)) .Creator(idHash.Get(demoDefinition.Creator)) .Updator(idHash.Get(demoDefinition.Updator)) .CreatedTime(demoDefinition.CreatedTime.DemoTime(demoModel)) .UpdatedTime(demoDefinition.CreatedTime.DemoTime(demoModel)), addUpdatorParam: false) }).Identity.ToLong(); idHash.Add(demoDefinition.Id, issueId); var siteModel = new SiteModel().Get( context: context, where : Rds.SitesWhere().SiteId(idHash.Get(demoDefinition.ParentId))); var ss = siteModel.IssuesSiteSettings(context: context, referenceId: issueId); var issueModel = new IssueModel( context: context, ss: ss, issueId: issueId); var fullText = issueModel.FullText(context: context, ss: ss); Rds.ExecuteNonQuery( context: context, statements: Rds.UpdateItems( param: Rds.ItemsParam() .SiteId(issueModel.SiteId) .Title(issueModel.Title.DisplayValue) .FullText(fullText, _using: fullText != null), where : Rds.ItemsWhere().ReferenceId(issueModel.IssueId), addUpdatorParam: false, addUpdatedTimeParam: false)); var days = issueModel.CompletionTime.Value < DateTime.Now ? (issueModel.CompletionTime.Value - issueModel.StartTime).Days : (DateTime.Now - issueModel.StartTime).Days; if (demoDefinition.ProgressRate > 0) { var startTime = issueModel.StartTime; var progressRate = demoDefinition.ProgressRate; var status = issueModel.Status.Value; var creator = issueModel.Creator.Id; var updator = issueModel.Updator.Id; for (var d = 0; d < days - 1; d++) { issueModel.VerUp = true; issueModel.Update(context: context, ss: ss); var recordingTime = d > 0 ? startTime .AddDays(d) .AddHours(-6) .AddMinutes(new Random().Next(-360, +360)) : issueModel.CreatedTime.Value; Rds.ExecuteNonQuery( context: context, statements: Rds.UpdateIssues( tableType: Sqls.TableTypes.History, addUpdatedTimeParam: false, addUpdatorParam: false, param: Rds.IssuesParam() .ProgressRate(ProgressRate(progressRate, days, d)) .Status(d > 0 ? 200 : 100) .Creator(creator) .Updator(updator) .CreatedTime(recordingTime) .UpdatedTime(recordingTime), where : Rds.IssuesWhere() .IssueId(issueModel.IssueId) .Ver(sub: Rds.SelectIssues( tableType: Sqls.TableTypes.HistoryWithoutFlag, column: Rds.IssuesColumn() .Ver(function: Sqls.Functions.Max), where : Rds.IssuesWhere() .IssueId(issueModel.IssueId))))); } Rds.ExecuteNonQuery( context: context, statements: Rds.UpdateIssues( addUpdatorParam: false, addUpdatedTimeParam: false, param: Rds.IssuesParam() .ProgressRate(progressRate) .Status(status) .Creator(creator) .Updator(updator) .CreatedTime(demoDefinition.CreatedTime.DemoTime(demoModel)) .UpdatedTime(demoDefinition.UpdatedTime.DemoTime(demoModel)), where : Rds.IssuesWhere() .IssueId(issueModel.IssueId))); } }); }
public string Calendar() { SetSite(); ViewModes.Set(Site.SiteId); switch (Site.ReferenceType) { case "Issues": return(IssueUtilities.Calendar( ss: Site.IssuesSiteSettings( ReferenceId, setAllChoices: true, setSiteIntegration: true))); case "Results": return(ResultUtilities.Calendar( ss: Site.ResultsSiteSettings( ReferenceId, setAllChoices: true, setSiteIntegration: true))); default: return(HtmlTemplates.Error(Error.Types.NotFound)); } }