private void DeleteCurrentRow() { DataGridViewRow row = DiaryGV.CurrentRow; DiaryLine line = (DiaryLine)row.DataBoundItem; diary.DiaryLines.Remove(line); ProvisionData(); }
public LineForm(Diary diary, DiaryLine line = null) { InitializeComponent(); theDiary = diary; alteredLine = new DiaryLine(); originalLine = line; BasicSetup(diary.Questions); ApplyData(originalLine); SetToolTips(); }
private void UploadToSQL(DiaryLine line, List <Tuple <string, string> > variableNames) { string logic = line.Logic; foreach (Tuple <string, string> t in variableNames) { logic = logic.ToLower(); if (logic.Contains(t.Item1.ToLower())) { logic = logic.Replace(t.Item1.ToLower(), t.Item2); } } List <SqlParameter> paramList = new List <SqlParameter>(); paramList.Add(new SqlParameter("DiaryType", diary.Name)); if (line.TypeOfLine == LineType.Check) { paramList.Add(new SqlParameter("pdate", "NULL")); paramList.Add(new SqlParameter("sdate", "NULL")); paramList.Add(new SqlParameter("ddate", "NULL")); paramList.Add(new SqlParameter("cclass", "04")); } else { paramList.Add(new SqlParameter("pdate", line.PromptDate.ToFileString())); paramList.Add(new SqlParameter("sdate", line.StatDate.ToFileString())); paramList.Add(new SqlParameter("ddate", line.DueDate.ToFileString())); paramList.Add(new SqlParameter("cclass", line.LineClass)); } paramList.Add(new SqlParameter("desc1", Tools.ConvertString(line.Description))); paramList.Add(new SqlParameter("reg13", Tools.ConvertString(line.RegLink))); paramList.Add(new SqlParameter("logic", logic)); paramList.Add(new SqlParameter("applink", line.DocumentLink)); paramList.Add(new SqlParameter("sectionlink", line.SectionLink)); paramList.Add(new SqlParameter("rulelink", line.RuleLink)); paramList.Add(new SqlParameter("guidancelink", line.WebLink)); paramList.Add(new SqlParameter("role", line.Role)); paramList.Add(new SqlParameter("category", line.Category.SortOrder + "-" + line.Category.Title)); paramList.Add(new SqlParameter("offset", line.Offset)); paramList.Add(new SqlParameter("templatelineno", line.Offset)); paramList.Add(new SqlParameter("nexttemplate", line.NextTemplateName)); paramList.Add(new SqlParameter("recurmonth", line.RecurringMonthsToAdd)); Tools.RunCommand("Insert into ips_diarytemplate([diarytype],[cclass],[pdate],[sdate],[ddate],[desc1],[reg13],[logic],[applink],[sectionlink],[rulelink],[guidancelink],[role],[category],[offset],[nexttemplate],[recurmonth],templatelineno) " + "VALUES(@DiaryType, @cclass, @pdate, @sdate, @ddate, @desc1, @reg13, @logic, @applink, @sectionlink, @rulelink, @guidancelink, @role, @category, @offset, @nexttemplate, @recurmonth, @templatelineno)", paramList); }
public Diary(string[] diaryLines) { Header = new List <string>(); Questions = new List <Question>(); DiaryDates = new List <DiaryDate>(); DiaryLines = new List <DiaryLine>(); bool inHeader = true; foreach (string line in diaryLines) { if (inHeader) { Header.Add(line); //Find the template name if (line.ToUpper().Contains("DYTYPE :=")) { //get everything from the = to the closing ; Name = line.Substring(line.IndexOf("=") + 1); Debug.Print(Name); Name = Name.Replace(';', ' '); Debug.Print(Name); Name = Tools.ConvertString(Name, false); Debug.Print(Name); } if (line.Contains("Begin Diary Lines")) { inHeader = false; } continue; } else { if (line.ToUpper().Contains("CHECKLINE") || line.ToUpper().Contains("DIARYLINE")) { DiaryLine newLine = new DiaryLine(line); DiaryLines.Add(newLine); } continue; } } DiaryCategories = DiaryLines.AsEnumerable() .Select(s => new DiaryLineCategory { Title = s.Category.Title, SortOrder = s.Category.SortOrder }) .Distinct().ToList(); Questions = Question.CaptureQuestions(Header); }
private void EditCurrentRow() { DataGridViewRow row = DiaryGV.CurrentRow; if (row.IsNewRow) { AddRow(); } else { DiaryLine line = (DiaryLine)row.DataBoundItem; LineForm editForm = new LineForm(diary, line); if (editForm.ShowDialog() == DialogResult.OK) { diary.DiaryLines.Remove(line); diary.DiaryLines.Add(editForm.alteredLine); } } ProvisionData(); }
public void ApplyData(DiaryLine originalLine) { LogicCB.Text = originalLine.Logic; ClassDDL.Text = originalLine.LineClass; if (originalLine.TypeOfLine == LineType.Diary) { pMonthSpin.Value = originalLine.PromptDate.MonthsToAdd; pdaysSpin.Value = originalLine.PromptDate.DaysToAdd; pdateddl.SelectedItem = originalLine.PromptDate.BaseDate; sMonthSpin.Value = originalLine.StatDate.MonthsToAdd; sdaysSpin.Value = originalLine.StatDate.DaysToAdd; sdateddl.SelectedItem = originalLine.StatDate.BaseDate; dMonthSpin.Value = originalLine.DueDate.MonthsToAdd; ddaysSpin.Value = originalLine.DueDate.DaysToAdd; ddateddl.SelectedItem = originalLine.DueDate.BaseDate; rMonthSpin.Value = originalLine.RecurringMonthsToAdd; } DescTB.Text = originalLine.Description; DocLinkTb.Text = originalLine.DocumentLink; SectionTB.Text = originalLine.SectionLink; RuleTB.Text = originalLine.RuleLink; GuidanceTB.Text = originalLine.WebLink; CategoryDDL.Text = originalLine.Category.Title; RoleDDL.Text = originalLine.Role.ToString(); NextTemplateTB.Text = originalLine.NextTemplateName; //set to the ORderddl List <int> orderOptions = new List <int>(); orderOptions.Add(originalLine.Offset); orderOptions.AddRange(CalculateOrderOptions(originalLine.Category.Title)); OrderDDL.DataSource = orderOptions; OrderDDL.SelectedItem = originalLine.Offset; }