Пример #1
0
        public DiaryLine(string line)
        {
            Debug.WriteLine(line);
            int    lineLength = line.LastIndexOf(")") - line.IndexOf("(") - 1;
            string newLine    = line.Substring(line.IndexOf("(") + 1, lineLength);

            string[] str = Regex.Split(newLine, @"(?<!,[^(]+\([^)]+)(?=(?:[^']*'[^']*')*[^']*$),").ToArray();
            if (line.ToUpper().Contains("INSERTCHECKLINE("))
            {
                TypeOfLine       = IPS_Compliance.LineType.Check;
                Logic            = Tools.ConvertString(str[0], false);
                Description      = Tools.ConvertString(str[1], false);
                RegLink          = Tools.ConvertString(str[2], false);
                DocumentLink     = Tools.ConvertString(str[3], false);
                SectionLink      = Tools.ConvertString(str[4], false);
                RuleLink         = Tools.ConvertString(str[5], false);
                WebLink          = Tools.ConvertString(str[6], false);
                Category         = new DiaryLineCategory(Tools.ConvertString(str[7], false));
                Role             = int.Parse(Tools.ConvertString(str[8], false));
                NextTemplateName = Tools.ConvertString(str[9], false);
                Offset           = int.Parse(Tools.ConvertString(str[10], false));
            }
            else if (line.ToUpper().Contains("INSERTDIARYLINE("))
            {
                int i = 0;
                TypeOfLine = IPS_Compliance.LineType.Diary;
                Logic      = Tools.ConvertString(str[0], false);
                LineClass  = Tools.ConvertString(str[1], false);
                PromptDate = new DiaryDate(Tools.ConvertString(str[2], false));
                if (PromptDate.IsBonding)
                {
                    i += 3;
                }
                StatDate = new DiaryDate(Tools.ConvertString(str[3 + i], false));
                if (StatDate.IsBonding)
                {
                    i += 3;
                }
                DueDate = new DiaryDate(Tools.ConvertString(str[4 + i], false));
                if (DueDate.IsBonding)
                {
                    i += 3;
                }
                Description          = Tools.ConvertString(str[5 + i], false);
                SectionLink          = Tools.ConvertString(str[8 + i], false);
                RegLink              = Tools.ConvertString(str[6 + i], false);
                WebLink              = Tools.ConvertString(str[10 + i], false);
                RuleLink             = Tools.ConvertString(str[9 + i], false);
                DocumentLink         = Tools.ConvertString(str[7 + i], false);
                Category             = new DiaryLineCategory(Tools.ConvertString(str[11 + i], false));
                Role                 = int.Parse(Tools.ConvertString(str[12 + i], false));
                Offset               = int.Parse(Tools.ConvertString(str[14 + i], false));
                NextTemplateName     = Tools.ConvertString(str[13 + i], false);
                RecurringMonthsToAdd = int.Parse(Tools.ConvertString(str[15 + i], false));
            }
        }
Пример #2
0
 private void SaveBtn_Click(object sender, EventArgs e)
 {
     alteredLine.Logic     = LogicCB.Text;
     alteredLine.LineClass = ClassDDL.Text;
     if (!ClassDDL.Text.Contains('4'))
     {
         alteredLine.PromptDate = new DiaryDate(pdateddl.SelectedItem.ToString(), (int)pMonthSpin.Value, (int)pdaysSpin.Value, BusinessCheck.Checked, false);
         alteredLine.StatDate   = new DiaryDate(sdateddl.SelectedItem.ToString(), (int)sMonthSpin.Value, (int)sdaysSpin.Value, BusinessCheck.Checked, false);
         alteredLine.DueDate    = new DiaryDate(ddateddl.SelectedItem.ToString(), (int)dMonthSpin.Value, (int)ddaysSpin.Value, BusinessCheck.Checked, false);
         alteredLine.TypeOfLine = LineType.Diary;
     }
     else
     {
         alteredLine.TypeOfLine = LineType.Check;
     }
     alteredLine.Description = DescTB.Text;
     //we don't alter the Reg13 so just replace the existing entry
     if (originalLine == null)
     {
         alteredLine.RegLink = "''";
     }
     else
     {
         alteredLine.RegLink = originalLine.RegLink;
     }
     alteredLine.DocumentLink         = DocLinkTb.Text;
     alteredLine.SectionLink          = SectionTB.Text;
     alteredLine.RuleLink             = RuleTB.Text;
     alteredLine.WebLink              = GuidanceTB.Text;
     alteredLine.Category             = DiaryLineCategory.FindFromTitle(theDiary.DiaryCategories, CategoryDDL.SelectedValue.ToString());
     alteredLine.Role                 = int.Parse(RoleDDL.SelectedValue.ToString());
     alteredLine.NextTemplateName     = NextTemplateTB.Text;
     alteredLine.Offset               = int.Parse(OrderDDL.SelectedValue.ToString());
     alteredLine.RecurringMonthsToAdd = (int)rMonthSpin.Value;
     this.DialogResult                = System.Windows.Forms.DialogResult.OK;
     this.Close();
 }