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

AddRecord() public method

AddRecord Uses DAL helper class to execute u_AddRecord_i using the current record in the view Takes strProjectName as a parameter and doesn't need to, this should be removed. Calls the ConvertKCPToString function to get the string of locations and numbers from the Key Value Pair.
public AddRecord ( string strClientName ) : bool
strClientName string string
return bool
        public bool AddRecord(string strClientName)
        {
            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("@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", ""));
            }

            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", ""));
            }

            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;
            }
        }