Exemple #1
0
        public void AddPostSaleToDatabase()
        {
            SqlConnection connection = Connection();
            SqlCommand    command;
            string        query;

            query = "INSERT INTO PostSale(StepName, Notes, CompleteDate, DueDate, StepNumber, OfferRef, StepCost, Complete) VALUES(@StepName, @Notes, @CompleteDate, @DueDate, @StepNumber, @OfferRef, @StepCost, @Complete)";

            connection.Open();

            command = new SqlCommand(query, connection);
            command.Parameters.AddWithValue("@StepName", StepName);
            command.Parameters.AddWithValue("@Notes", Note);
            command.Parameters.AddWithValue("@CompleteDate", CompleteDate);
            command.Parameters.AddWithValue("@DueDate", DueDate);
            command.Parameters.AddWithValue("@StepNumber", StepNumber);
            command.Parameters.AddWithValue("@OfferRef", OfferRef);
            command.Parameters.AddWithValue("@StepCost", StepCost);
            command.Parameters.AddWithValue("@Complete", Complete.ToString());

            foreach (SqlParameter parameter in command.Parameters)
            {
                if (parameter.Value == null)
                {
                    parameter.Value = DBNull.Value;
                }
            }

            command.ExecuteNonQuery();
            connection.Close();
        }
Exemple #2
0
 public void WriteXml(XmlWriter xr)
 {
     xr.WriteStartElement("name");
     xr.WriteString(name);
     xr.WriteEndElement();
     xr.WriteStartElement("type");
     xr.WriteString(type);
     xr.WriteEndElement();
     xr.WriteStartElement("model");
     xr.WriteString(model);
     xr.WriteEndElement();
     xr.WriteStartElement("flags");
     xr.WriteAttributeString("known", Known.ToString());
     xr.WriteAttributeString("complete", Complete.ToString());
     xr.WriteEndElement();
     xr.WriteStartElement("category");
     xr.WriteAttributeString("id", Category.ToString());
     xr.WriteEndElement();
     xr.WriteStartElement("notes");
     xr.WriteString(notes);
     xr.WriteEndElement();
     xr.WriteStartElement("files");
     xr.WriteString(files);
     xr.WriteEndElement();
     foreach (ObjectDbField f in Fields)
     {
         f.WriteXml(xr);
     }
 }
Exemple #3
0
        public void Save()
        {
            if (String.IsNullOrEmpty(Id))
            {
                throw new InvalidOperationException();
            }

            var document = new XDocument(new XElement("deployment",
                                                      new XElement("id", Id),
                                                      new XElement("author", XmlUtility.Sanitize(Author)),
                                                      new XElement("deployer", Deployer),
                                                      new XElement("authorEmail", AuthorEmail),
                                                      new XElement("message", XmlUtility.Sanitize(Message)),
                                                      new XElement("progress", Progress),
                                                      new XElement("status", Status),
                                                      new XElement("statusText", StatusText),
                                                      new XElement("lastSuccessEndTime", LastSuccessEndTime),
                                                      new XElement("receivedTime", ReceivedTime),
                                                      new XElement("startTime", StartTime),
                                                      new XElement("endTime", EndTime),
                                                      new XElement("complete", Complete.ToString()),
                                                      new XElement("is_temp", IsTemporary.ToString()),
                                                      new XElement("is_readonly", IsReadOnly.ToString())
                                                      ));

            _statusLock.LockOperation(() =>
            {
                using (Stream stream = FileSystemHelpers.CreateFile(_statusFile))
                {
                    document.Save(stream);
                }

                OperationManager.Attempt(() =>
                {
                    // Used for ETAG
                    if (FileSystemHelpers.FileExists(_activeFile))
                    {
                        FileSystemHelpers.SetLastWriteTimeUtc(_activeFile, DateTime.UtcNow);
                    }
                    else
                    {
                        FileSystemHelpers.WriteAllText(_activeFile, String.Empty);
                    }
                });

                OperationManager.Attempt(() =>
                {
                    // enable the feature thru configuration
                    if (ScmHostingConfigurations.DeploymentStatusCompleteFileEnabled && Complete)
                    {
                        FileSystemHelpers.CopyFile(_statusFile, _statusCompleteFile);
                    }
                    else if (FileSystemHelpers.FileExists(_statusCompleteFile))
                    {
                        FileSystemHelpers.DeleteFile(_statusCompleteFile);
                    }
                });
            }, "Updating deployment status", DeploymentStatusManager.LockTimeout);
        }
 private void ClearData()
 {
     TotalRecord = 0;
     Complete    = 0;
     Failed      = 0;
     progressBarInsReport.Value   = 0;
     progressBarInsReport.Visible = false;
     lbl_totalrecord.Text         = TotalRecord.ToString();
     lbl_complete.Text            = Complete.ToString();
     lbl_failed.Text = Failed.ToString();
 }
 public Dictionary <string, string> GetUrlParameters()
 {
     return(new Dictionary <string, string>
     {
         { "database", Database },
         { "type", Type.ToString().ToLower() },
         { "waitForSync", WaitForSync.ToString() },
         { "complete", Complete.ToString() },
         { "details", Details.ToString() },
         { "collection", Collection },
         { "createCollection", CreateCollection.ToString() },
     });
 }
Exemple #6
0
        public void Save()
        {
            if (String.IsNullOrEmpty(Id))
            {
                throw new InvalidOperationException();
            }

            var document = new XDocument(new XElement("deployment",
                                                      new XElement("id", Id),
                                                      new XElement("author", Author),
                                                      new XElement("deployer", Deployer),
                                                      new XElement("authorEmail", AuthorEmail),
                                                      new XElement("message", Message),
                                                      new XElement("progress", Progress),
                                                      new XElement("status", Status),
                                                      new XElement("statusText", StatusText),
                                                      new XElement("lastSuccessEndTime", LastSuccessEndTime),
                                                      new XElement("receivedTime", ReceivedTime),
                                                      new XElement("startTime", StartTime),
                                                      new XElement("endTime", EndTime),
                                                      new XElement("complete", Complete.ToString()),
                                                      new XElement("is_temp", IsTemporary.ToString()),
                                                      new XElement("is_readonly", IsReadOnly.ToString())
                                                      ));

            _statusLock.LockOperation(() =>
            {
                using (Stream stream = FileSystemHelpers.CreateFile(_statusFile))
                {
                    document.Save(stream);
                }

                // Used for ETAG
                if (FileSystemHelpers.FileExists(_activeFile))
                {
                    FileSystemHelpers.SetLastWriteTimeUtc(_activeFile, DateTime.UtcNow);
                }
                else
                {
                    FileSystemHelpers.WriteAllText(_activeFile, String.Empty);
                }
            }, DeploymentStatusManager.LockTimeout);
        }
 private void ReportStatus()
 {
     lbl_complete.Text = Complete.ToString();
     lbl_failed.Text   = Failed.ToString();
 }