BoxDetails.Presenter.BoxDetailsPresenter.UpdateRecord C# (CSharp) Method

UpdateRecord() public method

UpdateRecord Uses DAL helper class to execute u_UpdateRecord_u using the current record in the view Checks each view property has a value before assigning it. Calls the ConvertKCPToString function to get the string of locations and numbers from the Key Value Pair.
public UpdateRecord ( ) : bool
return bool
        public bool UpdateRecord()
        {
            SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["DbConnection"].ConnectionString);
            connection.Open();
            SqlCommand command = new SqlCommand("u_AddRecord_i", connection);
            command.CommandType = CommandType.StoredProcedure;

            command.Parameters.Add(new SqlParameter("@ID", _recordView.Id));
            command.Parameters.Add(new SqlParameter("@ClientName", _recordView.ClientName));
            command.Parameters.Add(new SqlParameter("@ClientNumber", _recordView.ClientNumber));
            command.Parameters.Add(new SqlParameter("@ClientLeader", _recordView.ClientLeader));
            command.Parameters.Add(new SqlParameter("@ReviewDate", _recordView.reviewDate.GetValueOrDefault(new DateTime(1900, 01, 01))));
            command.Parameters.Add(new SqlParameter("@CompletionDate", _recordView.completionDate.GetValueOrDefault(new DateTime(1900, 01, 01))));
            command.Parameters.Add(new SqlParameter("@Comments", _recordView.comments));

            if (_recordView.file.ContentLength > 0)
            {
                _recordView.file.SaveAs(ConfigurationManager.AppSettings["FileSaveLocation"] + Path.GetFileName(_recordView.file.FileName));
                command.Parameters.Add(new SqlParameter("@FileLocation", Path.GetFileName(_recordView.file.FileName)));
            }
            else
            {
                command.Parameters.Add(new SqlParameter("@FileLocation", _recordView.fileName));
            }

            if (_recordView.file2.ContentLength > 0)
            {
                _recordView.file2.SaveAs(ConfigurationManager.AppSettings["FileSaveLocation"] + Path.GetFileName(_recordView.file2.FileName));
                command.Parameters.Add(new SqlParameter("@FileLocation2", Path.GetFileName(_recordView.file2.FileName)));
            }
            else
            {
                command.Parameters.Add(new SqlParameter("@FileLocation2", _recordView.fileName2));
            }

            command.Parameters.Add(new SqlParameter("@SecureStorage", _recordView.SecureStorage));
            command.Parameters.Add(new SqlParameter("@BoxDetails", ConvertKVPToString(_recordView.boxDetails)));

            try
            {
                return command.ExecuteNonQuery() != 0;
            }
            catch (Exception e)
            {
                return false;
            }
        }