Пример #1
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         var obj = GenerateBISpecification();
         using (var dlg = new SaveFileDialog()
         {
             DefaultExt = "json"
         })
         {
             dlg.ShowDialog();
             using (StreamWriter sw = File.CreateText(dlg.FileName))
             {
                 sw.Write(BISpecification.Serialize(obj));
                 sw.Close();
             }
         }
         MessageBox.Show("Save File Successful!");
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Пример #2
0
        public void CommitSpecification(BISpecification spec)
        {
            string updateValidFlagStatement = "UPDATE [BI_Specification] SET [Validation]=0 WHERE [Plan]='<Plan>' AND [Validation]=1\n".Replace("<Plan>", spec.Plan);
            string insertNewSpecStatement   = "INSERT [BI_Specification] ([Plan],[Version],[Content],[Load_Time],[Validation]) VALUES ('<Plan>','<Version>','<Content>',GETDATE(),1)\n"
                                              .Replace("<Plan>", spec.Plan).Replace("<Version>", spec.Version).Replace("<Content>", BISpecification.Serialize(spec));
            string cmd = "set xact_abort on\nbegin tran\n<statement>\ncommit tran\ngo".Replace("<statement>", updateValidFlagStatement + insertNewSpecStatement);

            Execute(cmd);
        }